Article:
 |
|
Write Twice, Run Anywhere
|
| Subject: |
|
Write Twice, Run Anywhere |
| Date: |
|
2002-09-22 18:50:11 |
| From: |
|
anonymous2
|
|
|
Daniel
Your Java instruction in every case has been very helpful and I always look forward to your next tutorial. I created the Write Twice, Run Anywhere program in Project Builder on the Mac and wanted to comment on a few things.
1) When I compiled and ran the program in your first example (e.g. before the Arrrg!), the menu was not on the frame itself, it was where it was supposed to be (Arrrg - not!)???
2) I realized that creating a New Group in Project Builder does not create a new directory folder. However, I was able to create folders in the directory (MacGUI, WindowsGUI, commonGUI) and then use Show Info to change the classpath.
3) Although the program compiles, I haven't been able to build the application and I'm wondering if the following method could be the culprit (needs an " if "??). The log is referenced below. Thanks again for the tutorial instruction.
private JMenuBar getCorrectMenuBar(){
System.setProperty("com.apple.macos.useScreenMenuBar","true");
return new MacJMenuBar();
} else return new WindowsJMenuBar();
}
[LaunchRunner Error] MainFrame.main(String[]) threw an exception:
java.lang.NoClassDefFoundError: commonGUI/OpenMenuItem
at MacGUI.MacJMenuBar.<init>(MacJMenuBar.java:8)
at MainFrame.getCorrectMenuBar(MainFrame.java:17)
at MainFrame.<init>(MainFrame.java:10)
at MainFrame.main(MainFrame.java:23)
at java.lang.reflect.Method.invoke(Native Method)
at com.apple.buckyball.app.LaunchRunner.run(LaunchRunner.java:82)
at com.apple.buckyball.app.LaunchRunner.callMain(LaunchRunner.java:44)
at com.apple.buckyball.app.CarbonLibApp.launch(CarbonLibApp.java:67)
|
Showing messages 1 through 2 of 2.
Thanks for your note. Although I like a lot of what Apple has done, I am not a fan of Project Builder for Java development and don't use it. I'm guessing from your first issue that you created a new Java Swing project using Project Builder. When you do this, properties are set for you and the MRJ class files are linked without you knowing where they are.
As for item (2), that's one of the things I don't like about PB. I want there to be a correspondence between the directory structure and the packages. I agree with your comment, but wish it didn't require extra steps. The file management is almost like the iApps where you have playlists on iTunes and Albums in iPhoto. Again, if you like PB for Java programming, that's great. It is free and provides everything you really need.
I'm sorry for the error that led to your question (3). There is an entire line missing from the code. The original version of the code was this.
The corrected version of the code should have just inserted a line into this code -- I'm sorry for the mistake. Here's the corrected code.
The only addition is the System.setProperty() method call. Thanks again for catching this error. Sorry for the inconvenience.
Daniel