• 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

Problem setting enviromental variables

 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about adding ;. (semicolon period) to the CLASSPATH? That should enable you to execute a class residing in your current working directory.
 
Rob Petterson
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried adding ;.
But still getting the same result
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Being a bear of little brain , I now let things take their normal course...
-Barry
 
Rob Petterson
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all your help, Barry
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic