Mac OS X 10.6.7 Java Path Current JDK confusing - java

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

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

Most possibly you only have one jdk installed, thus all the soft links points to the same jdk. If you however did have multiple jdks installed you would need to choose which one to use with the 'Java Preferences' app in your /Application/Utilities.
Soft links are by the way created with the ln -s command from Terminal.

Just run following commands:
$ brew update
$ brew install jenv
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(jenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
$ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/
oracle64-1.8.0.45 added
1.8.0.45 added
1.8 added
$ jenv add /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
oracle64-1.7.0.79 added
1.7.0.79 added
1.7 added
$ jenv versions
* system (set by /Users/wanluwang/.jenv/version)
1.7
1.7.0.79
1.8
1.8.0.45
oracle64-1.7.0.79
oracle64-1.8.0.45
$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
$ jenv global oracle64-1.7.0.79
$ java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

From Apple Technical Q&A Java Questions:
User Preferences
On Mac OS X, the Java runtime provides the java.util.prefs API which is backed by the standard Mac OS X Preferences API and directories. Simply using this pure Java API reads and stores your application's preferences in ~/Library/Preferences in a Mac OS X property list file. For applications that may already have their own preferences format, these preferences should be stored in the ~/Library/Preferences directory as well. This directory can be reached from Java code by creating a file with the path of System.getProperty("user.home") + "/Library/Preferences/" + "com.example.your.Application". An application that should have global preferences across all users could instead reside in /Library/Preferences, however this directory is not writable by non-admin users.

set $JAVA_HOME=$(/usr/libexec/java_home)
in your .bash_profile
or export JAVA_HOME=$(/usr/libexec/java_home);
echo $JAVA_HOME

Related

Java version confusion need to set JAVA_HOME to Java11

I'm not able to set Java11 to my JAVA_HOME env
I installed Java through home brew, how can I switch the version?
I needed to intall this java zulu to run Salesforce Data loader.
$ java -version
openjdk version "11.0.12" 2021-07-20
OpenJDK Runtime Environment Homebrew (build 11.0.12+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.12+0, mixed mode)
$ /usr/libexec/java_home -V
/usr/libexec/java_home -V
Matching Java Virtual Machines (1):
16.0.2 (x86_64) "Azul Systems, Inc." - "Zulu 16.32.15" /Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/zulu-16.jdk/Contents/Home
ls -la /usr/bin/java
-rwxr-xr-x 1 root wheel 138880 Jan 1 2020 /usr/bin/java
ls -la /System/Library/Frameworks/JavaNativeFoundation.framework/Versions/Current
lrwxr-xr-x 1 root wheel 1 Jan 1 2020 /System/Library/Frameworks/JavaNativeFoundation.framework/Versions/Current -> A

Need to source java-1.8.0-openjdk-amd64 specifically and install?

App throwing error at startup looking specifically for java-1.8.0-openjdk-amd64. Environment is Ubuntu1604. Java java-8-openjdk-i386 is already installed , but need the amd64 and then use it as an alternate. Where can I source amd64 tar file ? Have ran "sudo apt-get install openjdk-8-jdk". thx
2/6/21 current status - have not being able to install Java 8 AMD64.
Hi there, I tried :
sudo tar xvf jdk-8u291-linux-x64.tar.gz --directory /usr/lib/jvm/
and this installed to /usr/lib/jvm/jdk1.8.0_291.
However I was expecting /usr/lib/jvm/java-1.8.0-openjdk-amd64 folder structure.
Whats currently installed is:
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$ ls -lrta
total 24
lrwxrwxrwx 1 root root 23 Feb 25 2016 default-java -> java-1.8.0-openjdk-i386
drwxr-xr-x 8 10143 10143 4096 Apr 7 20:26 jdk1.8.0_291
-rw-r--r-- 1 root root 2716 Apr 21 17:10 .java-1.8.0-openjdk-i386.jinfo
lrwxrwxrwx 1 root root 19 Apr 21 17:10 java-1.8.0-openjdk-i386 -> java-8-openjdk-i386
drwxr-xr-x 8 root root 4096 Jun 1 23:17 java-8-openjdk-i386
drwxr-xr-x 2 root root 4096 Jun 1 23:17 openjdk-8
drwxr-xr-x 69 root root 4096 Jun 1 23:43 ..
drwxr-xr-x 5 root root 4096 Jun 2 09:26 .
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~16.04.1-b10)
OpenJDK Server VM (build 25.292-b10, mixed mode)
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$ sudo update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-i386/jre/bin/java
Nothing to configure.
ubuadmin#ubu1604OAEdd:/usr/lib/jvm$
How can I complete the install. The app I'm trying to use is looking for :
/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java
Answering your question as-is - you can find links to all jdk implementations on jdk.dev . But you'll have to extract jdk and add bin directory to PATH by yourself
As for updating alternatives it's a question for askubuntu.com, but I believe, that you should do install before updating.
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_291/bin/java" 1

