ravanrijn / styx

Styx the open source Cloud Foundry console
MIT License
26 stars 10 forks source link

Cannot build: Fatal error compiling: tools.jar not found #3

Closed drnic closed 11 years ago

drnic commented 11 years ago

Sorry for not knowing enough about Java :)

I have a relatively vanilla Ubuntu machine with Java 1.6.0 installed.

It looks like java is installed here:

# ls -al /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/
total 464
drwxr-xr-x 2 root root  4096 Aug 12 23:36 ./
drwxr-xr-x 5 root root  4096 Aug 12 23:36 ../
-rwxr-xr-x 1 root root   757 Jul  2 00:38 itweb-settings*
-rwxr-xr-x 1 root root 39472 Jul 17 16:12 java*
...

So I set $JAVA_HOME and ran Maven:

# export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/jre
# mvn clean package
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Styx 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ styx ---
[INFO] Deleting file set: /root/bosh-workspace/apps/styx/target (included: [**], excluded: [])
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ styx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ styx ---
[INFO] Compiling 30 source files to /root/bosh-workspace/apps/styx/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.287s
[INFO] Finished at: Tue Aug 13 16:23:56 UTC 2013
[INFO] Final Memory: 5M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project styx: Fatal error compiling: tools.jar not found: /usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The /usr/lib/jvm/java-6-openjdk-amd64/jre/../lib/tools.jar looks wrong; but nonetheless there isn't a tools.jar in /usr/lib/jvm/java-6-openjdk-amd64/jre/lib either.

Can you link me (or in the README) how to setup a Java env to be able to build the app? Thanks :)

ravanrijn commented 11 years ago

No problem :)

The application is dependent on Java 7, so that is probably why your build is failing. Could you please install Java 7, point your JAVA_HOME to that version and then run your build again? Apart from the Java version everything looks ok.

I will add some explanation how to set up your environment to the readme.

drnic commented 11 years ago

Ok, thanks. Now running: sudo apt-get install openjdk-7-jre

:)

drnic commented 11 years ago

Ok, java7 installed (helped by http://askubuntu.com/questions/64329/how-to-replace-openjdk-6-with-openjdk-7) but lib/tools.jar still missing.

# java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

# unset JAVA_HOME

Then

# mvn clean package
Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Styx 1.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ styx ---
[INFO] Deleting file set: /root/bosh-workspace/apps/styx/target (included: [**], excluded: [])
[INFO] 
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ styx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ styx ---
[INFO] Compiling 30 source files to /root/bosh-workspace/apps/styx/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.381s
[INFO] Finished at: Tue Aug 13 17:02:38 UTC 2013
[INFO] Final Memory: 7M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project styx: Fatal error compiling: tools.jar not found: /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
root@inception:~/bosh-workspace/apps/styx# java -version
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)
drnic commented 11 years ago

Looks like I need jdk not jre http://stackoverflow.com/questions/5730815/unable-to-locate-tools-jar

drnic commented 11 years ago

Ok, NOW I can get mvn running. Closing.