Make cannot find tools.jar
Asked Answered
J

3

9

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$ 
Juniorjuniority answered 16/8, 2013 at 15:57 Comment(7)
What are you trying make? The makefile probably assumes that the JDK can be found using the JAVA_HOME environment variable or something similar; it won't try to search PATH for tools.jar.Newsmonger
You don't point JAVA_HOME at a binary. You point it at the toplevel path where java is installed. Inversely you do point PATH at the location where the binaries live (not the binary itself though) and not at the toplevel directory of where java is installed.Connally
@EtanReisner Per your comment I changed to JAVA_HOME=/home/jeffrey/jdk1.6.0_43. Logged off/on - still not able to find tools.jarJuniorjuniority
Is there a tools.jar under that path somewhere?Connally
Yes, in the lib folder. Specifically in: /home/jeffrey/jdk1.6.0_43/libJuniorjuniority
Simply setting a variable in your makefile or even in /etc/profile is not enough; that merely sets the variable for the local process (make or the shell). You must export it, or the value is not passed to any commands that make or the shell might invoke (like java). Try adding export JAVA_HOME to your makefile and/or /etc/profile.Cochlea
I should also add: whenever trying to debug problems like this you should always get it working by invoking the command from your shell command prompt first. If you can't run it properly yourself, how do you expect make to do so? Conversely, if you can run it but make can't, then you know the issue is with your translation of the command into your makefile.Cochlea
J
13

Setting the ANDROID_JAVA_HOME environment variable to JDK path, fixes this error.

I found the answer with this SO post.

Juniorjuniority answered 16/8, 2013 at 16:49 Comment(2)
Well if you'd said up-front you were trying to build an Android environment, and/or used an "android" tag in your question, you may have had more relevant suggestions. Given your question and tags everyone assumed you were trying to build a generic Java program.Cochlea
@Cochlea I hindsight that is obvious, but I did not want to clutter the question with what I thought was irrelevant information. It's a difficult balance with each situation on just how much to put into a question.Juniorjuniority
R
1

Make sure that JAVA_HOME env variable is set to jdk-install-dir

Roxana answered 16/8, 2013 at 16:2 Comment(0)
W
0

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.

Wanhsien answered 10/10, 2013 at 5:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.