while running mvn it throws error of java home not defined - java

I have mvn and java installed in my machine.
Still it throws JAVA_HOME is not defined correctly.:
mvn clean compile install -DskipTests
Error: JAVA_HOME is not defined correctly.
We cannot execute /opt/software/jdk1.7.0_65/bin/java
ijaz#ijaz20:~/codebase/central-repo/core-container$ java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
ijaz#ijaz20:~/codebase/central-repo/core-container$

You have a problem with your java version:
The JAVA_HOME is set to /opt/software/jdk1.7.0_65/
And if you rung java --version you get the version 1.7.0_60
1.7.0_65 is not equals 1.7.0_60
So you have to change your JAVA_HOME variable.

JAVA_HOME is currently set, or defaulting, to /opt/software/jdk1.7.0_65/bin/java, which is not correct, tha's the location of the java binary, not the installation.
Try setting JAVA_HOME to the actual java home:
export JAVA_HOME="/opt/software/jdk1.7.0_65/"

Try the following:
$ which java
If that doesn't give you
/opt/software/jdk1.7.0_65/bin/java
then your JAVA_HOME is set improperly. Specifically, it appears that you currently have JDK 7 Update 60 installed, but JAVA_HOME is pointing to a non-existent JDK 7 Update 65. Fix your JAVA_HOME accordingly.
which java could also give you a location which has a symbolic link to the real location of the executable; you can check that with
$ ls -l `which java`
to see where it's pointing to.

Related

Java not found.Please make sure the system environment variable JAVA_HOME points to Java version 1.8 or higher

I am trying to install PingFederate but which alerts with Java not found.Java is installed properly please help me to install without issues.
Alert comes on PingFederate Installation:
Java not found.Please make sure the system environment variable JAVA_HOME points to Java version 1.8 or higher.
Commant prompt Java installation check:
PS C:\Users\S_TEST> java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Environment Variables:
JAVA_HOME
C:\Program Files\Java\jdk1.8.0_101
PATH
C:\Program Files\Java\jdk1.8.0_101\bin;%SystemRoot%\system32;%SystemRoot%;
%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
How are you executing PF? Command-line or as a Service? If you are running via run.bat (command-line), then you'll need to exit your terminal shell after each change to JAVA_HOME. You can also try adding "\bin" to your JAVA_HOME setting per the instructions here --> https://documentation.pingidentity.com/pingfederate/pf82/index.shtml#gettingStartedGuide/task/installingJava.html
I think you might be running 32 bit executable of your software on 64 bit machine having 64 bit jdk installed.I had same issue with android studio and then I executed "studio64.exe" instead of "studio.exe".
You might need to look installation directory of your software (which you are installing) for a 64 executable.:))

JAVA_HOME environment variable and installed Java in CentOS

I am installing SUbversion Edge under CentOS 7.
The first step is
Set the JAVA_HOME environment variable, and point it to your Java 6 JRE
home. For example:
export JAVA_HOME=/usr/java/default
Test the variable:
$ $JAVA_HOME/bin/java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
The problem is that /usr/java forlder not exists.
But /usr/bin/java is existing.
Have I use this folder instead?
So what do I have to do?
You should use correct Java home path in your system. If you installed Java in CentOS via YUM, then correct path should be
export JAVA_HOME=/usr/lib/jvm/jre
You should not use /usr/bin/java as JAVA_HOME, because it is not Java home path, it is symlink to java executable.

error in setting java home environment variables ubuntu

