wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Problem setting enviromental variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem setting enviromental variables" Watch "Problem setting enviromental variables" New topic
Author

Problem setting enviromental variables

Rob Petterson
Ranch Hand

Joined: Jan 23, 2002
Posts: 149
For the life of me (and I have spent hours and hours on this) I can't work out where I'm going wrong.
I can't get ANY java program running in the DOS promp anymore. They compile OK but won't run.
The error message I'm now getting is:
Exception in thread "main" java.lang.NoClassDefFoundError

These are all the settings I'm using:

CATALINA_HOME
C:\jakarta-tomcat-4.1.12-LE-jdk14\jakarta-tomcat-4.1.12-LE-jdk14

CLASSPATH
C:\jakarta-tomcat-4.1.12-LE-jdk14\jakarta-tomcat-4.1.12-LE-jdk14\common\lib\servlet.jar;C:\jakarta-tomcat-4.1.12-LE-jdk14\jakarta-tomcat-4.1.12-LE-jdk14\common\lib\mysql-connector-java-2.0.14

JAVA_HOME
c:\j2sdk1.4.0_02

PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\j2sdk1.4.0_02\bin;C:\j2re1.4.0_02\jre\bin

-----------------------------------------

j2sdk1.4.0_02 is located in:
C:\j2sdk1.4.0_02

jakarta-tomcat-4.1.12-LE-jdk14 is located in:
C:\jakarta-tomcat-4.1.12-LE-jdk14\jakarta-tomcat-4.1.12-LE-jdk14

mysql is located in:
C:\mysql

mysql-connector-java-2.0.14 is located in:
C:\jakarta-tomcat-4.1.12-LE-jdk14\jakarta-tomcat-4.1.12-LE-jdk14\common\lib\mysql-connector-java-2.0.14

Any ideas??


Rob Petterson
SCJP
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
How about adding ;. (semicolon period) to the CLASSPATH? That should enable you to execute a class residing in your current working directory.


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Rob Petterson
Ranch Hand

Joined: Jan 23, 2002
Posts: 149
I tried adding ;.
But still getting the same result
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
My approach now would be to "simplify the world" and go back to no CLASSPATH, and setting PATH to C:\j2sdk1.4.0_02\bin;%SystemRoot%\system32;
%SystemRoot%;%SystemRoot%\System32\Wbem
And then getting a simple java program to run.
Rob Petterson
Ranch Hand

Joined: Jan 23, 2002
Posts: 149
I've deleted the CLASSPATH variable and have set PATH to:
C:\j2sdk1.4.0_02\bin;%SystemRoot%\system32;
%SystemRoot%;%SystemRoot%\System32\Wbem
I'm still getting the same error.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Are you closing and re-opening the DOS command window when you change the settings?
What do you get when you type java -version at the DOS prompt?
Also try java -verbose when you run the test program.
And java -cp . TestClass (that's a period)
I'm sure we are going to learn something profound by solving this one
Rob Petterson
Ranch Hand

Joined: Jan 23, 2002
Posts: 149
OK Barry,
We're getting there. I closed and re-opened the DOS window and compiled and ran a program fine.
Thanks for that.
That sorts part of the puzzle out. However, (and there's always a however!)I need to get the CLASSPATH set up as well.
Any ideas?
Rob Petterson
Ranch Hand

Joined: Jan 23, 2002
Posts: 149
Hold your horses. I put the CLASSPATH variable back in. I opened a NEW DOS window and it runs the program now.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Being a bear of little brain , I now let things take their normal course...
-Barry
Rob Petterson
Ranch Hand

Joined: Jan 23, 2002
Posts: 149
Thanks for all your help, Barry
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem setting enviromental variables
 
Similar Threads
problem running Tomcat
could not locate driver
Javac error...
could not locate driver
Tomcat JSP Example link dosn't work