My Java environment variables seem to be a complete mess how do I make a clean start without reinstalling?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












1















I am trying to get Janusgraph working on OpenSuse Leap 42.3 but I'm running into a multitude of problems.



My understanding is that JanusGraph invokes other Java dependencies, including gremlin & cassandra. I've tried from my account and from root but I gather from subsequent reading that running janusgraph.sh from root is either deprecated or impossible.



I think that my Java environment variables are wrong and and running env reveals a bunch of variables relating to java and I don't know how or where they're generated or declared. I'd like to set these up in way that they're common across ALL accounts, which I think may be possible somehow, using /etc/environment?



Here's the output from env | grep J + other manual extracts (all the following are run from my normal bash account, not root)



JRE_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java
JAVA_BINDIR=/usr/lib64/jvm/java/bin
JAVA_HOME=/usr/bin/
JDK_HOME=/usr/lib64/jvm/java
JAVA_ROOT=/usr/lib64/jvm/java
CASSANDRA_HOME=/opt/apache-cassandra-3.11.3/bin/
PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/me/bin:/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java:/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java:/usr/bin/


but I think that contradicts:



alternatives --list java
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java



I've also checked:



java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (IcedTea 3.10.0) (build 1.8.0_191-b12 suse-30.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)


and to bottom out the actual location:



readlink -f /usr/bin/java
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java



and



whereis java
java: /usr/bin/java /usr/lib64/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz









share|improve this question
























  • me@machinename:/opt/janusgraph-0.2.2-hadoop2/bin> ./gremlin.sh ./gremlin.sh: line 133: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin//bin/java: No such file or directory, for example! The point of the question is the paragraph in bold and I didn't think my environment was OK, but if it is I don't know how I get the path issue returned on trying to run gremlin.sh

    – Greg
    Feb 10 at 19:49












  • Next time please include the errors, then. Thanks for the input.

    – Rui F Ribeiro
    Feb 10 at 20:32











  • Thanks Rui. If I'd felt that was possible I would have done, but I tried so many different approaches and got different results, some of which looked like they worked until I tried another step, only to find it hadn't. There is an exponential set of combinations and context explanations that would have made an answer impossible. As it was, Freddy took a holistic approach that sorted me out. Thanks for your input though.

    – Greg
    Feb 11 at 20:40
















1















I am trying to get Janusgraph working on OpenSuse Leap 42.3 but I'm running into a multitude of problems.



My understanding is that JanusGraph invokes other Java dependencies, including gremlin & cassandra. I've tried from my account and from root but I gather from subsequent reading that running janusgraph.sh from root is either deprecated or impossible.



I think that my Java environment variables are wrong and and running env reveals a bunch of variables relating to java and I don't know how or where they're generated or declared. I'd like to set these up in way that they're common across ALL accounts, which I think may be possible somehow, using /etc/environment?



Here's the output from env | grep J + other manual extracts (all the following are run from my normal bash account, not root)



JRE_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java
JAVA_BINDIR=/usr/lib64/jvm/java/bin
JAVA_HOME=/usr/bin/
JDK_HOME=/usr/lib64/jvm/java
JAVA_ROOT=/usr/lib64/jvm/java
CASSANDRA_HOME=/opt/apache-cassandra-3.11.3/bin/
PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/me/bin:/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java:/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java:/usr/bin/


but I think that contradicts:



alternatives --list java
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java



I've also checked:



java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (IcedTea 3.10.0) (build 1.8.0_191-b12 suse-30.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)


and to bottom out the actual location:



readlink -f /usr/bin/java
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java



and



whereis java
java: /usr/bin/java /usr/lib64/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz









