问题
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?
回答1:
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 ...
来源:https://stackoverflow.com/questions/13668069/installed-java-7-but-interminal-still-java-6