I wrote up a sample program for my students (it's a JFrame, with SwingUtilities.invokeLater and an anonymous inner class, none of which I think is actually relevant to this question).
It compiles and runs under BlueJ, on both Mac and Windows. It compiles and runs from the command line on the Mac. It compiles from the command line on Windows, but when I try to run it, I get a NoClassDefFound exception on the main class.
Are there common reasons that this kind of thing would happen? (For example, spaces in a directory name on Windows?)
Joined: Aug 19, 2003
OK, this is much more basic than I thought. I thought the difficulty might have something to do with the constructor, the anonymous inner class, maybe the cases in the class name... so I reduced the program to
and I'm still having the problem: it compiles and runs fine under BlueJ, it compiles and runs fine on the Mac command line, it compiles but doesn't run on the Windows command line.
I hate Windows....I hate Windows....I hate Windows....I hate Windows....
Originally posted by Stephen Bloch: I hate Windows....I hate Windows....I hate Windows....I hate Windows....
This error has nothing to do with Windows, and if you would have set the environment variable CLASSPATH on the Mac, you would have gotten exactly the same error on the Mac... Java = Java, doesn't matter on which operating system you run it. [ June 19, 2006: Message edited by: Jesper Young ]