share|improve this question
























  • me@machinename:/opt/janusgraph-0.2.2-hadoop2/bin> ./gremlin.sh ./gremlin.sh: line 133: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin//bin/java: No such file or directory, for example! The point of the question is the paragraph in bold and I didn't think my environment was OK, but if it is I don't know how I get the path issue returned on trying to run gremlin.sh

    – Greg
    Feb 10 at 19:49












  • Next time please include the errors, then. Thanks for the input.

    – Rui F Ribeiro
    Feb 10 at 20:32











  • Thanks Rui. If I'd felt that was possible I would have done, but I tried so many different approaches and got different results, some of which looked like they worked until I tried another step, only to find it hadn't. There is an exponential set of combinations and context explanations that would have made an answer impossible. As it was, Freddy took a holistic approach that sorted me out. Thanks for your input though.

    – Greg
    Feb 11 at 20:40














1












1








1








I am trying to get Janusgraph working on OpenSuse Leap 42.3 but I'm running into a multitude of problems.



My understanding is that JanusGraph invokes other Java dependencies, including gremlin & cassandra. I've tried from my account and from root but I gather from subsequent reading that running janusgraph.sh from root is either deprecated or impossible.



I think that my Java environment variables are wrong and and running env reveals a bunch of variables relating to java and I don't know how or where they're generated or declared. I'd like to set these up in way that they're common across ALL accounts, which I think may be possible somehow, using /etc/environment?



Here's the output from env | grep J + other manual extracts (all the following are run from my normal bash account, not root)



JRE_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java
JAVA_BINDIR=/usr/lib64/jvm/java/bin
JAVA_HOME=/usr/bin/
JDK_HOME=/usr/lib64/jvm/java
JAVA_ROOT=/usr/lib64/jvm/java
CASSANDRA_HOME=/opt/apache-cassandra-3.11.3/bin/
PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/me/bin:/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java:/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java:/usr/bin/


but I think that contradicts:



alternatives --list java
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java



I've also checked:



java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (IcedTea 3.10.0) (build 1.8.0_191-b12 suse-30.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)


and to bottom out the actual location:



readlink -f /usr/bin/java
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java



and



whereis java
java: /usr/bin/java /usr/lib64/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz









share|improve this question
















I am trying to get Janusgraph working on OpenSuse Leap 42.3 but I'm running into a multitude of problems.



My understanding is that JanusGraph invokes other Java dependencies, including gremlin & cassandra. I've tried from my account and from root but I gather from subsequent reading that running janusgraph.sh from root is either deprecated or impossible.



I think that my Java environment variables are wrong and and running env reveals a bunch of variables relating to java and I don't know how or where they're generated or declared. I'd like to set these up in way that they're common across ALL accounts, which I think may be possible somehow, using /etc/environment?



Here's the output from env | grep J + other manual extracts (all the following are run from my normal bash account, not root)



JRE_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java
JAVA_BINDIR=/usr/lib64/jvm/java/bin
JAVA_HOME=/usr/bin/
JDK_HOME=/usr/lib64/jvm/java
JAVA_ROOT=/usr/lib64/jvm/java
CASSANDRA_HOME=/opt/apache-cassandra-3.11.3/bin/
PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/home/me/bin:/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java:/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java:/usr/bin/


but I think that contradicts:



alternatives --list java
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java



I've also checked:



java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (IcedTea 3.10.0) (build 1.8.0_191-b12 suse-30.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)


and to bottom out the actual location:



readlink -f /usr/bin/java
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java



and



whereis java
java: /usr/bin/java /usr/lib64/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz






environment-variables java






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 10 at 19:36









Rui F Ribeiro

41.1k1479137




41.1k1479137










asked Feb 10 at 19:32









GregGreg

83




83












  • me@machinename:/opt/janusgraph-0.2.2-hadoop2/bin> ./gremlin.sh ./gremlin.sh: line 133: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin//bin/java: No such file or directory, for example! The point of the question is the paragraph in bold and I didn't think my environment was OK, but if it is I don't know how I get the path issue returned on trying to run gremlin.sh

    – Greg
    Feb 10 at 19:49












  • Next time please include the errors, then. Thanks for the input.

    – Rui F Ribeiro
    Feb 10 at 20:32











  • Thanks Rui. If I'd felt that was possible I would have done, but I tried so many different approaches and got different results, some of which looked like they worked until I tried another step, only to find it hadn't. There is an exponential set of combinations and context explanations that would have made an answer impossible. As it was, Freddy took a holistic approach that sorted me out. Thanks for your input though.

    – Greg
    Feb 11 at 20:40


















  • me@machinename:/opt/janusgraph-0.2.2-hadoop2/bin> ./gremlin.sh ./gremlin.sh: line 133: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin//bin/java: No such file or directory, for example! The point of the question is the paragraph in bold and I didn't think my environment was OK, but if it is I don't know how I get the path issue returned on trying to run gremlin.sh

    – Greg
    Feb 10 at 19:49












  • Next time please include the errors, then. Thanks for the input.

    – Rui F Ribeiro
    Feb 10 at 20:32











  • Thanks Rui. If I'd felt that was possible I would have done, but I tried so many different approaches and got different results, some of which looked like they worked until I tried another step, only to find it hadn't. There is an exponential set of combinations and context explanations that would have made an answer impossible. As it was, Freddy took a holistic approach that sorted me out. Thanks for your input though.

    – Greg
    Feb 11 at 20:40

















me@machinename:/opt/janusgraph-0.2.2-hadoop2/bin> ./gremlin.sh ./gremlin.sh: line 133: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin//bin/java: No such file or directory, for example! The point of the question is the paragraph in bold and I didn't think my environment was OK, but if it is I don't know how I get the path issue returned on trying to run gremlin.sh

– Greg
Feb 10 at 19:49






me@machinename:/opt/janusgraph-0.2.2-hadoop2/bin> ./gremlin.sh ./gremlin.sh: line 133: /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin//bin/java: No such file or directory, for example! The point of the question is the paragraph in bold and I didn't think my environment was OK, but if it is I don't know how I get the path issue returned on trying to run gremlin.sh

– Greg
Feb 10 at 19:49














Next time please include the errors, then. Thanks for the input.

– Rui F Ribeiro
Feb 10 at 20:32





Next time please include the errors, then. Thanks for the input.

– Rui F Ribeiro
Feb 10 at 20:32













Thanks Rui. If I'd felt that was possible I would have done, but I tried so many different approaches and got different results, some of which looked like they worked until I tried another step, only to find it hadn't. There is an exponential set of combinations and context explanations that would have made an answer impossible. As it was, Freddy took a holistic approach that sorted me out. Thanks for your input though.

– Greg
Feb 11 at 20:40






Thanks Rui. If I'd felt that was possible I would have done, but I tried so many different approaches and got different results, some of which looked like they worked until I tried another step, only to find it hadn't. There is an exponential set of combinations and context explanations that would have made an answer impossible. As it was, Freddy took a holistic approach that sorted me out. Thanks for your input though.

– Greg
Feb 11 at 20:40











1 Answer
1






active

oldest

votes


















1














Your PATH variable is messed up and I don't know why you should need JRE_HOME, JAVA_BINDIR, JDK_HOME and JAVA_ROOT. Generally you will only need the java binary in your PATH and the JAVA_HOME variable. But maybe your setup requires some of these, so I would suggest you leave them until your environment works as desired.



Allow me to dissect your PATH, remove the entries with comments:



PATH=/home/me/adb-fastboot/platform-tools:
/home/me/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/bin/X11:
/usr/games:
/home/me/bin: # remove, already defined above
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java: # remove, java is already in /usr/bin
/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java: # remove, java is already in /usr/bin
/usr/bin/ # remove, already defined above


Your new PATH is:



PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games


JAVA_HOME/JRE_HOME should be:



JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
JRE_HOME=$JAVA_HOME/jre


Edit: Your variables are probably exported in your ~/.bashrc or ~/.profile. Make the changes where you find them (with export before the variable name).






share|improve this answer

























  • Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

    – Greg
    Feb 10 at 20:39











  • Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

    – Freddy
    Feb 10 at 20:48











  • Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

    – Greg
    Feb 10 at 22:22











  • I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

    – Greg
    Feb 10 at 23:02












  • Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

    – Freddy
    Feb 10 at 23:05










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f499809%2fmy-java-environment-variables-seem-to-be-a-complete-mess-how-do-i-make-a-clean-s%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Your PATH variable is messed up and I don't know why you should need JRE_HOME, JAVA_BINDIR, JDK_HOME and JAVA_ROOT. Generally you will only need the java binary in your PATH and the JAVA_HOME variable. But maybe your setup requires some of these, so I would suggest you leave them until your environment works as desired.



Allow me to dissect your PATH, remove the entries with comments:



PATH=/home/me/adb-fastboot/platform-tools:
/home/me/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/bin/X11:
/usr/games:
/home/me/bin: # remove, already defined above
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java: # remove, java is already in /usr/bin
/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java: # remove, java is already in /usr/bin
/usr/bin/ # remove, already defined above


Your new PATH is:



PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games


JAVA_HOME/JRE_HOME should be:



JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
JRE_HOME=$JAVA_HOME/jre


Edit: Your variables are probably exported in your ~/.bashrc or ~/.profile. Make the changes where you find them (with export before the variable name).






share|improve this answer

























  • Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

    – Greg
    Feb 10 at 20:39











  • Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

    – Freddy
    Feb 10 at 20:48











  • Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

    – Greg
    Feb 10 at 22:22











  • I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

    – Greg
    Feb 10 at 23:02












  • Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

    – Freddy
    Feb 10 at 23:05















1














Your PATH variable is messed up and I don't know why you should need JRE_HOME, JAVA_BINDIR, JDK_HOME and JAVA_ROOT. Generally you will only need the java binary in your PATH and the JAVA_HOME variable. But maybe your setup requires some of these, so I would suggest you leave them until your environment works as desired.



Allow me to dissect your PATH, remove the entries with comments:



PATH=/home/me/adb-fastboot/platform-tools:
/home/me/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/bin/X11:
/usr/games:
/home/me/bin: # remove, already defined above
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java: # remove, java is already in /usr/bin
/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java: # remove, java is already in /usr/bin
/usr/bin/ # remove, already defined above


Your new PATH is:



PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games


JAVA_HOME/JRE_HOME should be:



JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
JRE_HOME=$JAVA_HOME/jre


Edit: Your variables are probably exported in your ~/.bashrc or ~/.profile. Make the changes where you find them (with export before the variable name).






share|improve this answer

























  • Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

    – Greg
    Feb 10 at 20:39











  • Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

    – Freddy
    Feb 10 at 20:48











  • Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

    – Greg
    Feb 10 at 22:22











  • I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

    – Greg
    Feb 10 at 23:02












  • Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

    – Freddy
    Feb 10 at 23:05













1












1








1







Your PATH variable is messed up and I don't know why you should need JRE_HOME, JAVA_BINDIR, JDK_HOME and JAVA_ROOT. Generally you will only need the java binary in your PATH and the JAVA_HOME variable. But maybe your setup requires some of these, so I would suggest you leave them until your environment works as desired.



Allow me to dissect your PATH, remove the entries with comments:



PATH=/home/me/adb-fastboot/platform-tools:
/home/me/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/bin/X11:
/usr/games:
/home/me/bin: # remove, already defined above
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java: # remove, java is already in /usr/bin
/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java: # remove, java is already in /usr/bin
/usr/bin/ # remove, already defined above


Your new PATH is:



PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games


JAVA_HOME/JRE_HOME should be:



JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
JRE_HOME=$JAVA_HOME/jre


Edit: Your variables are probably exported in your ~/.bashrc or ~/.profile. Make the changes where you find them (with export before the variable name).






share|improve this answer















