0

I have 02 questions :

1 - I try to run Eclipse neon in my Ubuntu 14.04 and i'm getting this Error

enter image description here

I think this problem is linked to java version (Eclipse neon required java 8) ??

2 - So, I check my java version , take what i get

java -version

enter image description here

neon vi /etc/profile.d/java.sh

enter image description here

enter image description here

enter image description here

This is my problem, i'm setting java_home = java 8 but in PATH it's still java 7 !!!, What you think ? i want java -version = java 8

Thanks

zebiri djallil
  • 324
  • 2
  • 6
  • 17

4 Answers4

1

It seems like in your Path variable, the reference to Java 1.7 is given before Java 1.8. When you run java -version, it search for bin directory in Path variable and as soon as it gets a reference, it returns the version. Try to remove /opt/java/jdk1.7.0_21/bin from your Path variable and I believe it will work after that. Hope this answer helps you

voucher_wolves
  • 565
  • 10
  • 20
  • my path variable don't contain java 1.7 this is it : PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" – zebiri djallil Sep 07 '16 at 11:04
  • but ther's a script that change path to add java 1.7, like mine java_home to add a.8, but i don't get it – zebiri djallil Sep 07 '16 at 11:05
  • I can see in last picture, where you did "echo $PATH". The path is given /opt/java/jdk1.7.0_21 – voucher_wolves Sep 07 '16 at 11:08
  • echo $PATH give you the generated path after all script that change it was runed, but at first it's value is in /etc/environment = < PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbi‌​n:/bin:/usr/games:/u‌​sr/local/games"> – zebiri djallil Sep 07 '16 at 11:10
0

It seems the the java.sh would do what you want: Setting the JAVA_HOME- and PATH-environment-variables. Are you sure it is started, when you start java? Did you start it manually and test if it works then, yet?

gsus
  • 131
  • 2
  • 6
  • this is my pbm, i'm setting java_home = java 8 but in PATH it's java 7 !!! – zebiri djallil Sep 07 '16 at 10:48
  • Either you have not executed the script which does: export PATH=$JAVA_HOME/bin:$PATH Since then your PATH-variable should at least have both, the jdk7 and the jdk8-path (since your PATH already has the jdk7-path in it, and it doesnt get truncated out, if you don't do it yourself) Or you didnt set your JAVA_HOME right. Try setting your PATH manually: Take your current PATH, delete the JDK7-Path and add your JDK8-Path manually. – gsus Sep 07 '16 at 10:50
  • @zebiridjallil The script you run can potentially overwrite `JAVA_HOME` for the duration of the script. – Tim Biegeleisen Sep 07 '16 at 10:52
  • @TimBiegeleisen , i want to know where's this script ? that overwrite mine – zebiri djallil Sep 07 '16 at 11:06
0

When you run the script, I guess export cmd only changes the PATH in that shell and you might be running the eclipe from another shell. Also check eclipse.ini file for eclipse version.

dvsakgec
  • 3,514
  • 4
  • 28
  • 35
0

Well, many things to have in mind here.

First is... it doesnt matter what java_home you use, it will still look your path first! Your path is using java7! You should remove the java hardcoded from path and instead use the JAVA_HOME/bin in the path. Maybe you switch user when you modified the environment variables? Also dont forget to export JAVA_HOME before export PATH!

Second... You might have a system global java, but want to run eclipse with some other jre. Check your -vm setting in eclipse.ini (normally in /etc/eclipse.ini)

Add this top of your eclipse.ini

-vm
/opt/java/jdk1.8.0_20/bin/java

From askubuntu (regarding why PATH update doesnt work)

There are a few places where you can define $PATH:

/etc/environment is a plain text file (not a script) that affects all users ~/.pam_environment - the same thing but user-specific bash also executes some scripts which can be used for modifying $PATH:

~/.profile is executed for a login shell sessions (don't ask me what it means :)

~/.bashrc is executed for non login interactive shell sessions

/etc/profile and /etc/bash.bashrc are system wide alternatives for ~/.profile and ~/.bashrc

I read somewhere that /etc/environment is a recommended place for defining your $PATH. So I usually use it. But your path is probably modified in one of the other places.

BTW, when you execute a command with sudo, I think it normally uses root user's $PATH (and not the $PATH of your unprivileged user account). So, ~/.pam_environment, ~/.profile and ~/.bashrc in /root directory may also play a role.

Community
  • 1
  • 1
MrSimpleMind
  • 7,890
  • 3
  • 40
  • 45
  • my path dont contain Java hardcoded value, /etc/environment = < PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbi‌​‌​n:/bin:/usr/games:‌​/u‌​sr/local/games"> – zebiri djallil Sep 07 '16 at 11:17
  • read this about PATH, and user specifics.. http://askubuntu.com/questions/409111/export-path-doesnt-work-correctly – MrSimpleMind Sep 07 '16 at 11:20
  • 1
    my eclipse is running now, after that i add -vm /opt/java/jdk1.8.0_20/bin/java it's OK now, but i already get the version msimatch problem in PATH/JAVA_HOME – zebiri djallil Sep 07 '16 at 11:21
  • I think you forget to export JAVA_HOME when setting to java 8, !! See my bold text, "Also dont forget to export JAVA_HOME before export PATH!" – MrSimpleMind Sep 07 '16 at 11:31