Cordova/Android not finding JDK on OSX and PATH/JAVA_HOME correct

So cordova requirements is still failing for Android after trying and verifying all paths, versions and suggestions. It's on OSX 10.10.5 and a clean install of Android SDKs/Studio and cordova. Have tried Apple recommended (export JAVA_HOME=/usr/libexec/java_home -v 1.8) and direct paths with same failed result. Have verified both java/javac are in the bin directory of the JDK path.
sh-3.2# cordova requirements
Requirements check results for android:
Java JDK: not installed
Failed to run "java -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
Android SDK: installed
Android target: installed android-9,android-10,android-19,android-22,android-23,android-24,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed
Error: Some of requirements check failed
sh-3.2# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/dzhon/bin:/opt/dzhon/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Users/rob/Library/Android/sdk/tools:/Users/rob/Library/Android/sdk/platform-tools:/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin:/Users/rob/Documents/software/apache-ant-1.9.7/bin
sh-3.2# echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home
sh-3.2# java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
sh-3.2# javac -version
javac 1.8.0_102
sh-3.2# node -v
v5.3.0
sh-3.2# cordova -v
6.2.0
and in ~/.bash_profile:
export ANT_HOME=/Users/rob/Documents/software/apache-ant-1.9.7
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
export ANDROID_HOME=/Users/rob/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:${JAVA_HOME}/bin:$ANT_HOME/bin
have also checked all the symlinks:
sh-3.2# ls -la /System/Library/Frameworks/JavaVM.framework/Versions/
total 32
drwxr-xr-x 11 root wheel 374 20 Jul 11:54 .
drwxr-xr-x 12 root wheel 408 6 Jan 2016 ..
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 26 Mar 2015 1.6.0 -> CurrentJDK
drwxr-xr-x 8 root wheel 272 6 Jan 2016 A
lrwxr-xr-x 1 root wheel 1 26 Mar 2015 Current -> A
lrwxr-xr-x 1 root wheel 59 20 Jul 11:54 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents
The only thing in digging through the source for cordova-android on gitHub is in check_reqs.js, the error message is:
Failed to run "javac -version", make sure that you have a JDK installed.
rather than as it currently reports:
Failed to run "java -version", make sure that you have a JDK installed.
Any help greatly appreciated.
Rob
So a number of issues. check_reqs.js is where the platform/environment checks are done (app/platforms/android/cordova/lib/). The call to forgivingWhichSync('javac') on line 98 was returning the non-JDK link (as it was using Current, not CurrentJDK):
/System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/javac
By repointing the Current symlink in /System/Library/Frameworks/JavaVM.framework/Versions/ to CurrentJDK it fixed this first issue:
lrwxr-xr-x 1 root wheel 10 21 Jul 12:03 Current -> CurrentJDK
lrwxr-xr-x 1 root wheel 59 21 Jul 12:06 CurrentJDK -> /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents
The next issue was a problem with the tryCommand method testing javac. As correctly noted, javac -version returns the information in stderr. The issue (at least on OSX) is that the call to child_process.exec on line 44 also returns information in err:
Error: Command failed: /bin/sh -c javac -version
javac 1.8.0_102
javac: no source files
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
The handling of the callback to this child_process.exec always triggered an error if err was non null:
if (err) d.reject(new CordovaError(errMsg));
changing this to only trigger this error if the catchStderr flag was not set now correctly handles the test for javac:
if (err && !catchStderr) d.reject(new CordovaError(errMsg));
and now success:
sh-3.2# cordova requirements
Requirements check results for android:
Java JDK: installed .
Android SDK: installed
Android target: installed android-9,android-10,android-16,android-18,android-19,android-22,android-23,android-24,Google Inc.:Google APIs:16,Google Inc.:Google APIs:18,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23
Gradle: installed
Unfortunately need to edit check_reqs.js for each project when you cordova platform add android but at least it's now finding everything.
Everything worked perfectly when I did the installation with Cordova version 7 and JDK 1.8u131 on OSX. Nothing had to be changed or configured. Possibly the older versions of Cordova had issues.

