简体   繁体   English

如何在Mac OS X上使用JDK 7运行IDEA IntelliJ?

[英]How do I run IDEA IntelliJ on Mac OS X with JDK 7?

I use Mac OS X 10.8.2, and use JDK 7. Now I downloaded the latest version of IDEA IntelliJ, 11. But it doesn't seem to start without JDK 6. Is there any workaround? 我使用的是Mac OS X 10.8.2,并使用JDK 7.现在我下载了最新版本的IDEA IntelliJ,11。但是没有JDK 6它似乎没有开始。有没有解决方法?

How can I run IDEA IntelliJ on Mac OS X with JDK 7? 如何在Mac OS X上使用JDK 7运行IDEA IntelliJ?

UPDATE: 更新:

When running IDEA 12 on JDK 1.7 (after changing JVMVersion to 1.7* in Info.plist ) make sure you have LANG=en_US.UTF-8 in your environment, see the related Java issues: 在JDK 1.7上运行IDEA 12(在Info.plist JVMVersion更改为1.7*之后)确保您的环境中有LANG=en_US.UTF-8 ,请参阅相关的Java问题:

Refer to this thread for debugging launcher issues. 有关调试启动程序问题, 请参阅此线程

Please also be aware that GUI applications on Mac have no access to your Terminal environment. 另请注意,Mac上的GUI应用程序无法访问终端环境。 If you've defined some environment variables that work fine in Terminal, other applications that you run not from the Terminal will not see these variables. 如果您已经定义了一些在终端中工作正常的环境变量,那么您不是从终端运行的其他应用程序将看不到这些变量。 A workaround for this problem is to start the application directly from the Terminal, for IDEA the following command can be used: 此问题的解决方法是直接从终端启动应用程序,对于IDEA,可以使用以下命令:

open -a /Applications/IntelliJ\ IDEA\ 12.app/

There are known issues with JDK 1.7 support on Mac right now, like missing Retina support, possible flicker, some APIs not implemented . 目前Mac上已经存在JDK 1.7支持的已知问题,例如缺少Retina支持,可能的闪烁, 某些API未实现 It's highly recommended to run IDEA under JDK 1.6 for the best experience on Mac. 强烈建议在JDK 1.6下运行IDEA,以获得最佳的Mac体验。 It doesn't stop you from using JDK 1.7 as a target for building and running your projects. 它不会阻止您使用JDK 1.7作为构建和运行项目的目标。


IntelliJ IDEA 11 launcher will not work with JDK 1.7 on Mac. IntelliJ IDEA 11启动程序不适用于Mac上的JDK 1.7。 At the moment you must have JDK 1.6 installed so that you can run IDEA 11 and older versions. 目前您必须安装JDK 1.6才能运行IDEA 11及更早版本。

Mac OSX Yosemite / El Capitan Update Mac OSX Yosemite / El Capitan更新

I have IntelliJ 15 Ultimate installed, and I received this same message. 我安装了IntelliJ 15 Ultimate,我收到了同样的消息。 I also have Java 1.7 and 1.8 installed. 我也安装了Java 1.7和1.8。

I solved it using the following steps in a terminal: 我在终端中使用以下步骤解决了它:

$ cd /Applications/IntelliJ\ IDEA\ 14.app/Contents

Edited the Info.plist file, and changed this bit: 编辑了Info.plist文件,并改变了这一点:

<key>JVMVersion</key>
<string>1.6*</string>

to: 至:

<key>JVMVersion</key>
<string>1.8*</string>

After launching, everything was golden. 发布后,一切都是金色的。

使用IntelliJ 13和OS X 10.9,我可以将plist更改为1.7 *,它可以在Java 7上运行,而不会提示安装Java 6。

For those who still getting error message that Java 6 must be installed. 对于仍然收到错误消息的人,必须安装Java 6。 There are two problems with that: 有两个问题:

  1. Mac OS wants jdk 1.6 to be installed whenever application Info.plist file contains Java section 当应用程序Info.plist文件包含Java部分时,Mac OS希望安装jdk 1.6
  2. Java launcher shipped with IntelliJ also wants jdk 1.6 badly IntelliJ附带的Java启动程序也非常想要jdk 1.6

All you need is: 所有你需要的是:

  1. Replace original launcher (Contents/MacOS/idea) with shell script with explicit java invocation (parameters and classpath can be taken from Info.plist's Java section). 用shell脚本替换原始启动器(Contents / MacOS / idea)和显式java调用(参数和类路径可以从Info.plist的Java部分获取)。
  2. Remove "Java" section from Info.plist 从Info.plist中删除“Java”部分

Or you can use this https://github.com/wonder-mice/mac-java-launcher that automate things and I believe will work not only with IntelliJ. 或者您可以使用这个自动化的https://github.com/wonder-mice/mac-java-launcher ,我相信它不仅适用于IntelliJ。

Others have suggested very good solutions but you have to do it manually vi editor etc. Instead you can run this command via your Mac Terminal and you will be good to go : 其他人提出了非常好的解决方案,但你必须手动vi编辑器等。相反,你可以通过Mac终端运行此命令,你会很高兴:

find /Applications/IntelliJ*/*Contents/*Info.plist  -exec sed -i -e 's/string>1.6/string>1.7/' {} \;

在此输入图像描述

Few optional tips: 几个可选提示:

  1. If you have JDK 1.8 installed then simply replace the 1.7 with 1.8 in above command. 如果安装了JDK 1.8,那么只需在上面的命令中用1.8替换1.7。
  2. As always make a copy of your Info.plist in a folder just in case if you want to compare the result or revert it back for one reason or another. 一如既往地在文件夹中制作Info.plist的副本,以防您想要比较结果或因某种原因将其还原。
  3. To verify that the change took place run this: 要验证更改发生,请执行以下操作:

    • grep "string>1.7" /Applications/IntelliJ*/*Contents/*Info.plist

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

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