• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JView

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only objects my program uses are String, StringTokenizer, PrintWriter, BufferedReader, FileReader, and FileWriter. I don't think any of these came after JDK 1.1.
Angel
[ October 21, 2003: Message edited by: Angel Dobbs-Sciortino ]
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That worked for me too. Thanks a lot!
Angel
 
reply
    Bookmark Topic Watch Topic
  • New Topic