在MAC中为Eclipse设置JDK [英] Setting the JDK for Eclipse in MAC

查看:51
本文介绍了在MAC中为Eclipse设置JDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我购买了MacBookPro,并且是该操作系统的新手.我从Oracle网站下载了JDK并安装了它(/Library/Java/JavaVirtualMachines/jdk_1.7 ...),所以当我输入"java-version"(在终端中显示):1.7.但是我无法在Eclipse上设置1.7 JRE.当我尝试在Eclipse中的"Java/InstalledJREs/Add"处添加JDK时,它不接受jdk_1.7/Contents/Home的主目录.错误,找不到解决方法.

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.

也安装1.7之后,eclipse无法编译一个简单的HelloWorld.java文件."java.lang.UnixProcess"如果我删除了1.7,那么它会起作用,并且"java -version"表示1.6

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

推荐答案

您需要先在eclipse.ini文件中添加JDK.只需转到eclipse文件夹并找到eclipse.ini.在eclipse.ini文件中,将有一个名为-vm在此将您的路径添加到JDK.

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.

现在,如果您不知道jdk的路径,则可以使用以下命令:/usr/libexec/java_home -v 1.8

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

一旦你有自己的路.只需将其粘贴到eclipse.ini中即可.日食现在应该可以工作了.

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

这篇关于在MAC中为Eclipse设置JDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