jar: error while loading shared libraries: libjli.so [How to manually install Java 6]

I'm running into this error when I'm building android 2.3 from source code on Ubuntu 10.04. I am suspecting it is an issue with a path or something along those lines but cannot figure it out. I have seen similar people have this issue but I haven't found any solution that works for me. I included some information about my environment, any help would be appreciated(if you know my path's are correct then even that would be beneficial as I could start look into other possible sources of error). Thanks.
java -version should indicate the installation was successful:
juan#juan-desktop:~/bin/WORKING_DIRECTORY$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
My .bashrc has:
export JAVA_HOME=/usr/java/jdk1.6.0_45/bin/java
PATH=$PATH:/usr/local/bin:/usr/bin:/usr/lib:/usr/lib/jvm:/usr/lib/jvm/jdk1.6.0_45/bin
Some more info:
juan#juan-desktop:~$ namei -mx /usr/bin/java
f: /usr/bin/java
Drwxr-xr-x /
drwxr-xr-x usr
drwxr-xr-x bin
lrwxrwxrwx java -> /etc/alternatives/java
Drwxr-xr-x /
drwxr-xr-x etc
drwxr-xr-x alternatives
lrwxrwxrwx java -> /usr/lib/jvm/jdk1.6.0_45/bin/java
Drwxr-xr-x /
drwxr-xr-x usr
drwxr-xr-x lib
drwxr-xr-x jvm
drwxr-xr-x jdk1.6.0_45
drwxr-xr-x bin
-rwxr-xr-x java
I'm posting my solution on here in case anyone else runs into a similar problem and stumbles across this. I simply re-installed my OS, ran the steps again, and everything worked perfectly fine this time. I must have caused some sort of error on my machine as I ran the same exact steps too. Here is what I did to manually install Java 6 on a clean machine:
Install Java 6(.bin format) from the Oracle website
Give it executable permissons and execute it
Add a jvm folder to usr/lib/
Move your Java 6 folder to usr/lib/jvm
Link java/javaws/javac to usr/bin using the ln -s command
Add your Java6 and Java/bin location to your path. For me its:
export JAVA_HOME=usr/lib/jvm/jdk1.6.0_45
export PATH=/usr/bin:$JAVA_HOME/bin

Mac OSX Java Terminal version incorrect

