Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

macos - Mac OS X 10.6.7 Java Path Current JDK confusing

I have trouble understanding (actual paths vs links) for multiple java versions on my Mac OSX. Normally in windows if I have multiple versions installed in my machine, I can just take the path of which ever version I want and use it. But in MAC OS X I undertand that there is something called links that is being pointed to CurrentJDK, and if I want to use a different version I will need to change the link to CurrentJdk right? But what is confusing for me is that as you can see below all my versions are pointing to the same CurrentJDK which means all versions point to current version? I was expecting only one of them would be pointing to CurrentJDK and I could just change it to which ever one I need which is not the case here. All I need to know is how to find the bin(Commands) folder path for each version, so that I can just use it to point to CurrentJDK? Also tell me how to change the link to CurrentJDK.

$ java -version

java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)

$ pwd

/System/Library/Frameworks/JavaVM.framework/Versions


$ ls -l

lrwxr-xr-x   1 root  wheel    5 Mar 20 11:12 1.3 -> 1.3.1
drwxr-xr-x   3 root  wheel  102 Dec  2  2009 1.3.1
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.4 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.4.2 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.5 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.5.0 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.6 -> CurrentJDK
lrwxr-xr-x   1 root  wheel   10 Mar 20 11:12 1.6.0 -> CurrentJDK
drwxr-xr-x  10 root  wheel  340 Mar 20 11:13 A
lrwxr-xr-x   1 root  wheel    1 Mar 20 11:12 Current -> A
lrwxr-xr-x   1 root  wheel   59 Mar 20 11:12 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For different types of JDKs or installations, you will have different paths.

On Mac OS X Mavericks, the path I found as following:

1) Built-in JRE default:

 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

2) JDKs downloaded from Apple:

 /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/

3) JDKs downloaded from Oracle:

/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...