File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes CLASSPATH in .bat file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "CLASSPATH in .bat file" Watch "CLASSPATH in .bat file" New topic

CLASSPATH in .bat file

Prabha Dhandapani
Ranch Hand

Joined: Sep 11, 2003
Posts: 70
Hello everybody,
I have a .bat file as follows

When I run this bat file it says that the class cannot be found...I have to do this today...Any help ASAP is appreciated
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
This might work better:

You have to put Windows/Dos system variables in %
Having said that, I would NOT recommend doing it this way.
I would just do
java ThreadCall -classpath C:\TestPrograms\all.jar
or better yet, make the .jar executable and use
java -jar C:\TestPrograms\all.jar

My Java Freeware:<br />MACCC - <a href="" target="_blank" rel="nofollow"></a><br />Nator - <a href="" target="_blank" rel="nofollow"></a>
Prabha Dhandapani
Ranch Hand

Joined: Sep 11, 2003
Posts: 70
Thanks Brian!I put it this way but it still doesnt work...Is there anything that I need to setup in the environent variables by going to the control panel???
C:\>java ThreadCall -classpath C:\TestPrograms
Exception in thread "main" java.lang.NoClassDefFoundError: ThreadCall
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

This way '-classpath ..' is interpreted as parameter for the 'ThreadCall'.
You have to arrange it the other way round:

Now it's an parameter for the jvm.
I agree. Here's the link:
subject: CLASSPATH in .bat file
It's not a secret anymore!