Ok, I'm a bit new to Macs and OSX, but I picked one up so that I can do some troubleshooting on my Java programs with one since the company I work for uses a combination of OSX and Windows machines. The problem I'm running into is, when I install Java 7 from Oracle's website, it updates the preferences menu and appears to execute .jar files correctly when double-clicking them, but the terminal window's version is still 1.6.0_43 and running the same .jar file from the terminal results in runtime errors due to the older version.
When I navigate to /Library/Java/JavaVirtualMachines/ I'm presented with an empty folder. From what I've seen in other articles, this is where the Java 1.7.0's version folder should be. Any idea what's going on? How can I get the terminal to use the correct version of Java?
Edit: #DWilches comment on his original answer:
(1)
total 64
lrwxr-xr-x 1 root wheel 10 Mar 17 21:38 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 17 21:38 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 17 21:38 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 17 21:38 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 17 21:38 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 17 21:38 1.6.0 -> CurrentJDK
drwxr-xr-x 8 root wheel 272 Mar 17 21:38 A
lrwxr-xr-x 1 root wheel 1 Mar 17 21:38 Current -> A
lrwxr-xr-x 1 root wheel 59 Mar 17 21:38 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
(2)
ls -ld /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Mar 17 21:38 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
Edit: sorry for the mistake with a new answer, gotten too used to sites that block edits of the original post after so long...
JDK
On Mac OS, /usr/bin/java and friends are stubs that delegate to the real JDK commands. These stubs respect the setting of your JAVA_HOME environment variable, but for this to work you need to install the JDK (from http://www.oracle.com/technetwork/java/javase/downloads/index.html) as opposed to the JRE (from http://java.com).
The JDK installs into /Library/Java/JavaVirtualMachines/jdk1.7.0_NN.jdk (for whatever value of NN), so set your JAVA_HOME environment variable to /Library/Java/JavaVirtualMachines/jdk1.7.0_NN.jdk/Contents/Home to make /usr/bin/java use 1.7. You can switch back to 1.6 simply by pointing your JAVA_HOME to /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home instead. You can use the /usr/libexec/java_home tool to find the right value automatically, for example to make /usr/bin/java use Java 7 you can do
export JAVA_HOME=`/usr/libexec/java_home -v '1.7*'`
and to make it use Java 6 you can do
export JAVA_HOME=`/usr/libexec/java_home -v '1.6*'`
The same applies to Java 8 (using -v '1.8*'). This will pick up the latest installed JDK for the relevant major version, you don't need to remember to change the NN by hand when you install an update.
JRE
If you want to run the 1.7 or 1.8 JRE from the command line, it can be found in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java. This is a fixed path and you can only have one "public" JRE installed at any given time.
$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
You could use a shell alias in your .bashrc
alias java_jre='/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
The issue is that Oracle's JRE installation does not change the /usr/bin/java executable. If you want to use this Java you have to use the path under /Library (need to find what this is I have JDK install so could be different)
As per Oracle's JRE installation document
Installing a JRE from Oracle will not update java -version symlinks or
add java to your path. To be able to do this, you need to install the
JDK.
The Oracle JDK does change /usr/bin/java to point to the Java 7 executable. If you are doing development then you should use this as it includes more than the JRE.
The Oracle install FAQ says
Q: Should I install the JRE or the JDK?
A: If you plan to run Java applications, install the Java Runtime
Environment (JRE). The JRE is also referred to as Oracle Java. Once
you have installed the JRE, you can launch Java applets and
applications by double-clicking JAR files, JNLP files, and via the
browser. Note that 32-bit browsers, such as Firefox in 32-bit mode,
and Chrome, are not supported by the JRE.
If you plan to write Java applications, install the Java Development
Kit (JDK).
First, did you Quit the Console and open it again so it has chances of taking the changes in the PATH variable ?
If you've already done this, then check which the default version of your Java is:
dwilches# ~$ cd /System/Library/Frameworks/JavaVM.framework/Versions/
dwilches# Versions$ ls -l
lrwxr-xr-x 1 root wheel 59 Mar 19 10:07 CurrentJDK -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
lrwxr-xr-x 1 root wheel 10 Mar 19 10:07 1.6.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 19 10:07 1.6 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 19 10:07 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 19 10:07 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 19 10:07 1.4.2 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Mar 19 10:07 1.4 -> CurrentJDK
lrwxr-xr-x 1 root wheel 1 Mar 19 10:08 Current -> A
drwxr-xr-x 8 root wheel 272 Mar 25 10:03 A
Now, you can see that the "Current" version is "A" (that's my Java7). If I would like to change it to Java 1.6 then I could write:
dwilches# Versions$ sudo unlink Current
dwilches# Versions$ sudo ln -s 1.6 Current
And then:
dwilches# Versions$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01-447-11M4203)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01-447, mixed mode)
So you may use this to make "Current" point to your desired Java location.
Just like Ian said, but probably you want java7 to be called from .sh script, so you need a function instead of alias added to .bash_profile:
java7() {
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java "$#"
}
export -f java7

Categories