Java 开发工具包中的 jar.exe 在哪里?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18769332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where is jar.exe in Java Development Kit?
提问by Andrius
I downloaded and installed JDK from Java SE Development Kit 7 Downloadsin "c:\jdk.1.7.0", set variable path to "c:\jdk.1.7.0", but using command for example:
我从 “c:\jdk.1.7.0”中的Java SE Development Kit 7 Downloads下载并安装了 JDK ,将变量路径设置为“c:\jdk.1.7.0”,但使用命令例如:
jar xvf ..\src.zip
Gives me this error:
给我这个错误:
'jar' is not recognized as an internal or external command,
operable program or batch file.
I'm reading Core Java volume 1 (9th edition). So here it stated to run firstly command:
我正在阅读 Core Java 第 1 卷(第 9 版)。所以在这里它声明首先运行命令:
javac -version
Then I got that same error. And in bin directory there were no javac.exe too, but I found java.exe and it worked. So does jar.exe is also changed to some another name or it somewhere else? It seems strange that this book is released this year and even names of files do not match in newest version or am I missing something here?..
然后我得到了同样的错误。在 bin 目录中也没有 javac.exe,但我找到了 java.exe 并且它工作正常。那么 jar.exe 是否也更改为其他名称或其他名称?这本书是今年发布的,甚至文件名与最新版本都不匹配,这似乎很奇怪,还是我在这里遗漏了什么?..
P.S. I'm using windows 7 64 bit.
PS我使用的是Windows 7 64位。
using command:
使用命令:
echo %PATH%
echo %PATH%
retuns:
返回:
%JAVA_HOME%\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%CommonPr
ogramFiles%\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Wind
ows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\I
ntel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Fi
les (x86)\Intel\OpenCL SDK.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK
.0\bin\x64;C:\Program Files\Microsoft SQL Server0\Tools\Binn\;C:\Program File
s\Common Files\Microsoft Shared\Windows Live;C:\Program Files\Intel\WiFi\bin\;C:
\Program Files\Common Files\Intel\WirelessCommon\
%JAVA_HOME%
is set to C:\jdk1.7.0
%JAVA_HOME%
被设定为 C:\jdk1.7.0
采纳答案by Kevin Panko
I just installed that same downloadon Windows 7 64-bit and I have C:\Program Files\Java\jdk1.7.0_40\bin\jar.exe
so you probably do also.
我刚刚在 64 位 Windows 7 上安装了相同的下载,C:\Program Files\Java\jdk1.7.0_40\bin\jar.exe
所以你可能也这样做了。
I did notice you installed to a non-standard location, and that the installer gives you two chances to change where it installs.
我确实注意到您安装到了非标准位置,并且安装程序为您提供了两次更改安装位置的机会。
The first installer window is installing the JDK. Then a second window comes up and that installs the JRE.
第一个安装程序窗口正在安装 JDK。然后出现第二个窗口并安装 JRE。
You probably installed the JDK to one place and the JRE to another place. The JDK will have jar.exe
, javac.exe
, and java.exe
inside its bin
folder. The JRE will only have java.exe
there.
您可能将 JDK 安装到一个地方,将 JRE 安装到另一个地方。JDK 将在其文件夹中包含jar.exe
、javac.exe
和。JRE 只会在那里。java.exe
bin
java.exe
Therefore you should find where you installed the JDK. The default place is C:\Program Files\Java\jdk1.7.0_40
so it is there unless you changed it.
因此,您应该找到安装 JDK 的位置。默认位置是C:\Program Files\Java\jdk1.7.0_40
这样的,除非你改变它。
回答by Quillion
It is located in the bin folder.
You should link to c:\jdk.1.7.0\bin
它位于 bin 文件夹中。你应该链接到c:\jdk.1.7.0\bin
回答by Ken
It sounds like you have the JRE not the JDK. Check that you installed the right one, then check that you are looking in the right directory on your pc. You should have both.
听起来您拥有 JRE 而不是 JDK。检查您是否安装了正确的目录,然后检查您是否在 PC 上的正确目录中查找。你应该两者都有。
Next note that the Path should also include the bin folder.
接下来请注意,路径还应包括 bin 文件夹。
回答by Luiggi Mendoza
Looks like you have to set the JAVA_HOME as part of the PATH variable in your Windows system environment. The steps to define the JAVA_HOME variable is here: How to set java_home on Windows 7?, the only changes for this would be using the c:\jdk.1.7.0
(the path of your JDK installation) instead of C:\Program Files\Java\jre6
.
看起来您必须在 Windows 系统环境中将 JAVA_HOME 设置为 PATH 变量的一部分。定义 JAVA_HOME 变量的步骤在这里:如何在 Windows 7 上设置 java_home?,对此的唯一更改是使用c:\jdk.1.7.0
(您的 JDK 安装路径)而不是C:\Program Files\Java\jre6
.
After doing this, edit the PATH variable to look like this
执行此操作后,将 PATH 变量编辑为如下所示
%JAVA_HOME%\bin; rest of your current PATH variable value
To verify if the changes were done correctly, open a cmd and write
要验证更改是否正确完成,请打开一个 cmd 并写入
javac -version
You should get the exact version. In my case:
你应该得到确切的版本。就我而言:
javac 1.7.0_40
And in bin directory there were no javac.exe too, but I found java.exe and it worked.
在 bin 目录中也没有 javac.exe,但我找到了 java.exe 并且它工作正常。
Seems that you haven't installed the JDK in the path you think. Look for the real JDK path installation and point the JAVA_HOME system environment variable value to that folder.
好像没有按照你想的路径安装JDK。寻找真正的JDK路径安装并将JAVA_HOME系统环境变量值指向那个文件夹。