• 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

j2sdk 1.4 and windows XP

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm using windows XP and j2sdk 1.4. when I compile the program the class file is created but when I run it NoClassDefFoundError is thrown!!! can anyone help me??? Which operational system do you think is better and reliable to use for certification porpuse???
Thanks in advance!!!
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even I had this problem. I got a work around that I have to run the autoexec.bat file every time I open a new DOS window (from the current working directory)for it to recognise the class path properly. Because of this problem, I cannot use any other editors to run the Java program.
It will be really helpful if some body could suggest some other way.
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by leandro oliveira:
I'm using windows XP and j2sdk 1.4. when I compile the program the class file is created but when I run it NoClassDefFoundError is thrown!!! can anyone help me??? Which operational system do you think is better and reliable to use for certification porpuse???
Thanks in advance!!!


It sounds like your system can find the java.exe file (which it needs to run any Java application), but it can't find the file you're trying to run. Ensure that your class file can be found on the classpath - you can edit your classpath by going to "My Computer Properties"->Advanced Tab->Environment Variables Button.
Inside that window, ensure that your classpath is set to include the directory where your .class file resides (or, if your class is within a package other than the default package, the root of that hierarchy).
Just on a side note, I'm currently running Java 1.4 on Windows XP and have no problems, so there is not an issue with Java on that platform.
Corey
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Even i faced a similar problem , I created a class named Test.java and I tried to execute the class file by using 'java test' and this gave me java.lang.NoClassDefFoundError: test (wrong name: Test>. And solved this by using 'java Test'.
I am using Windows XP and java 1.4.1 sdk
Regards
Ravi
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Corey says, the problem can occur if your classpath has not been set correctly. The sun website provides a guideline on how to set the path and classpath for each version of Windows (since it differs from one version to the next). Follow the link below:
web page

[ May 05, 2003: Message edited by: Rory French ]
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it looks like it works now!!! I set classpath to point to a folder named 'packages', every java program I write under this folder compiles and runs. But if I have any other program writen in any other place, NoClassDefFoundError is thrown while attempting to run (everything compiles without problems). Is this normal?
 
Rory French
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, that is normal.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by leandro oliveira:
Is this normal?


Your system will only look for the classes to execute in the locations that you define in your classpath. If you create some class files and place them somewhere that is not in the classpath, your system won't know where to find them and, hence, you'll get the ClassNotFound error. To fix the problem, simply add the new location to your classpath.
Corey
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your SDK installation, under the docs directory there is a tooldocs directory having the findingclasses.html file - this explains how Java finds classes and is well worth reading.
Bill
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All along I thought java users were not happy using Windows.Is the situation now changed?
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic