如何在Windows 7命令行上执行.jar java程序? [英] How do I execute .jar java program on Windows 7 command line?
问题描述
我一直在网上找东西,到目前为止找不到一个好的答案。我想执行YUI压缩工具模糊/缩小我的javascript文件。我已安装JRE。
I have been looking things up online and could not find a good answer so far. I want to execute the YUI compressor tool to obfuscate/minify my javascript file. I do have JRE installed.
它看起来像文件关联很好,你可以看到这里:
It looks like the file association is fine as you can see here:
C:\directory\tempFiles>assoc .jar
.jar=jarfile
我使用ftype设置文件关联:
I set up file association using ftype:
C:\directory\tempFiles>ftype jarfile
jarfile="C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -jar "%1" %*
压缩工具保存为.jar文件,名为yuicompressor-2.4.6.jar
The compressor tool is saved as a .jar file and is called "yuicompressor-2.4.6.jar"
当我尝试运行.jar文件时,cmd一直说java字不被识别为内部命令...这是我如何运行它:
When I try to run the .jar file, the cmd kept saying that the word 'java' is not recognized as an internal command... this is how I run it:
C:\directory\tempFiles\yuicompressor-2.4.6\build>java -jar yuicompressor-2.4.6.jar [options] [input file]
任何帮助将不胜感激
推荐答案
将JDK / JRE bin文件夹路径添加到PATH。请参见此处。
Add the JDK / JRE bin folder path to your PATH. See here.
这篇关于如何在Windows 7命令行上执行.jar java程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!