• 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

please help! classpath not working

Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,
my java programs are in a directory called "javaPrograms"
the directory structure is C\:>MyProjects\javaPrograms

I also have tomcat installed
hence the classpath is

.;"C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\commons-el.
jar";"C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\jasper-r
untime.jar";"C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\n
aming-factory-dbcp.jar";"C:\Program Files\Apache Software Foundation\Tomcat 5.5\
common\lib\jasper-compiler.jar";"C:\Program Files\Apache Software Foundation\Tom
cat 5.5\common\lib\jsp-api.jar";"C:\Program Files\Apache Software Foundation\Tom
cat 5.5\common\lib\naming-resources.jar";"C:\Program Files\Apache Software Found
ation\Tomcat 5.5\common\lib\jasper-compiler-jdt.jar";"C:\Program Files\Apache So
ftware Foundation\Tomcat 5.5\common\lib\naming-factory.jar";"C:\Program Files\Ap
ache Software Foundation\Tomcat 5.5\common\lib\servlet-api.jar";"C:\MyProjects";

Now suppose i want to a java program from C:\>,then what to do?
Ranch Hand
Posts: 136
Netscape Opera Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your class is in an unnamed package (no package statement), then the classpath needs to contain the directory that contains the class. If that is your circumstance, then your CLASSPATH needs to have an entry for javaPrograms-> C:\MyProjects\javaPrograms

Based on what you had in your other post, C:\ should be in your class path and the package name MyProjects\javaPrograms prepended to the Class name when you go to execute it.
[ September 23, 2007: Message edited by: Red Smith ]
Ayanik Sil
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankx for the suggestion buddy!!
I have a package name as the first statement of the class.
the problem vanished,when I removed the period from my classpath.
earlier,my classpath started with ".;"
from C:\> when i gave the command
java -ea MyPackage.javaPrograms.Assertions ,then program ran!
earlier,this command was not working as the period (as i learnt from the posts in the forum)makes the classloader search the class in the current directory.
Thanks buddy,
thanks again!
He's giving us the slip! Quick! Grab this tiny ad!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!