Ok, starting to code a bit here on the mac. OS X 10.4.8 on a new Intel MacPro. Java -version is:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-113)
Java HotSpot(TM) Client VM (build 1.5.0_06-68, mixed mode, sharing)
After I write my code (using Textwrangler) I open Terminal, and type:
javac /Users/toddburch/Documents/myjava/MyClass.java
and it works fine. Then, I type
java MyClass /Users/toddburch/Documents/myjava
and I get the "Hello World" written to stdout. So far, so good.
With my longer test program that throws up a couple dialog boxes, I do the same things:
javac /Users/toddburch/Documents/myjava/MessageDialogDemo.java
and it works fine too, other than giving me a warning for a deprecacted function. This time, though, I get additional .class files. Instead of just getting:
MessageDialog.class and
MessageDialogDemo.class, I also get
MessageDialog$1.class and
MessageDialogDemo$1.class. What's up with these?
Then, again from the root directory (/), as before, I enter
java MessageDialogDemo /Users/toddburch/Documents/myjava
and I ALWAYS get:
Exception in thread "main" java.lang.NoClassDefFoundError: MessageDialogDemo
If I "cd Documents/myjava" and enter
java MessageDialogDemo
It works fine! I'm pulling my hair out here. Why is an exception occuring when I provide the path from the command line with this second program and not the first? Could it be a classpath issue, where MessageDialog.class is not being found? If so, how to fix?
...
hmmmmm... thinking... trying another test
....
OK, I tried the -verbose option, and that didn't shed any light on this. I then tried providing a classpath:
java -cp</Users/toddburch/Documents/myjava> MessageDialogDemo /Users/toddburch/Documents/myjava
This time, bash returned, with no error message, and no program output. What could this be? Are there considerations with running a GUI from within a shell command line?
I can post the code if that would be helpful - it's an example from a Java book I typed up.
Sorry for the long post - but that's where I'm at. Todd
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-113)
Java HotSpot(TM) Client VM (build 1.5.0_06-68, mixed mode, sharing)
After I write my code (using Textwrangler) I open Terminal, and type:
javac /Users/toddburch/Documents/myjava/MyClass.java
and it works fine. Then, I type
java MyClass /Users/toddburch/Documents/myjava
and I get the "Hello World" written to stdout. So far, so good.
With my longer test program that throws up a couple dialog boxes, I do the same things:
javac /Users/toddburch/Documents/myjava/MessageDialogDemo.java
and it works fine too, other than giving me a warning for a deprecacted function. This time, though, I get additional .class files. Instead of just getting:
MessageDialog.class and
MessageDialogDemo.class, I also get
MessageDialog$1.class and
MessageDialogDemo$1.class. What's up with these?
Then, again from the root directory (/), as before, I enter
java MessageDialogDemo /Users/toddburch/Documents/myjava
and I ALWAYS get:
Exception in thread "main" java.lang.NoClassDefFoundError: MessageDialogDemo
If I "cd Documents/myjava" and enter
java MessageDialogDemo
It works fine! I'm pulling my hair out here. Why is an exception occuring when I provide the path from the command line with this second program and not the first? Could it be a classpath issue, where MessageDialog.class is not being found? If so, how to fix?
...
hmmmmm... thinking... trying another test
....
OK, I tried the -verbose option, and that didn't shed any light on this. I then tried providing a classpath:
java -cp</Users/toddburch/Documents/myjava> MessageDialogDemo /Users/toddburch/Documents/myjava
This time, bash returned, with no error message, and no program output. What could this be? Are there considerations with running a GUI from within a shell command line?
I can post the code if that would be helpful - it's an example from a Java book I typed up.
Sorry for the long post - but that's where I'm at. Todd