将我的 Mac 更新到最新的 Java JDK 的困难 [英] Difficulties with updating my Mac to the latest Java JDK
问题描述
[2015-10-12 12:51]
<块引用>正在运行...
little-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
<块引用>
然后运行...
mlittle-mbook1:bin mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
<块引用>
我将 java_home 设置为:JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
我刚刚注意到 Apache Ant 正在寻找错误的路径,并附加了一个/"
并根据您的电子邮件
"Ant 将尝试使用 $JAVA_HOME/bin/java 文件.如果不存在,那么 > JAVA_HOME 不正确,就这么简单.例如,如果您的 java 可执行文件 > 位于/path/to/whatever/bin/java,那么 JAVA_HOME 应该是/path/to/whatever."
或者……$JAVA_HOME/bin/java
但错误消息表明它正在查找路径..
$JAVA_HOME//bin/java
<块引用>
注意//"而不是/":如何更正?
或者是否有一个ant"命令,我可以强制它在正确的路径中查找?
==================
[2015-10-12: 1204]
<块引用>谢谢,您为我解决了一个问题,我知道/java 是 $java_home/bin/java 路径中的可执行文件,而不是文件夹至于 $JAVA_HOME/bin/java -version,我得到了以下...
mlittle-mbook1:~ mlittle$/usr/libexec/java_home -vjava_home: 选项需要一个参数 -- v/库/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Homemlittle-mbook1:~ mlittle$ which java/usr/bin/java
<块引用>
现在重新运行 ant 以尝试构建 hybris 实例...
mlittle-mbook1:~ mlittle$ cd 00hybris/hybris/bin/platformmlittle-mbook1:platform mlittle$ pwd/Users/mlittle/00hybris/hybris/bin/platformmlittle-mbook1:platform mlittle$ ../setantenv.shmlittle-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
<块引用>
如您所见,尽管现在看起来正确的 $java_home 位置,我仍然遇到了 'ant' 问题.
========
========
[2015-10-11-23:20]进一步调查
mlittle-mbook1:Users mlittle$ cd/库/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Homemlittle-mbook1:Home mlittle$ pwd/库/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Homemlittle-mbook1:Home mlittle$ ls -a.README.html 数据库库.. THIRDPARTYLICENSEREADME-JAVAFX.txt 包含 manCOPYRIGHT THIRDPARTYLICENSEREADME.txt javafx-src.zip 发布许可证 bin jre src.zipmlittle-mbook1:Home mlittle$ cd binmlittle-mbook1:bin mlittle$ ls -a.jar javafxpackager jconsole jjs jsadebugd keytool rmic servertool xjc.. jarsigner javah jdb jmap jstack native2ascii rmid tnameservappletviewer java javap jdeps jmc jstat orbd rmiregistry unpack200extcheck javac javapackager jhat jps jstatd pack200 schemagen wsgenidlj javadoc jcmd jinfo jrunscript jvisualvm policytool serialver wsimportmlittle-mbook1:bin mlittle$ which java/usr/bin/javamlittle-mbook1:bin mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Homemlittle-mbook1:bin mlittle$ java -versionjava版本1.8.0_60"Java(TM) SE 运行时环境(构建 1.8.0_60-b27)Java HotSpot(TM) 64 位服务器 VM(构建 25.60-b23,混合模式)mlittle-mbook1:bin mlittle$
====
mlittle-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/javamlittle-mbook1:平台 mlittle$*
==初步调查
我的 MacBook 上的 Java 安装似乎有问题,因为这与基于 Java 的电子商务平台的安装有关 [ hybris 5.6.02 安装脚本的困难 ] 和 Apache Ant 的使用...
- 关于我的 MacBook..系统软件概述:
<块引用>
系统版本:OS X 10.10.5 (14F27)
内核版本:Darwin 14.5.0
启动卷:Macintosh HD
启动模式:正常
计算机名称:mlittle-mbook1
用户名:mlittle-mbook1(mlittle)
安全虚拟内存:已启用
自启动以来的时间:1 天 5:34
==========
1.检查哪个java…
mlittle-mbook1:~mlittle$ which java/usr/bin/java
2.重新检查哪个 Java..
mlittle-mbook1:~ mlittle$ ls -l `which java`lrwxr-xr-x 1 根轮 74 2014 年 11 月 5 日/usr/bin/java ->/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
<强>3.然后我在路径中下载了 JDK 版本 8、更新 60 等:
/Library/Java/Java?JavaVirtualMachines
以前它有..
<块引用>/jdk1.7.0_21.jdk
现在有了
<块引用>/jdk1.7.0_21.jdk
/jdk1.8.0_60.jdk
这令人困惑,我原以为它会替换/jdk1.7.0_21.jdk与/jdk1.8.0_60.jdk
4.我检查了java的版本..
mlittle-mbook1:~ mlittle$ java -versionjava版本1.7.0_21"mlittle-mbook1:~ mlittle$ java -versionjava版本1.7.0_21"Java(TM) SE 运行时环境(构建 1.7.0_21-b12)Java HotSpot(TM) 64 位服务器 VM(构建 23.21-b01,混合模式)
还是显示java版本1.7.0_21"???
所以我将/jdk1.7.0_21.jdk 重命名为/old-jdk1.7.0_21.jdk
4.我再次检查java的版本,然后我得到了……
mlittle-mbook1:~ mlittle$ java -versionjava版本1.8.0_60"Java(TM) SE 运行时环境(构建 1.8.0_60-b27)Java HotSpot(TM) 64 位服务器 VM(构建 25.60-b23,混合模式)
5.哪个应该是 Hybris5.6.0.2 的正确 Java 版本 [这是我尝试安装的基于 Java 的电子商务平台] 通过设置 ANT 环境变量,并开始构建过程 [ant clean all]...但是...强>
mlittle-mbook1:platform mlittle$ ../setantenv.sh
试图清理所有..并收到与 JAVA_HOME 相关的错误消息
mlittle-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
<强>6.再次检查java路径...
mlittle-mbook1:platform mlittle$ which java/usr/bin/java
7.我尝试更改 Java_home 路径,然后重新运行 ANT..
mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/Homemlittle-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/Home/bin/java
<强>8.再次检查哪个Java"
mlittle-mbook1:platform mlittle$ which java/usr/bin/javamlittle-mbook1:platform mlittle$ $JAVA_HOME/bin/java -version-bash:/Library/Java/Home/bin/java: 没有那个文件或目录
9.我尝试更改Java_home,重新运行Ant,但仍然收到错误消息..
mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/mlittle-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/JavaVirtualMachines//bin/java
10.9.我尝试更改Java_home,重新运行Ant,但仍然收到错误消息..
mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/binmlittle-mbook1:platform mlittle$ ant clean all错误:JAVA_HOME 定义不正确.我们无法执行/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/bin/java
<强> 11.再次检查哪个java
mlittle-mbook1:platform mlittle$ which java/usr/bin/java
我很困惑,显然我没有正确设置我的 java set home 变量:有什么建议吗?
看起来应该是正确的:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
Ant 将尝试使用文件 $JAVA_HOME/bin/java
.如果不存在,则 JAVA_HOME
不正确,就这么简单.例如,如果您的 java
可执行文件位于 /path/to/whatever/bin/java
,那么 JAVA_HOME
应该是 /path/到/随便
.
[2015-10-12 12:51]
Running...
little-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
And running...
mlittle-mbook1:bin mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
I set java_home to: JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
I have just noticed that Apache Ant is looking in the wrong path, with an additional ‘/'
And according to your email
" Ant will try to use the file $JAVA_HOME/bin/java. If that doesn't exist, then > JAVA_HOME is not correct, it's that simple. If for example your java executable > is at /path/to/whatever/bin/java, then JAVA_HOME should be /path/to/whatever."
or… $JAVA_HOME/bin/java
but the error message indicates that it is looking in the path..
$JAVA_HOME//bin/java
Notice the ‘//‘ instead of ‘/‘: how to correct this?
Or is there an ‘ant’ command, where I can force it to look in the correct path?
=================
[2015-10-12: 1204]
Thank you, you have resolved one issue for me, I understand that /java is an executable in the path $java_home/bin/java, not a folder As for $JAVA_HOME/bin/java -version, I got the following...
mlittle-mbook1:~ mlittle$ /usr/libexec/java_home -v
java_home: option requires an argument -- v
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
mlittle-mbook1:~ mlittle$ which java
/usr/bin/java
Now re-running ant to attempt to build the hybris instance...
mlittle-mbook1:~ mlittle$ cd 00hybris/hybris/bin/platform
mlittle-mbook1:platform mlittle$ pwd
/Users/mlittle/00hybris/hybris/bin/platform
mlittle-mbook1:platform mlittle$ . ./setantenv.sh
mlittle-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
As you can see, I am still having problems with 'ant' despite having what now appears the correct $java_home location.
=======
=======
[2015-10-11-23:20] FURTHER INVESTIGATION
mlittle-mbook1:Users mlittle$ cd
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
mlittle-mbook1:Home mlittle$ pwd
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
mlittle-mbook1:Home mlittle$ ls -a
. README.html db lib
.. THIRDPARTYLICENSEREADME-JAVAFX.txt include man
COPYRIGHT THIRDPARTYLICENSEREADME.txt javafx-src.zip release
LICENSE bin jre src.zip
mlittle-mbook1:Home mlittle$ cd bin
mlittle-mbook1:bin mlittle$ ls -a
. jar javafxpackager jconsole jjs jsadebugd keytool rmic servertool xjc
.. jarsigner javah jdb jmap jstack native2ascii rmid tnameserv
appletviewer java javap jdeps jmc jstat orbd rmiregistry unpack200
extcheck javac javapackager jhat jps jstatd pack200 schemagen wsgen
idlj javadoc jcmd jinfo jrunscript jvisualvm policytool serialver wsimport
mlittle-mbook1:bin mlittle$ which java
/usr/bin/java
mlittle-mbook1:bin mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
mlittle-mbook1:bin mlittle$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
mlittle-mbook1:bin mlittle$
====
mlittle-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
mlittle-mbook1:platform mlittle$*
== INITIAL INVESTIGATION
I seem to have a problem with my Java installation on my MacBook, as this relates to the installation of a java based eCommerce platform [ Difficulties with installation script for hybris 5.6.02 ] and the use of Apache Ant...
- Regarding my MacBook.. System Software Overview:
System Version: OS X 10.10.5 (14F27)
Kernel Version: Darwin 14.5.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: mlittle-mbook1
User Name: mlittle-mbook1 (mlittle)
Secure Virtual Memory: Enabled
Time since boot: 1 day5:34
=========
1. Checked which java…
mlittle-mbook1:~ mlittle$ which java
/usr/bin/java
2. Recheck which Java..
mlittle-mbook1:~ mlittle$ ls -l `which java`
lrwxr-xr-x 1 root wheel 74 5 Nov 2014 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
3. I then downloaded the JDK version 8, update 60, and so in the path:
/Library/Java/Java?JavaVirtualMachines
Previously it had..
/jdk1.7.0_21.jdk
Now It has
/jdk1.7.0_21.jdk
/jdk1.8.0_60.jdk
This is confusing, I was expecting that it would replace /jdk1.7.0_21.jdk with /jdk1.8.0_60.jdk
4. I check the version of java..
mlittle-mbook1:~ mlittle$ java -version
java version "1.7.0_21"
mlittle-mbook1:~ mlittle$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)
It was still indicating java version "1.7.0_21"???
And so I renamed /jdk1.7.0_21.jdk to /old-jdk1.7.0_21.jdk
4. I again check the version of java, and then I got…
mlittle-mbook1:~ mlittle$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
5. Which should be the correct version of Java for Hybris5.6.0.2 [this the java based eCommerce platform that I am trying to install] by setting the ANT environment variables, and commence the build process [ant clean all]… but…
mlittle-mbook1:platform mlittle$ . ./setantenv.sh
Tried to ant clean all.. and got an error message relating to JAVA_HOME
mlittle-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home//bin/java
6. Again checked the java path…
mlittle-mbook1:platform mlittle$ which java
/usr/bin/java
7. I tried to change the Java_home path and then re-run ANT..
mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/Home
mlittle-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/Home/bin/java
8. Again checked "which Java"
mlittle-mbook1:platform mlittle$ which java
/usr/bin/java
mlittle-mbook1:platform mlittle$ $JAVA_HOME/bin/java -version
-bash: /Library/Java/Home/bin/java: No such file or directory
9.I tried to change the Java_home, reran Ant, but still got an error message..
mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/
mlittle-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines//bin/java
10. 9.I tried to change the Java_home, reran Ant, but still got an error message..
mlittle-mbook1:platform mlittle$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin
mlittle-mbook1:platform mlittle$ ant clean all
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/bin/java
11. Again checked which java
mlittle-mbook1:platform mlittle$ which java
/usr/bin/java
I am confused, clearly I do not have my java set home variables set up properly: any suggestions?
Looks like this should be the correct one:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
Ant will try to use the file $JAVA_HOME/bin/java
. If that doesn't exist, then JAVA_HOME
is not correct, it's that simple.
If for example your java
executable is at /path/to/whatever/bin/java
, then JAVA_HOME
should be /path/to/whatever
.
这篇关于将我的 Mac 更新到最新的 Java JDK 的困难的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!