• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

CLASS path settings

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote my first program and compiled it, but I can't set the class path for java.exe for some reason. I tried adding c:\jdk1.2.2\jre\lib\ to my autoexec.bat file and as -classpath c:\jdk1.2.2\jre\lib\ to the command to run java. I restarted each time, and every time I tried it I got the following error (also with no classpath set):
java.lang.NoClassDefFoundError: C:\My Documents\A201\HelloExample/java
Exception in thread "main"
Tool completed with exit code 1
I know the code is correct because I am using an example from my university's lesson page, and I double checked to make sure that the class name (HelloExample) is the same as the file name (HelloExample.java) What could be wrong? Thanks.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by daniel moss:
I wrote my first program and compiled it, but I can't set the class path for java.exe for some reason. I tried adding c:\jdk1.2.2\jre\lib\ to my autoexec.bat file and as -classpath c:\jdk1.2.2\jre\lib\ to the command to run java. I restarted each time, and every time I tried it I got the following error (also with no classpath set):
java.lang.NoClassDefFoundError: C:\My Documents\A201\HelloExample/java
Exception in thread "main"
Tool completed with exit code 1
I know the code is correct because I am using an example from my university's lesson page, and I double checked to make sure that the class name (HelloExample) is the same as the file name (HelloExample.java) What could be wrong? Thanks.


Your AutoExec.bat should look like this:
SET PATH=C:\jdk1.2.2\bin;
SET CLASSPATH=.;C:\javawork;
javawork is the subdirectory I put all my java programs in.
Be sure and put the period before the ;C in SET CLASSPATH. That is VERY important.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!