views:

418

answers:

5

Hi everybody.

The problem: elcipse-3.5.0 (Galileo) spits with an error when I try to launch it by clicking its launcher. The curse sound like this:

A Java Runtime Environment (JRE) or
Java Development Kit (JDK) must be
available in order to run Eclipse. No
Java virtual machine was found after
searching the following locations:
/home/emanemos/bin/eclipses/eclipse-3.5.0/jre/bin/java
java in your current PATH

However, everything goes smoothly when eclipse is started from console.

Before installing eclipse I've installed jdk1.6.0_16. I also created the $JAVA_HOME variable and changed my $PATH:

$ echo $JAVA_HOME
/usr/lib/java/jdk1.6.0_16
$ echo $PATH
/home/emanemos/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/java/jdk1.6.0_16/jre/bin

So that, my terminal got to know what java is:

$ java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)

Then a folder eclipse was extracted from .tar.gz package under the directory ~/bin/eclipses. I changed the folder's name eclipse to eclipse-3.5.0 and changed $PATH again:

$ echo $PATH
/home/emanemos/bin/eclipses/eclipse-3.5.0:/home/emanemos/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/java/jdk1.6.0_16/jre/bin

From this moment I was blessed to launch eclipse from console by the command eclipse.

However, I feel desperate about using the eclipse's application launcher.

Thanks in advance. I would be grateful for any help.

A: 

Try to edit eclipse.ini in %ECLIPSE_HOME% setting where is VM. Something like(must be in separate lines):

vm

D:\devsw\sun\Java\jdk1.6.0_16\bin\javaw.exe

Boris Milojkovic
I tryed this. No result, unfortunately.
emanemos
This won't work for you, emanemos. If you're on a *nix system (as appears to be the case), a D: drive (Windows) won't help you. Same with cw22's response below. Both are too specific anyway and are only a band aid - I would look to find the root cause of the problem (AKA, your system doesn't recognize Java).
JasCav
I've tryed not the exact your lines, but-vm$JAVA_HOME/jre/binIt gave me the error sounding:A Java Runtime Environment (JRE) or Java Development Kit (JDK)must be available in order to run Eclipse. No Java virtual machinewas found after searching the following locations:$JAVA_HOME/jre/bin
emanemos
My system is ubuntu-9.04
emanemos
A: 

I could be off, but it looks to me that you don't have JAVA in your path. If you notice, you had to add it via the echo command. However, that only stays for that session of the terminal. You don't permanently affect the system. (I believe that's why you can launch from the terminal, but not via the launcher.)

Do you have the Java JRE actually installed on your system? If not, I would recommend doing that as that should do all the setup that you would need, then try running Eclipse again.

Edit: I noticed you said that you did install the 1.6 JDK. This should have fixed your problem. If Java is not in your path when you first open up your terminal, then that (I believe) is your real problem and you may need to do a reinstall or troubleshoot there.

JasCav
As for the env. variables, I've created/changed them by editing the /etc/bash.bashrc file, so they should be permanent, shouldn't they? I have them OK every time I boot.
emanemos
Those env. variables will be set every time you start a session. This happens when you load up a bash terminal, it also happens when you log in to the desktop environment - but the variables won't be exported to the desktop environment from within it... I don't know if I'm explaining that well...
Grundlefleck
You explain fine!I've edited my eclipse.ini: substituted $JAVA_HOME/jre/bin with/usr/lib/java/jdk1.6.0_16/jre/bin. Now eclipse starts well!
emanemos
A: 

Add this to eclipse.ini:-

-vm $Java_home/jdk1.5.0_14/bin/javaw.exe

cw22
Thanks for the comment. It nearly worked.
emanemos
What part did not work? and that -vm should be on a separate line in the ini file.
cw22
$JAVA_HOME part did not work. According to Grundlefleck, this variable is initialized every time console is launched, while when gui is used the variable is unknown. I used /etc/bash.bashrc file to add $JAVA_HOME. Please, let me know if you're aware of any other appropriate way to add this variable. As for now, I decided to use -vm-option with the full address, i.e. without variables.
emanemos
I've found a better solution. The GUI can read global env. variables from the /etc/environment file. So it seems to be perfect for variables like $JAVA_HOME which are used everyhwere (in shells, IDE's, etc .)I edited /etc/environment, erased vm-option, rebooted and launched my eclipse by a click.
emanemos
A: 

(Making a big assumption that you're on Linux using X)

If you've installed the Java JRE without logging out and back in to the X session, the environment the session is in won't contain the $JAVA_HOME variable. It may just be a case of logging out and back in in order to get a new X session.

If you want to keep the same session running, you could try it out by pressing Ctrl+Alt+F9 to start another GUI session.

Grundlefleck
A: 

I was facing the same problem of Eclipse not starting from when I try to launch it by clicking its launcher, but starting from command line. There was some issue in the path. I have both Java 6 and Java 5. I had to use Java 5 and not Java 6 any more.

In eclipse if the installation directory contains a "jre" directory, the JVM installed there is used. I had to do this to make sure that I have know exactly what JVM I'm using to run Eclipse.

sam