aspose file tools*
The moose likes Beginning Java and the fly likes please help! classpath not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help! classpath not working" Watch "please help! classpath not working" New topic

please help! classpath not working

Ayanik Sil

Joined: Sep 23, 2007
Posts: 27
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?
Red Smith
Ranch Hand

Joined: Aug 05, 2007
Posts: 136
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

Joined: Sep 23, 2007
Posts: 27
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!
jQuery in Action, 2nd edition
subject: please help! classpath not working