• 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

Very new beginner

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the very first program and when I try to run it using the complier, javac, it runs fine, but when I use the interperter, java I get the error "Exception in thread "main" java.lang.NoClassDefFound Error:hello.java.
What do I need to do to get this to run?
------------------
www.pamelaspleasures.com
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you run the interpreter from the command line, do not include the extension name, as in
java Hello
Should run the interpreter
 
pamchau
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried java hello and I still get the same error. Any more ideas?
Thank you,
Pamela
------------------
www.pamelaspleasures.com
 
Trailboss
Posts: 23778
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible that you don't have your classpath set?
Are you familiar with what the CLASSPATH is and what it is for?
 
pamchau
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I read in an earlier post that the CLASSPATH should be set to C:\JDK1.2\LIB. I have tried that and it does not make a difference. I do have a path set to C:\JDK1.2\BIN in my autoexec.bat.
------------------
www.pamelaspleasures.com
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My classpath is set to
<code>.;c:\jdk1.2</code>
for both compiling and executing. (I use the -classpath option, and use batch files to compile and execute.) That . part is very important - it says the JVM should look in the current directory as well as the standard library. That may well be your troouble here. Also you may not need the \LIB or \BIN parts - or if you do need them, include them in addition to a path without them:
<code>.;c:\jdk1.2;c:\jdk1.2\lib;c:\jdk1.2\bin</code>
(probably overkill, but I suppose it depends just how you've got everything set up.)
If that doesn't do it, compile using -g (debug) option and when you run you should get a slightly more complete error message - in particular, you'd like to know the exact line number it's choking on (evidently it's in the file hello.java). That may provide useful clues. Good luck.
 
pamchau
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I figured out what my problem was. I did add the lib path to my path statement, but it was nothing to do with the computer. It was what you call a SUT (Stupid User Trick). I was not paying any attention to my upper & lower case, and Hello is not the same as hello. I suppose DOS has spoiled me!
Thanks for all the help.
Pamela
------------------
www.pamelaspleasures.com
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic