Can anybody help me with installing JDK 8 on mac Mountain?
I have installed java_for_os_x_2013002_dp__11m4203.dmg
and I can see: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
.
But don't know what more to do.
How can I make a symlink to the new version and so on?
I use Eclipse and maven so I don't want any conflict with them. I'm a new mac user.
JDK 7 is already installed on my mac but I just want do some experiment with the new lambda expression.
Thanks for all help
Though EKG's answer explains well what you need to do to run a Java 8 project, if you wish to set Java 8 to be your default version on the system you can set it as the Java home.
I had (earlier for maven) added the following line to my .profile to set my Java home.
export JAVA_HOME=$(/usr/libexec/java_home)
Now, to set it to a specific version, I updated it to the following value
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
This does allow you to set a specific version as your default though how to update the default for the entire system (every user who hasn't set one themselves) still eludes me.
Note: I'm aware this isn't a direct answer but is something which people will come to when looking for this. Alas, this is too big to write in a comment. If this "answer" is better represented in another way, I'd be happy to make changes.
If you just want to try coding with JDK8, you dont need to install it on your system. Just as a JRE in a version of eclipse with Java 8 support. To get a beta build of eclipse you can either build it yourself (I had issues with this) or download a pre-built version. I couldn't find any pre-built versions on the eclipse site, but I found one here. http://downloads.efxclipse.org/eclipse-java8/
Once You have that downloaded, go to Eclipse > Preferences > Java > Installed JREs
Click Add, and specify the java 8 home directory. For me this was /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home.
Now create a project. The source level of 1.8 is not available in the UI, you need to modify the <my_project>/.settings/org.eclipse.jdt.core.prefs
and make sure you have the lines below.
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.source=1.8
Then you're good to go.
The build of eclipse is beta, so code assist doesn't always work with the new syntax. But it compiles and runs java 8 code fine :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With