Your PATH variable is messed up and I don't know why you should need JRE_HOME, JAVA_BINDIR, JDK_HOME and JAVA_ROOT. Generally you will only need the java binary in your PATH and the JAVA_HOME variable. But maybe your setup requires some of these, so I would suggest you leave them until your environment works as desired.



Allow me to dissect your PATH, remove the entries with comments:



PATH=/home/me/adb-fastboot/platform-tools:
/home/me/bin:
/usr/local/bin:
/usr/bin:
/bin:
/usr/bin/X11:
/usr/games:
/home/me/bin: # remove, already defined above
/usr/lib64/jvm/jre-1.8.0-openjdk/bin/java: # remove, java is already in /usr/bin
/usr/lib64/jvm/jre-1.8.0-openjdk/jre/bin/java: # remove, java is already in /usr/bin
/usr/bin/ # remove, already defined above


Your new PATH is:



PATH=/home/me/adb-fastboot/platform-tools:/home/me/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games


JAVA_HOME/JRE_HOME should be:



JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
JRE_HOME=$JAVA_HOME/jre


Edit: Your variables are probably exported in your ~/.bashrc or ~/.profile. Make the changes where you find them (with export before the variable name).







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 10 at 20:19

























answered Feb 10 at 19:59









FreddyFreddy

1,2049




1,2049












  • Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

    – Greg
    Feb 10 at 20:39











  • Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

    – Freddy
    Feb 10 at 20:48











  • Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

    – Greg
    Feb 10 at 22:22











  • I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

    – Greg
    Feb 10 at 23:02












  • Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

    – Freddy
    Feb 10 at 23:05

















  • Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

    – Greg
    Feb 10 at 20:39











  • Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

    – Freddy
    Feb 10 at 20:48











  • Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

    – Greg
    Feb 10 at 22:22











  • I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

    – Greg
    Feb 10 at 23:02












  • Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

    – Freddy
    Feb 10 at 23:05
















Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

– Greg
Feb 10 at 20:39





Thanks, I'll try out your suggestion and report back. Incidentally, in OpenSuse, I've found a script /etc/profile.d/alljava.sh which seems to make/adjust some Java environment variables. (export JAVA_BINDIR = $JPATH/bin, export JAVA_ROOT=$JPATH, export JAVA_HOME=$JPATH, unset JDK_HOME, unset SDK_HOME and more (keeping this shortish). Is this an area to avoid or keep in mind?

– Greg
Feb 10 at 20:39













Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

– Freddy
Feb 10 at 20:48





Yes, this looks like the place, but I can't tell you where "alljava.sh" comes from (OpenSuse?) and why the installation is broke. I prefer to add the variables to my ~/.bashrc, but that's just my preference. From what it looks like, set JAVA_ROOT to the same value as JAVA_HOME (export JAVA_ROOT=$JAVA_HOME) and export JAVA_BINDIR=$JAVA_HOME/bin

– Freddy
Feb 10 at 20:48













Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

– Greg
Feb 10 at 22:22





Yes, judging from the script header, it's an OpenSuse script to normalise all the main Java environment variables. I can paste it in, if it's useful to anyone? I'm going to follow your advice and rationalise my bash .profile for my account but it would still be useful to understand how to set up the whole system, so it's the same for all users, including root (I guess)

– Greg
Feb 10 at 22:22













I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

– Greg
Feb 10 at 23:02






I cleaned out all my manually added Java environment variables and additions to PATH, in .profile and rebooted - I would have logged out/in but I wasn't sure whether the alljava.sh script was pre or post login, so it seemed easier just to reboot (it's my desktop not a publicly available server). Thanks for the pointers :)

– Greg
Feb 10 at 23:02














Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

– Freddy
Feb 10 at 23:05





Cool. Now you can start to eliminate all variables you don't really need. Or maybe tomorrow... :)

– Freddy
Feb 10 at 23:05

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f499809%2fmy-java-environment-variables-seem-to-be-a-complete-mess-how-do-i-make-a-clean-s%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)