wood burning stoves 2.0*
The moose likes Cattle Drive and the fly likes program assignments won't run anymore Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "program assignments won Watch "program assignments won New topic
Author

program assignments won't run anymore

mary morris
Ranch Hand

Joined: Mar 16, 2002
Posts: 97
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
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
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

Joined: Mar 16, 2002
Posts: 97
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
Bartender

Joined: Jan 27, 2001
Posts: 5089
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

Joined: Mar 16, 2002
Posts: 97
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
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
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
Bartender

Joined: Jan 27, 2001
Posts: 5089
Yes one can
In Eclipse select run then the (x) = Arguments tab en simply fill in the arguments in the Program arguments block.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
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.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
mary morris
Ranch Hand

Joined: Mar 16, 2002
Posts: 97
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
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: program assignments won't run anymore
 
Similar Threads
bartender, I have got the same problem as Sri Addanki for the error of noClassDefFoun
how do I find out what version?
Frustrating compilation "Cannot resolve symbol" error
NoClassDefException in 1.4
Basic help