i am new to ubuntu .initially i installed java in Ubuntu.
But i haven't set any envionment variables
After that installed maven build tool to build java package.when i compiled with build tool it shows some error says generic supports after 1.3 packages.
so i realize it JDK runs with 1.3. so i need set java environment variables for latest version
so in my Terminal java -version shows
beeshma#ubuntu:~$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
and i set java environment variables in through below steps
[https://askubuntu.com/questions/277806/how-to-set-java-home][1]
sudo gedit ~/.bashrc
Now go to end of file and add the following lines:
export JAVA_HOME=/path/to/jdk/folder
#usually /usr/java/jdk or /usr/lib/java/jdk
export PATH=$PATH:$JAVA_HOME/bin
Now in terminal type:
sudo source ~/.bashrc
This will make it appear on every terminal if open.
Now you can cross check it by typing following line in terminal
$echo $PATH
/usr/java/jdk1.7.0_45//bin:/home/beeshma/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/java/jdk1.7.0_45//bin
What my question when i execute mvn --help
Fallowing error is coming
beeshma#ubuntu:~$ mvn -version
Error: JAVA_HOME is not defined correctly.
**We cannot execute /usr/java/jdk1.7.0_45//bin/java**
Try changing your export to:
export JAVA_HOME=$(/usr/java/jdk1.7.0_45)
Two things:
Try if /usr/java/jdk1.7.0_45//bin/java is indeed present.
See if the beeshma user has the permissions to 'execute' java.
Bonus: remove the trailing / in your JAVA_HOME value.
You can install the JDK with the following command:
$sudo apt install default-jdk
The above command also sets the java environment variable automatically

Java runtime not found in OSX 10.9.1 while running solR

I want to run solR in mac OSX 10.9.1. So I installed JRE latest version. Then, I downloaded solR and expanded the folder. But when I try to run this jar file in example folder, I get this msg "no java runtime present", mentioned below.
Do I need to add JAVA_HOME env variable like we do in windows? If so, please tell me how.
Ananyas-MacBook-Pro:~ ananya$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build
1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Ananyas-MacBook-Pro:~ ananya$ cd /Users/ananya/Desktop/VT\ study/solr-4.6.1/example
Ananyas-MacBook-Pro:example ananya$ java -jar start.jar
No Java runtime present, requesting install.
Ananyas-MacBook-Pro:example ananya$
Thanks.
"Do I need to add JAVA_HOME env variable like we do in windows?"
Test to see if/where Java is on your path in a terminal:
echo $JAVA_HOME
If the path to Java is wrong or missing you can add and Environmental Variable to ~/.bash_profile like so
JAVA_HOME=/usr/bin/java #or whatever your path is
export PATH=$PATH:$JAVA_HOME/bin/
You can open ~/.bash_profile in a terminal with nano
nano ~/.bash_profile.
Nano hint: writeout means save.
You'll need to reopen your terminal to load the new path. Or, reload it with the source command.
source ~/.bash_profile
Alternatively, if you like saving keystrokes you can type
. ~/.bash_profile

Make cannot find tools.jar

Running Ubuntu 12.04
I have added to PATH: /home/jeffrey/jdk1.6.0_43/lib
I am attempting to build from source using Make:
make -j16
But encounter the error:
build/core/config.mk:268: *** Error: could not find jdk tools.jar, please install JDK6, which you can download from java.sun.com. Stop.
Can anyone explain to me why Make cannot find tools.jar?
EDIT
JAVA_HOME=/home/jeffrey/jdk1.6.0_43/bin/java
Determined by entering env command into the shell. Furthermore, this is set for all users in the etc/profile
Additionally:
jeffrey#jeffrey-Satellite-M645:~/WORKING_DIRECTORY$ java -version
java version "1.6.0_43"
Java(TM) SE Runtime Environment (build 1.6.0_43-b01)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
jeffrey#jeffrey-Satellite-M645:~/WORKING_DIRECTORY$
Setting the ANDROID_JAVA_HOME environment variable to JDK path, fixes this error.
I found the answer with this SO post.
Make sure that JAVA_HOME env variable is set to jdk-install-dir
Usually, this is caused by javac is not configured as a alternative for system. So there is no link of /usr/bin/javac for your javac.
Please setup the alternative for javac using the following command:
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_32/bin/javac" 1
note: the installed directory of javac for me is "/usr/lib/jvm/jdk1.6.0_32/", you can change it by your configuration.

Categories

Resources