Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

program assignments won't run anymore

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to compile and run my java assignments. I made some changes to my machine. Now I can compile but I am getting a error message when I run my past assignments.
Working on a XP machine
error message = C:\java>java Hundred gertrude
Exception in thread "main" java.lang.NoClassDefFoundError: Hundred
CLASSPATH = C:\Program Files\Altova\xmlspy\XMLSpyInterface.jar;C:\Program Files\Altova\AUTHENTIC\XMLSpyInterface.jar (I didn't do this)
Path = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\j2sdk1.4.1_01\bin;C:\jwsdp-1.1\bin;C:\jwsdp-1.1\jakarta-ant-1.5.1\bin;C:\mysql\bin
I won't be using the jwsdp - so I can delete it but not sure if this is the problem
Thanks
 
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You must point to your lib directory in you classpath. In your case most likely C:\j2sdk1.4.1_01\lib
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Johannes, Thanks for your reply. I tried what you suggested (think I did anyway) and it is still not working. Following is all what I have.
user variables
ANT_HOME C:\jwsdp-1.1\jakarta-ant-1.5.1\
CLASSPATH C:\j2sdk1.4.1_01\lib (took out the xmlspy stuff -rebooted)
JAVA_HOME C:\j2sdk1.4.1_01
PATH C:\jwsdp-1.1\jwsdp-shared\bin
System variables
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adaptec Shared\System;C:\j2sdk1.4.1_01\bin;C:\jwsdp-1.1\bin;C:\jwsdp-1.1\jakarta-ant-1.5.1\bin;C:\mysql\bin
Thanks
 
Johannes de Jong
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ooops turns out that pointing to the lib has no affect after all
I removed it from my path environment variable and my java classes still run when I run them from the dos prompt. My applogies its been awhile since I ran anythyhting from the dos promp I normally run my stuff directly from within WSAD and/or Eclipse.
I played around a bit and it turns out that when I enter java -version it picks up version 1.4.1_02 (my runtime version). I cant find a reference to it's location, anywhere in my environment variables in XP. So I assume its somewhere in the registry.
I suggest you re-install the Java Runtime but hey check with some of boff's around here. I already have egg on my face.
[ August 05, 2003: Message edited by: Johannes de Jong ]
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Johannes,
Thanks for your reply, I think it has to do with the jwsdp that was added after I had been set up.
I am in the process of setting up eclipse, (it is set up - now just getting familiar) but if, in an assignment I have to enter something from the command line, this can't be done in eclipse can it?
mm
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
first of all you can also pass arguments via eclipse. You can set it when you configure run, there is one line with the arguments you want to pass.
The other thing is try to add '.' to your classpath. Then it should work.
 
Johannes de Jong
tumbleweed
Posts: 5089
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes one can
In Eclipse select run then the (x) = Arguments tab en simply fill in the arguments in the Program arguments block.
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that you are asking two different questions here. One is how to get your programs to compile and run using a DOS prompt and the other is how to get your programs to compile and run using Eclipese.

To get your programs to compile and run in a DOS prompt you can follow the instructions on the CattleDrive intro page. These instructions are just as valid with WinXP as they are with Win9x. It appears that MS overwrote at least your classpath (and maybe your path) when you installed it.

Your path needs to include the subdirectory that contains javac.exe (usually jdk_home\bin), and your classpath needs to point to the subdirectory where your compiled classes are. If you follow the directions on the page I mentioned, they will be in C:\Java, so C:\Java needs to be in your classpath. (jdk_home)\jre\lib\est can sometimes be used for *.jar files, but that is beyond our current subject under discussion.

I have no experience with Eclipse, but most IDEs require you to set your sourcepath and your classpath (again) within the browser. For more help with setting up Eclipse, you might want to pop over to the "IDEs and other Tools" forum.
 
mary morris
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone for you replys. I now am able to once agian get my programs to compile and run using a DOS prompt. I will try from eclipse now an if it doesn't work will then try in the eclipse IDE forum.
mm
 
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Though my classpath is ok I very often am forced to use
java -classpath . pathtoyourapplication.application.class
(though my classpath contains ".;" and I do not now that changing behaviour)
Greeting Peter
 
reply
    Bookmark Topic Watch Topic
  • New Topic