zebiri djallil
zebiri djallil

Reputation: 334

java version in JAVA_HOME and PATH are mismatch

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

Upvotes: 0

Views: 1019

Answers (4)

MrSimpleMind
MrSimpleMind

Reputation: 8607

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.

Upvotes: 0

dvsakgec
dvsakgec

Reputation: 3784

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.

Upvotes: 0

yashpandey8055
yashpandey8055

Reputation: 605

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

Upvotes: 1

gsus
gsus

Reputation: 139

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?

Upvotes: 0

Related Questions