I'm trying to install JDK 1.7 update 21 on Mac OSX 10.7 .
I downloaded the installer from oracle site (as dmg file). ran the installer which completed successfully.
Now I can't find the java SDK anywhere on the file system.
The output of /usr/libexec/java_home -V is :
***/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home***
which is the previous version installed.
also running java -version executes the same old version.
***Java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)***
In the java control panel I do see that the JRE has updated to Java 1.7 for the browser but there aren't any details regarding the JDK there.
Where can I find the new JDK on the file system and how do I set it as default ?
Is there any log file for the installation that I can use to debug ?
Try adding this to your shell startup script (.bash_profile off of ~ if you are using bash):
export JAVA_HOME=`/usr/libexec/java_home -v '1.7*'`
The changeover from Apple providing the JDK to Oracle has been a complete disaster.
Related
I am trying to upgrade to: Java 8 Update 66, from Java 6, on my Mac running Mac OS X 10.10.5. I downloaded the Java Update .dmg file: re-8u66-macosx-x64.dmg. When I run the installer I get the message it installed properly. When I confirmed the install via the FireFox Browser at this URL:
https://java.com/en/download/installed.jsp
It reports:
Congratulations!
You have the recommended Java installed (Version 8 Update 66).
However, If I open a terminal window and enter: java -version
It reports:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
Can someone please explain what is going on here? Do I need to update a link somewhere?
Thanks.
Please check your PATH variable, and make sure that the java directories in the path match the directories in your computer. It should be the bin folder of the JAVA_HOME environment directory. Also check that JAVA_HOME environment variable is set to the jdk folder of your java installation.
There's two option based on my experience to fix this issue, fisrt uninstalled the java on your computer and reinstalled using the latest version.
Second, run a different version of Java, either specify the full path, or use the java_home tool:
List your installed java version:
$ /usr/libexec/java_home -V
In this case you are using java 8 so you can run command
$ /usr/libexec/java_home -v 1.8 --exec javac -version
If you want to make easy to switch your java version you can create alias in ~/.bashrc
alias java6="export JAVA_HOME=$(/usr/libexec/java_home -v 1.6);echo 'using Java 6'"
alias java8="export JAVA_HOME=$(/usr/libexec/java_home -v 1.8);echo 'using Java 8'"
Hope it help
I just tried to run Eclipse on a Mac Book Pro running OSX Mavericks. I've downloaded both, the 32 and the 64 bit version. Both end up in following Notification:
Version 1.6.0_65 of the JVM is not suitable for this product.
Version: 1.7 or greater is required.
I know that the question was already asked, but my Eclipse won't event start with the 64-bit version, which was the answer for a smiliar question. So I checked the version of my installed Java by running
java -version
In the terminal. The output really confirmed, that version 1.6.0_65 was installed. Here's the output:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Now the problem is that when launching the Java Control panel, it says, that Java 7 Update 67 is installed, and there are no updates.
So where's my problem, how get I get Eclipse to run?
You can modify the eclipse.ini and add the path to your JDK7
For versions of Mac OS X 10.7+ the location has changed to
-vm
/Library/Java/JavaVirtualMachines/<''jdk_name_ver''>/Contents/Home/...
To be safer, determine the location for the JDK you intend to use via the utility /usr/libexec/java_home and put this value with .../bin/java appended into the eclipse.ini file.
See "How to install JRE 1.7 on Mac OS X and use it with Eclipse?"
I installed JDK, "Java SE Development Kit 8u101", in addition to JRE and eclipse started to work fine.
I upgraded java on my osx 10.9.4 machine using the suggested method from the java web site
It successfully updated, but when trying to run Eclipse I get an error:
Version 1.6.0_65 of the JVM is not suitable for this product.
Version 1.7 or greater is required.
When I access java settings through the applet in the control panel, it shows Java 7 Update 65, but when I type java -version in the console, it shows 1.6.0_65 (response shown below):
| => java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)
As far as I know, there is only one java on the box. "which java" returns /usr/bin/java and type -a java returns only /usr/bin/java also. /usr/bin/java is obviously the older version, but I'd like to use the updated one. Can someone please tell me how to update the /usr/bin/java version and/or how to link the applet version so that Eclipse will use the updated one?
Take a look at oracle documentation here:
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html
It says:
To run a different version of Java, either specify the full path, or
use the java_home tool:
/usr/libexec/java_home -v 1.7.0_06 --exec javac -version
The /usr/libexec/java_home is a link to your jdk directory that should be located under:
/Library/Java/JavaVirtualMachines/jdk<major>.<minor>.<macro[_update]>.jdk
I think your java_home link is pointing to your jdk6. You can check it doing a ls -l /usr/libexec/
I downloaded JDK for Mac OS X 10.9.1 from Oracle, but I had to install another Java from Apple site once more, as I couldn't launch eclipse with it.
These are two pages that I referred.
Installing Java on OS X 10.9 (Mavericks)
http://support.apple.com/kb/DL1572?viewlocale=en_US
Now I have three java binaries installed in my computer.
Installation A
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Installation B
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
Installation C
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
I found that I can easily remove Installation C, however I'm not sure if this is OK.
When I invoked java from command line, it points to Installation A.
java -version
java version "1.7.0_51"
ls -alF `which java`
lrwxr-xr-x 1 root wheel 74 Jan 15 09:12 /usr/bin/java# -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
Is there any way to use just one JDK 1.7 for Mavericks by removing two of them safely?
EDIT
After some setup and test, I have only one Java (1.6) installed.
I have Installation B, and now Installation C is linked to Installation A.
For using eclipse, I had to make Compiler Compliance level to 1.6 to use it (from the help java.lang.UnsupportedClassVersionError Unsupported major.minor version 51.0).
EDIT2
This seems to what happened.
Installation of Apple Java
Installation A
Installation B is a symbolic link to A
Installation of Oracle Java
Installation C
Changed the Installation B that
Created a /System/Library/Frameworks/JavaVM.framework/Versions/A
Copied files from Installation C (not symbolic link)
Make a symlink Current to Versions/A
I tried to install Oracle Java only by removing Apple Java, but I got installation error, so I guess Apple Java is needed to install Oracle Java.
Specify the JVM for Eclipse
You can specify JDK version for usage with Eclipse in eclipse.ini. This will resolve problem with starting Eclipse.
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java
Warning: Add this configuration before -vmargs.
Master your Java Environnement with jenv
It is much easier to maintain multiple JDK versions with jenv.
jenv is for a equivalent of rbenv, but for Java environnement. It allow to easily switch between several JDKs installations (already presents), and configure which one to use per project.
Eclipse JDK
Setting JDK in Eclipse
It seems like that the oracle JDK can be just removed. For eclipse, I could add Installation A as a default JRE from Java Build Path -> JRE System Library -> Installed JRES -> Add ...
I've recently installed netbeans 7.3 on my Mac (Lion 10.7.5, up-to-date).
At the command line, I would get:
[129]$java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)
Today I went to the netbeans plugin window and found 18 updates to install. When I attempted to do this, I received a message that some of them require > Java 1.7, and I only have 1.6 (as indicated above). So I dutifully ran out to java.com and downloaded Java 1.7 Update 21 successfully.
When I run a Java version checker in various browsers I see a report that Java 1.7.0_21 is the installed version. In addition, the Mac's Java Control Panel also indicates that 1.7.0_21-b12 is the current version.
However, upon restarting netbeans, it still has the same complaint that Java 1.6 is in use. I've rebooted the machine and get the same result. And, the result of 'java -version' at the command line also still shows the same result as above (1.6.0_45).
And, finally, even if I try something like:
/usr/libexec/java_home -v 1.7.0_21 --exec java -version
I get:
Unable to find any JVMs matching version "1.7.0_21"
I'm baffled. Does anybody have any advice on this?
Thanks.
Doug
netbeans will be using it's own version of the the JDK try this
where-can-i-set-the-jre-jdk-which-is-used-to-run-netbeans-besides-the-command-line