) The ‘fix’ options so far are to 1) Install an old, specially modified version of Java 6 released by Apple, or 2) install the latest Java version 8 from Oracle and implement a workaround. Fortunately, the latter (a MUCH better option, IMO) is not that difficult.
I've installed JDK 7u7 downloaded from oracle's website. But after installation, the terminal is still showing java version 6 $java -version java version '1.6.035' Java(TM) SE Runtime Environment (build 1.6.035-b10-4) Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode) any idea why java 7 is not showing up? Ans: OK, the problem has been resolved. Here is the answer: I found that my Terminal has a.bashprofile and the java home variable is set to 1.6 export JAVAHOME='/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home' So this is the line causing the problem every time I opened a new terminal window. Simply remove this line will solve the problem. You still need to follow what @aleroot said, but if that doesn't work for you, check the.bashprofile (or.bashrc) setting file to see if you've previously exported any java version.
Oracle's installer puts java inside the /Library/Internet Plug-Ins/JavaAppletPlugin.plugin. And it doesn't overwrite /usr/bin/java.
So, if you issue a whereis java in the terminal, it'll return /usr/bin/java. (which in turn points to /System/Library/Frameworks/JavaVM.framework/Versions/A/Commands/java, which is Apple's 1.6 version). So, if you want to use the new java version, replace the /usr/bin/java symlink so that it points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java instead: sudo rm /usr/bin/java sudo ln -s /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin.
Vi /.bashprofile add export JAVAHOME=`/usr/libexec/javahome -v 1.7` This tells your /usr/bin/java link target to use the latest Java 7 Package installed in /Library/Java/JavaVirtualMachines/ So for JDK 1.7.017 JAVAHOME would be: /Library/Java/JavaVirtualMachines/jdk1.7.017.jdk/Contents/Home Note: There were a lot of change in this area recently to move Mac OS X from Appels own System integrated Java packages to Oracle based Java Packages. The above solution is working fine as of Mac OS X 10.8.2. +1 for this answer which is imo the correct one because it works on versions of Mac OS before and after 'Java Preferences' was removed, and by showing the '-v' option it demonstrates how you can use java 6 even if java 7 is installed (which is what I want). Hence on my Mac running Lion (10.7.5) I use the same command with '-v 1.6'.
This is crucial because I need Java 6 and Oracle doesnt provide one for Mac OS - only Java 7, and this allows me to use the installed JAva 6 even though Java 7 is installed. – May 20 '13 at 11:43. In my case, the issue was that Oracle was installing it to a different location than I was used to.
Download from Oracle:. Verify that it's installed properly by looking in System Prefs:. Command-Space to open Spotlight, type 'System Preferences', hit enter. Click Java icon in bottom row. After the Java Control Panel opens, click 'Java' tab, 'View.'
, and verify that your install worked. You can see a 'Path' there also, which you can sub into the commands below in case they are different than mine.
Verify that the version is as you expect (sub in your path as needed): /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version. Create link from /usr/bin/java to your new install sudo ln -fs /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java.
Sanity check your version: java -version. I had run into a similar issue with terminal not updating the java version to match the version installed on the mac.
There was no issue with the JAVAHOME environmental variable being set I have come up with a temporary and somewhat painful but working solution. In you.bashprofile add the line: export JAVAHOME='/Library/Java/JavaVirtualMachines/jdk1.7.011.jdk/Contents/Home' (This is the path on my machine but may be different on yours, make sure to get yours. The paths should match up to /Library/Java/JavaVirtualMachines/) the run source /.bashprofile As I mentioned this is a temporary band-aid solution because the java home path is being hard-coded. There is really no way to set the path to get the latest as that is what Apple is supposedly doing for terminal already and the issue is that Apple's javahome environment variable is not getting updated. Since El Capitan, it is difficult to delete the /usr/bin/java symlink, because of the introduction of the new 'rootless' policy.
Therefore, I simply added the path to the latest java version (in my case this is /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin) to the PATH in my.bashrc file: # Use latest java version export PATH=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin:$PATH To reload your.bashrc file for the current session, run source /.bashrc in the shell. You only have to do this for sessions that had been started before changing the.bashrc file.
Now the latest version is used, when you use java in the shell. The basic issue: /usr/bin/java is pointing to one provided by OSX itself initially ( /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java) We need to point this to the one downloaded by the JDK installer. The below steps are for OSX 10.10.4 Yosemite. Open System Preferences - select Java. The Java window opens. Click on Java tab at the top.
Click on 'View' button. The Java Runtime Environment Settings tab opens as below:. Double click on the Path item and copy the path (cmd+c).
This is the latest one installed by the JDK installer/updater. In my case, the path was /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java.
Open terminal. In this step, we are going to point (symbolic link, ln -s command) the system java binary to the latest one, which we discovered in the previous step.
Run the below command: sudo ln -s /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java /usr/bin/java Thats it. To verify, you can just run java -version on the terminal.
It should output the latest version that you installed/updated to.
Many Adobe applications depend on the Oracle Java Runtime Environment (JRE) for some features to work. Apple recently changed the way it includes Java in Mac OS, and with Lion, Java is no longer preinstalled. It is now an optional install that you must select. Since current Adobe installers and applications were built before these changes by Apple, Adobe software anticipates that Java is installed. Adobe and Apple have worked together to ensure that you can install Java at OS install time.
Or it can be installed later before you install Adobe applications. At runtime, when you launch an Adobe application, you are prompted to install Java if it is not already installed. If you do not install Java before running an Adobe application, there can be missing or improperly behaving features.
If you encounter any issues, install Java to correct the problems. Adobe recommends that corporate IT organizations pre install Java (or make sure that Java can be installed through their firewalls/security) to avoid conflicts with Adobe applications. If the Java runtime is not installed, some issues that are known to occur include -.
Failure to launch. Install Java runtime prompts when you attempt to use the applications. Applications hang or quit.