Jasmin 在 CLASSPATH 中
我已经从 http://sourceforge.net/project/showfiles.php 下载 jasmin.jar ?group_id=100746
我已将 CLASSPATH 更改为以下内容:
echo %CLASSPATH%
C:\Program Files\Java\jre6\lib\ext\QTJava.zip;C:\Sun\SDK\lib;C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar;
以下命令可以正常工作:
java -jar C:\Sun\SDK\jdk\lib\jasmin\jasmin.jar -g Greeter.j
但以下命令不起作用:
java Jasmin -g Greeter.j
我想知道我做错了什么以及如何修复它,所以我可以轻松地从命令行运行 Jasmin 并将 jasmin 代码转换为 .class。
我在以下位置没有找到任何有用的信息: http://jasmin.sourceforge.net/guide.html 其中说:
jasmin.jar 文件是可执行文件 运行 Jasmin 的 JAR 文件。 为了 示例:
java -jar jasmin.jar myfile.j
或
java Jasmin myfile.j
(如果 jasmin.jar 已在您的 类路径)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不确定自该文档编写以来主类是否已更改,但我只是查找了实际的主类是什么。
如果您检查 jar 文件的清单,您可以看到主类实际上是 jasmin.Main
如果您的 CLASSPATH 中有该 jar 文件,您应该能够执行以下操作:
java jasmin.Main -g Greeter。 j
I'm not sure if perhaps the main class has been changed since that document was written, but I just looked up what the actual main class is.
If you check the manifest of the jar file, you can see that the main class is actually jasmin.Main
If you have the jar file in your CLASSPATH, you should be able to just do the following:
java jasmin.Main -g Greeter.j
事实证明 jasmin.jar 不在您的类路径中。
-jar 选项告诉解释器执行指定 jar 文件中的 Main 类(即 Jasmin )。
在第二个选项中,您告诉解释器使用此参数执行名为“Jasmin”的类,但解释器( java .exe )不知道该文件在哪里。
您可以执行以下操作:
1)在环境变量 CLASSPATH 中的 Windows 中的类路径中设置 jasmin.jar (您提到它已经存在,但没有提到您是如何放置它的)可能是通过命令提示符 Windows 并尝试过在其他方面使用它?
2)从命令行指定
应该有效的类路径。
有时我在类路径中的空白处遇到问题,例如
C:\Progrma Files....;C:\My\Jar.jar
并且不起作用。 你如何设置你的 CLASSPATH 环境变量?
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
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?
将您的类路径从 更改
为
本质上,请在任何包含空格的路径周围加上引号。
Change your classpath from
to
Essentially, put quotes around any paths which have spaces in them.
只需调用
jasmin.jar yourFile.j
just call
jasmin.jar yourFile.j