简体   繁体   中英

Do I really need to set JAVA_HOME path in MAC to start coding simple programs using eclipse

I am newbie to MAC platform. I need to know if I really need to set JAVA_HOME path on MAC OS. Previously I have used windows and from what I have learned is, user need to specify JAVA_HOME path in "Environmental Variables" so that the system will know if JAVA is really installed in computer.

But is such thing not mandatory to do in MAC?. Can I code right away after java installation?

Can someone explain

NO,

you don't have to set JAVA_HOME path to run java code in eclipse. Though to run the code you will have to set the Run configuration, and specify the JRE you want to be used, to run the code (under JRE tab of Run Configuration). Here you will browse and point your system to access the required (Installed) JRE.

Though if you set JAVA_HOME path, you would be able to call the compile and run for java code from command line (Terminal) as well. and Eclipse will also pick the same without setting it up explicitly.

You can code right away; the eclipse oomph installer will hardcode a link to the location of your java vm for you in eclipse's config, which means eclipse will start regardless of your PATH or JAVA_HOME variables.

When running java apps from within eclipse, eclipse has its own registration of where java vms live. You can install various versions of java; you can tell eclipse about any or all of them and pick the VM that goes with a given project (the default is in windows | preferences, search for 'jre' in the filter – and you can also override this default in the project; right click on a project and select properties).

Any attempt to run stuff within the project will use the project's configured VM, and if there isn't one, the default as configured in the window|preferences dialog.

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