简体   繁体   中英

How to set Eclipse Java version in OS X

When I download and expand Eclipse EE version a file of type Application is created :

在此处输入图片说明

I'm new to using to Eclipse on MAC. I want to set the java version to

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

But no eclipse.ini file is created. How to set and or install Eclipse on MAC and set the java version ?

File type "Application" is actually a directory. Right-click it (or control click) and select "Show Package Contents". You should find eclipse.ini at Contents/MacOS/eclipse.ini inside the Eclipse application directory.

You need to install the full JDK rather than the JRE before you can use it with Eclipse. The full JDK should set itself as the current Java. The JDK installs in something like /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home

As mentioned in the other answer the Eclipse application is actually a directory (called Eclipse.app ) using 'Show Package Contents' in Finder will show you the contents.

This solution allows you to specify the JVM for a given eclipse installation, without changing any system properties. Make sure you have a valid JVM (usually JDK 8 for eclipse) installed.

Here are the steps:

  • open finder and navigate to the location of Eclipse (ie Applications)
  • right-click on the eclipse application
  • select "show package contents"
  • navigate to /content/Eclipse/eclipse.ini
  • open the .ini with a text-editor
  • at the top of the file, add the following lines (or replace the existing -vm line)
 -vm /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin

You need to replace adoptopenjdk-8.jdk with the name of your JVM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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