简体   繁体   English

在Mac上为IntelliJ设置JDK 7

[英]Setting up JDK 7 for IntelliJ on the Mac

I installed the JDK by downloading the dmg from the Oracle website here: http://www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html 我通过从Oracle网站下载dmg安装了JDK: http//www.oracle.com/technetwork/java/javase/downloads/jdk7u9-downloads-1859576.html

After installation I tried to setup the JDK in IntelliJ but when I set the location to the JDK in the Project Structure->SDKs screen, only a few libraries were loaded and many (including all libraries from Content/Classes/) were missing. 安装后我尝试在IntelliJ中设置JDK但是当我在Project Structure-> SDKs屏幕中将位置设置为JDK时,只加载了几个库,并且很多(包括Content / Classes /中的所有库)都丢失了。

How can I add all of the necessary libraries? 如何添加所有必需的库?

The install location for the JDK is /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home JDK的安装位置是/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home

I've tried looking in /System/Library/Frameworks/JavaVM.framework/Versions/ to no avail. 我试过查看/System/Library/Frameworks/JavaVM.framework/Versions/无济于事。

Navigate to Project Structure -> Platform Settings/SDKs. 导航到项目结构 - >平台设置/ SDK。

Hit the '+' sign and add /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home 点击“+”符号并添加/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home

Under Project Structure -> Platform Settings -> SDKs . Project Structure -> Platform Settings -> SDKs

By using '+' sign, you should add a valid JDK, that will take care and add the proper libraries, eg. 通过使用“+”符号,您应该添加一个有效的JDK,它会照顾并添加适当的库,例如。 /Library/Java/JavaVirtualMachines/jdk-XYZ.jdk/Contents/Home

项目结构 - > PlatformSettings  - > SDKs

For jdk images older, like 1.6 or before, you need to ensure that all the jars from /Library/Java/JavaVirtualMachines/jdkXYZ_VERSION.jdk/Contents/Home/jre/lib directory too (charsets.jar, jce.jar, JObjC.jar, jsse.jar, management-agent.jar, resources.jar and rt.jar) are part of your setup. 对于较旧的jdk图像,如1.6或之前,您需要确保来自/Library/Java/JavaVirtualMachines/jdkXYZ_VERSION.jdk/Contents/Home/jre/lib目录的所有jar文件(charsets.jar,jce.jar,JObjC。 jar,jsse.jar,management-agent.jar,resources.jar和rt.jar)是您的设置的一部分。

For me, I had to select Project Structure->Platform Setting->Global Libraries and click on the "+" icon that is at the top of the middle pane of the Project Structure window. 对我来说,我必须选择Project Structure-> Platform Setting-> Global Libraries并单击Project Structure窗口中间窗格顶部的“+”图标。 This brings up a "New Global Library" drop down menu. 这会打开一个“New Global Library”下拉菜单。 From there I was able to locate the libraries I wanted to include. 从那里我能够找到我想要包含的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM