This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am trying to run a java program on a Windows XP computer without the JDK. I keep getting an error. This is what I'm typing: jview -cp . myProgram I keep getting the error java.lang.NoClassDefFoundError. It's not even running a simple System.out.println("foo") from the first line of the main method. Can anyone tell me what I'm doing wrong? Angel [ October 21, 2003: Message edited by: Angel Dobbs-Sciortino ]
Microsoft's JVM implements the API defined by a fairly old JDK (1.1.5, I think.) If your program uses anything introduced later than that (and that includes a lot of stuff: Collections, Swing, and lots more) then you'll see this error. [ October 21, 2003: Message edited by: Ernest Friedman-Hill ]
Well, no, they ought to be OK. I went over to my wife's XP box and tried this with "Hello, World" and, lo and behold, I got the same error! Now, I'm interested. So I did a little Googling, and came up with this link. The upshot of this is that jview reports NoClassDefFoundError if the class file's version number is later than it expects. Since it's so old, it expects quite an old version number, older than any current JDK uses. To produce class files that jview can handle from a modern JDK, you have to give the "-target 1.1" switch to javac when you compile them: javac -target 1.1 myProgram.java I tried this and it indeed works. Interesting question! [ October 21, 2003: Message edited by: Ernest Friedman-Hill ]