已安装Java 7,但终端仍为Java 6 [英] Installed Java 7, but interminal still Java 6
问题描述
我已经在Mac(10.7.5)上安装了Java 7,但是在终端中仍然有Java 6.
java版本"1.6.0_37";Java(TM)SE运行时环境(内部版本1.6.0_37-b06-434-11M3909)Java HotSpot(TM)64位服务器VM(内部版本20.12-b01-434,混合模式)
如果我在尝试安装Java应用程序时总是遇到该错误,则终端上的版本6不会有问题( LatexDraw ):
:CGContextGetCTM:无效的上下文0x0
:CGContextSetBaseCTM:无效的上下文0x0
:CGContextGetCTM:无效的上下文0x0
:CGContextSetBaseCTM:无效的上下文0x0
该问题与从 此链接推断的 java 6 的不稳定性有关>
我已阅读,但是在我的文件夹/System/Library/Frameworks/JavaVM.framework/Versions
中,版本1.7,仅1.6版以下的版本???那么,如何解决此问题?
您可以通过以下方式解决:
-
以这种方式获取已安装的Java 7 JRE的路径:
/usr/libexec/java_home -v 1.7
-
将上一个命令的输出设置为
JAVA_HOME
variale(例如,在我的情况下):export JAVA_HOME =/库/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
看看这篇文章以获取更多信息...
I've installed Java 7 on my Mac (10.7.5), but in the terminal there is still java 6.
java version "1.6.0_37" Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909) Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
There will be no problem with the version 6 on terminal, if I always got that errors when I tried to install a java application (LatexDraw):
: CGContextGetCTM: invalid context 0x0
: CGContextSetBaseCTM: invalid context 0x0
: CGContextGetCTM: invalid context 0x0
: CGContextSetBaseCTM: invalid context 0x0
The problem is related to instability of java 6 inferred from this link
I've read this installed-java-7-on-mac-osx-but-terminal-is-still-using-version-6 and also try to change my Java version by using export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home"
, but in my folder /System/Library/Frameworks/JavaVM.framework/Versions
, there is no version 1.7, only versions under 1.6 ??? So, how can I fix this issue?
You can solve in this way :
Get the path of your installed Java 7 JRE in this way :
/usr/libexec/java_home -v 1.7
Set the output of the previous command as
JAVA_HOME
variale(for example in my case) :export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home
Take a look at this post for more information ...
这篇关于已安装Java 7,但终端仍为Java 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!