views:

51

answers:

4
+2  A: 

The problem is probably that Eclipse doesn't have JAVA_HOME in its environment.

Try logging out and back in again, then run Eclipse.

Alternatively, open a terminal, and run Eclipse from there.

Richard Fearn
wow i never thought in that way,it works. starting it from terminal is there any permanent solution to this problem so when i directly start eclipse those variable also get loaded .
Black Diamond
If you've added them to the `.cshrc` file they will be added to the environment of your desktop session when you log in. Then if you run Eclipse (either using a launcher, or by opening a terminal and running it from there) the variable will be propagated down to Eclipse. Until you log out and in again, you will have to open a terminal, which will get the new variable, and run Eclipse from there.
Richard Fearn
A: 

The .cshrc file is only run when you start a new C shell, it is not for global variables. Since you are not starting Eclipse from the C shell it will not see any variables you set there.

Try the ~/.login file or the /etc/profile file in case eclipse starts up using bash. Both of these files are only loaded once when the user logs on so they should effect everything. You may require a restart or even a reboot for changes to these files to take effect.

AmaDaden
A: 

Environment variables are inherited through process execution, they are not global. So, when you edit your shell's RC file to add a variable, it only takes effect for shells executed AFTER that modification, and for programs executed from those shells. If you started Eclipse from KDE/Gnome, and KDE/Gnome was started before you made that change, then KDE/Gnome never had the definition and therefore Eclipse did not either.

I recommend logging out and back in. Also, depending on your default shell setting, you may find that KDE/Gnome is being started through bash or something else, meaning that you'll need to modify .bashrc instead of .cshrc.

Jonathan
A: 

You should define this variables at one of the following files:

~/.profile or ~/.bash_profile runs only with login shells i.e when you first log in into system.

~/.bashrc file runs every time you open a new non-login bash shell such as xterm

So, you should add to this files the line:

export JAVA_HOME=jdk_full_path

You must re-login for the changes take efect

Pablo Alba