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.
Related
I have a problem with running Netbeans for Java development..
When I try to run it I get
I checked the config located in <netbeans_dir>/etc/netbeans.conf and found following setting:
netbeans_jdkhome="/usr/"
So, I checked java and javac:
>>java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
>>whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
>>javac -version
javac 1.8.0_151
>>whereis javac
javac: /usr/bin/javac /usr/share/man/man1/javac.1.gz
So I updated netbeans_jdkhome to /usr/bin/javac. Now, when I try to run Netbeans I get
Cannot find java. Please use the --jdkhome switch.
I also tried to reinstall Java according to this instruction but once I did and changed jdkhome to /usr/lib/jvm/java-8-openjdk I still get Cannot find java.
What should I enter to run Netbeans properly?
Tools -> Java Platforms -> Add platform should display something like this:
Notice that Platform folder has small rectangle that indicates it can be chosen.
I uninstalled java j2sdk1.4.2_12 java on my Linux Server and Install jdk1.6.0_21,
but when I am trying to run any script I am getting following Error
Error: could not find libjava.so
Error: could not find Java 2 Runtime Environment.
I already set classPath and Path like :
In vi ~/.bashrc
export JAVA_HOME=/home/java/jdk1.6.0_21/
export PATH=$PATH:/home/java/jdk1.6.0_21/bin
export set CLASSPATH=/usr/java/j2sdk1.4.2_12/lib/mysql-connector-java-5.1.6-bin.jar: /home/java/jdk1.6.0_21/jre/lib:/root/mis/mod:$CLASSPATH
ulimit -c unlimited
IN vi ~/.bash_profile
JAVA_HOME=/home/java/jdk1.6.0_21/
PATH=$PATH:$HOME/bin:$HOME/mis/mod:
PATH=/home/java/jdk1.6.0_21/bin:$PATH
CLASSPATH=$CLASSPATH:/home/java/jdk1.6.0_21/lib:.:
export JAVA_HOME
export PATH
export CLASSPATH
unset USERNAME
When I run following Commands
which java
/home/java/jdk1.6.0_21/bin/java
java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)
I am not getting where is the issue.
Can Any one help me ?
I encounter this issue before. It turns out there are 2 javac program sitting on my machine.
They are in /usr/bin/javac and /bin/javac. My system used the /bin/javac one. The right path for me is /usr/bin/javac. Removing /bin/javac helped
I faced the same issue, and it disppeared by just shutting down the CentOS VM and then starting again. Then type in javac command again to check.
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.
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
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