views:

468

answers:

2

I have download jasmin.jar from http://sourceforge.net/project/showfiles.php?group_id=100746

I have changed my CLASSPATH to the following:

echo %CLASSPATH%
C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Sun\SDK\lib;C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar;

The following command works without a problem:

java -jar C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar -g Greeter.j

But the following does not works:

java Jasmin -g Greeter.j

I am wondering as to what am I doing wrong and how to fix it, so I can easily run the Jasmin from the command line and convert jasmin code to .class.

I did not find any useful information at: http://jasmin.sourceforge.net/guide.html Which says the following:

The jasmin.jar file is an executable JAR file that runs Jasmin. For example:

java -jar jasmin.jar myfile.j

or

java Jasmin myfile.j

(if jasmin.jar is already in your classpath)

A: 

It turns out jasmin.jar is NOT in your classpath.

the -jar option tell the interpreter to execute the Main class that is in the specified jar file ( which it is Jasmin )

In the second, you're telling, execute the class called "Jasmin" with this args, but the intepreter ( java.exe ) does not know where that file is.

You could do the following:

1) Set jasmin.jar in your classpath in windows in environment variable CLASSPATH ( you mentiond that is already there, but didn't mention HOW did you put it ) probably is was through a command prompt windows and tried to use it in other?

2) Specify the classpath from the command line

 java -classpath C:\a\b\c\jasmin.jar Jasmin -g Greejer.j

That should work.

Sometimes I have had problems with the empty spaces in the classpath for instance

C:\Progrma Files....;C:\My\Jar.jar

And didn't work. How are you setting your CLASSPATH env var?

OscarRyz
I setted the classpath by clicking on the "Environment Variable" button in System. Then I manually edited the variable. I added the jasmin.jar location at the end of VALUE of CLASSPATH.
Mh strange, have you tried the 2nd option I mention? Using -classpath modifier?
OscarRyz
A: 

Change your classpath from

C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Sun\SDK\lib;C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar;

to

"C:\Program Files\Java\jre6\lib\ext\QTJava.zip";C:\Sun\SDK\lib;C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar;

Essentially, put quotes around any paths which have spaces in them.

talonx
I tried that and it still does not works.