• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

please help! classpath not working

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
1
Netscape Opera Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ".;"
then
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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic