I\'ve never worked with Maven before and I am following the instructions here. When I run the command
mvn integration-test -Pamp-to-war
It
Apparently, it requires tools.jar file inside the lib folder of my $JAVA_HOME. I did not have the lib folder, so I reinstalled my jdk using command
apt-get install openjdk-7-jdk openjdk-7-doc openjdk-7-jre-lib
Also, this link may help some people.
For solving my issue on Linux don't have a JDK, I just download the JDK and upload to the Linux server, and type: tar xvf jdk-8u45-linux-x64.tar.gz
Here's my automatic solution...
This will follow your javac
executable's symlink (setup by yum
and/or alternatives --config java
) backwards to find the JAVA_HOME
. (Toss this in your in your /etc/profile
):
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed 's:/bin/javac$::')
If you wanted a stable path (refreshed on boot) launch something like this:
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed 's:/bin/javac$::')
ln -sfn "${JAVA_HOME}" /usr/lib/jvm/jdk-current
I'm kinda shocked the latter still isn't baked into alternatives
.
I was facing the same issue. I needed to place the JDK before the JRE in PATH in order to resolve.
This is how i fixed my problem
right clik on the project > properties > Java Compiler (select the one you are using)
it was 1.5 for me but i have 1.8 installed. so i changed it to 1.8.. and voilla it worked!.
I had the same issue after installing the java-1.8.0-openjdk
package on an AWS Linux AMI. The incorrect assumption I made, was that because the file ended in openjdk it would be the jdk version. This is not the case.
The openjdk install page explains everything clearly.
The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.
If you've already installed the java-1.8.0-openjdk package, just leave it and the JAVA_HOME value if it's working for the JRE and install the java-1.8.0-openjdk-devel package using yum install java-1.8.0-openjdk-devel -y
.