11

I installed eclipse and netbeans on mac osx 10.6 I installed android sdk and everything was working perfectly.

Now I installed mac ports and installed ImageMagick using macports

Now after restarting the system neither netbeans work nor eclipse.

Net beans closes without any error. and eclipse give following error :

A JDK or JRE must be installed in order to run eclipse No java virtual machine is found after searching the following location: /Users....../eclipse.app ContentsMacOS/jre/bin/java java in you current PATH

I thought the problem might be with the path.

So I tried running java and javac from terminal. But these two commands run properly.

note: I don't have javaw (I am not sure whether we have this file in mac or not.

Can I know what can be the problem and how can I fix it ?

12 Answers 12

26

In the Eclipse.app/Contents/MacOS/eclipse.ini file put

-vm 
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java

right before

 -vmargs

should help, I hope ... I hope

2
  • 4
    Your answer helped me, with a small modification. I suggest running ls -l `which java` | cut -d">" -f2- and adding its result as the string following the '-vm' parameter. May 17, 2012 at 11:01
  • This worked, thanks. But anyone knows, what was the issue?
    – Rocky Inde
    Feb 26, 2018 at 7:23
3

Check your Eclipse directory -- and look in eclipse.ini for this line:

-vm
<path to java.exe - e.g. C:/Program Files (x86)/Java/jdk1.6.0_18/bin/javaw.exe>

You're probably missing that

3
  • I am running on mac so I don think I can set that -vm thingy :( May 5, 2011 at 17:03
  • the -vm option is present for all eclipse versions -- including mac, linux etc
    – Liv
    May 6, 2011 at 9:13
  • P.S. I gave my settings as an example on my Windows PC but it will be just a different path on Mac
    – Liv
    May 6, 2011 at 9:13
3

For newer versions: Mac OS X El Capitan Version 10.11.6 path to current Java version is:

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

For Eclipse Neon.1 open the eclipse.ini file from

Eclipse.app/Contents/Eclipse/eclipse.ini

and update the vm argument to:

-vm 
/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

just before

-vmargs
3

For me updating the eclipse.ini with -vm did not help. Rather, I had to update Eclipse.app/Contents/info.plist with below content(replace $Actual Java location$ with location of java:

<string>-vm</string><string>*$Actual Java location$*</string>
1

For windows 7 - 64 bit users ( may work for others too ) you may do the following

1. If the java Runtime is NOT already installed, (Note it does not get installed along with Android SDK, you need to download it separately ). You can download from here http://www.oracle.com/technetwork/java/javase/downloads/index.html (select 'Java Platform (JDK) 7u21' out of the three option the first button :) )

after install you will find javaw.exe in " C:\Program Files (x86)\Java\jre6\bin"

2. set the environment variable the steps as below

a) Right click Computer, select properties, select 'advance system setting'

b) Under Advanced tab select the last button 'Environment Variable'

c) Under System settings in the window that comes next search for 'Path'

d) select 'Path' click edit

e) Add the '; C:\Program Files (x86)\Java\jre6\bin' (this path or which ever path its installed in your machine, semi colon is used to separate other pre-existing path variables, and no need of quote ;) )

Thats all !! Now try running Eclipse.exe ( note : if you have added the entry in eclipse.ini as suggested by some ..please remove it else it will throw another exception)

Remember no need to change the eclipse.ini

It works Just double click the eclipse.exe :)

1

OK. So I did add

`-vm

/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/bin/java`

to eclipse.ini file but it was always overwritten when I restarted the Eclipse.

So, the thing I have done is:

  1. I've created the folder structure mkdir -p jre/Contents/Home/jre/bin/ in main eclipse folder
  2. Changed dir to: cd jre/Contents/Home/jre/bin/
  3. Made symlink to $JAVA_HOME/bin/java folder: ln -s /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java

And after that Eclipse works every time!

Hope this helps :)

0

In eclipse Go to Windows --> Preferences --> Java --> Installed JRE's and see whether any JRE in mentioned there.

2
  • Eclipse shows error before opening.. How DO i Set prepfrences in that case.. Plus I have prob with net beans too.. May 5, 2011 at 17:02
  • those settings are not for the JRE's used by Eclipse on startup, but for the JRE's/JDK's used by Eclipse when running Java classes from within Eclipse.
    – Liv
    May 6, 2011 at 9:14
0

Caveat: I don't know anything about the Mac, so YMMV.

Check your JAVAHOME environment variable. On most systems, that is how the JRE broadcasts its location to apps that want to run under the current JRE.

2
  • My PATH varible alrady includes java May 5, 2011 at 17:03
  • 1
    The PATH and JAVAHOME are different. The PATH is how the OS finds the java executable, the JAVAHOME is how the JRE knows where its files/libraries are installed. Eclipse uses more than just the executable so it needs the JAVAHOME to point to the JRE you want it to use. May 5, 2011 at 19:14
0

Download the offline executable file on Java.com and make sure that if your system is 32-bit or 64-bit you should download the one that is appropriate with your system. After installing Java try running eclipse and it should run.

0

Go to "environment variables" from "advance system settings".

Add JAVA_HOME variable (both user and system variables) and value= "path of jre" example: "C:\Program Files\Java\JDK_1.8\jre\bin".

Add jre path to "Path" variable "...; C:\Program Files\Java\JDK_1.8\jre\bin".

Then it works..

If still there is a problem, copy jre directory to path where Eclipse IDE Application works.

0

Launching eclipse via terminal worked for me. Try that.

0
-1

@all thanks a lot.

It some or how works after two restarts don no why..

Thanks and sorry for the trouble

Not the answer you're looking for? Browse other questions tagged or ask your own question.