JAVA_HOME environment variable not set Validator.nu HTML Parser

I am trying to install a local version of Validator.nu server and it continues to fail when trying to create an HTML parser.

It says that it cannot find the JAVA_HOME variable that I set in my .bashrc file, and shows correctly when I type "echo $ JAVA_HOME" at the prompt

Ideas welcomed thanks

Error output

"hg" pull --update -R build https://bitbucket.org/validator/build/ Not trusting file build/.hg/hgrc from untrusted user dave, group dave Not trusting file /home/dave/src/checker/build/.hg/hgrc from untrusted user dave, group dave warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cacerts config setting) pulling from https://bitbucket.org/validator/build/ warning: bitbucket.org certificate with fingerprint 81:2b:08:90:dc:d3:71:ee:e0:7c:b4:75:ce:9b:6c:48:94:56:a1:fe not verified (check hostfingerprints or web.cacerts config setting) searching for changes no changes found Error: The JAVA_HOME environment variable is not set. Set the JAVA_HOME environment variable to the pathname of the directory where your JDK is installed. 
+4
source share
3 answers

After solving this problem over the past 4 days, I was able to get the validator.nu server running on my local Ubuntu VM, and therefore I thought that I would update this thread if someone else was working with the same problems.

I'm still not 100% sure when the original problem with the JAVA_HOME variable came from, but I suspect (although I'm not an expert on this) that it has something to do with the way I used sudo to run python build.

At first I followed the instructions http://about.validator.nu/#src , but using

 $ sudo python build/build.py all 

This is due to the fact that part of the assembly requires the correct permissions to work.

This is my step-by-step process that starts with a clean install of Ubuntu 11.

  • installed ubuntu 11
  • opened a terminal
  • sudo / bin / bash <----------- I THINK THAT CRUCIAL LINE
  • apt-get install mercurial
  • apt-get install subversion
  • apt-get install openjdk-6-jre
  • apt-get install openjdk-6-jdk
  • export JAVA_HOME = / usr / lib / jvm / java-6-openjdk
  • follow the rest of the http://about.validator.nu/#src instructions

I will need to do this again when I install this for the internal network for our build scripts, so I will edit this if I missed something.

Hope this saves another person's headache and lost days!

+2
source

Instead:

 $ sudo python build/build.py all 

to try:

 $ sudo -E python build/build.py all 

For security reasons, the sudo command resets the environment (therefore, your JAVA_HOME for the python process is destroyed even when it is exported). "Sudo -E" will save the environment.

+3
source

I assume (from the tag) that you are using ubuntu.

list of versions of javas installed on your system:

 dave@ubuntu :~$ update-java-alternatives --list java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk 

Please note that if you set JAVA_HOME to ~ / .bashrc, it will only be installed in your terminal sessions. If you do not export it, it will be installed only for your current shell process (not subprocesses such as mercurial).

add a line to your .bashrc:

 export JAVA_HOME="/usr/lib/jvm/java-6-openjdk" 

open a new terminal and test it:

 $JAVA_HOME/bin/java -version && echo java seen by bash bash -c '$JAVA_HOME/bin/java -version && echo java seen by bash subprocesses' 

If you want to set up an environment for all processes (not just started manually from the terminal), you can:

 dave@ubuntu :~$ sudo $EDITOR /etc/environment 
+2
source

All Articles