Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the JDK for Eclipse in MAC

I bought a MacBookPro and I'am newbie with this OS.I downloaded the JDK from Oracle's website and installed it (/Library/Java/JavaVirtualMachines/jdk_1.7...) so everything is fine when I enter "java -version" in Terminal it says : 1.7. But I could not set the 1.7 JRE on Eclipse.When I try to Add the JDK at "Java/InstalledJREs/Add" in Eclipse it doesn't accept the Home directory of jdk_1.7/Contents/Home.. What am I doing wrong, couldn't find the way to solve.

Also After installation of 1.7, eclipse cant compile a simple HelloWorld.java file.It gives error something like; "java.lang.UnixProcess" If I remove the 1.7 it works and "java -version" says 1.6

like image 421
user1186409 Avatar asked Mar 19 '23 07:03

user1186409


1 Answers

You need to add the JDK on the eclipse.ini file first. Just go to the eclipse folder and find the eclipse.ini. In the eclipse.ini file there will be a section called -vm Add your path to the JDK there. enter image description here

Now if you are not aware of the path of your jdk, you can use the below command: /usr/libexec/java_home -v 1.8

Once you have your path. Just paste it in the eclipse.ini. Your eclipse should work now.

like image 195
Radioactive Avatar answered Apr 19 '23 04:04

Radioactive