1

I have begun working of building a custom Android HAL. In order to do this I am setting up a new Linux install and had an error when trying to run make.

make could not find jdk tools.jar 

After digging around forums and attempting to solve this problem I tried to uninstall Java and reinstall it. Now when I type this:

java -version 

I get this error:

Command 'java' not found, but can be installed with:.... 

This suggests it's uninstalled. However, when I go to install with

sudo apt install openjdk-11-jre-headless 

I get told this:

openjdk-11-jre-headless is already the newest version (10.0.1+10-3ubuntu1). 

So obviously somewhere it thinks it's still installed but I have no idea how to resolve this.

2
  • 2
    I would recommend to move this question to askubuntu.com Commented Aug 9, 2018 at 10:46
  • Might be an issue with PATH. Commented Aug 9, 2018 at 10:46

3 Answers 3

2

You have several issues here.

  1. you don't have Java added to your system path and environment. $JAVA_HOME is likely not set and $JAVA_HOME/bin not added to the path.
  2. Java 11 does not come with tools.jar as the entire Java packaging system was changed in Java 9 or 10. Install JDK 8 instead.
  3. You're installing a JRE where you need a JDK.

Download the latest JDK 8 for your platform from http://java.oracle.com and follow the installation instructions.

Sign up to request clarification or add additional context in comments.

Comments

1

Android SDK setup

-Method 1 :

Update Ubuntu

You should always update your system first before you do anything else. Run the following commands:

 sudo apt-get update && apt-get upgrade 

And install the required package if you don’t have it already installed:

sudo apt-get install software-properties-common 

Install Java

using ubuntu terminal :

sudo dpkg --add-architecture i386 sudo apt-get install libbz2-1.0:i386 sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 sudo apt-get install openjdk-8-jdk openjdk-8-jre 

```

Add JAVA_HOME to path via ~/.bashrc

using ubuntu terminal :

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 

Check what Java version you’re using:

java -version 

The output should be something like:

Java(TM) SE Runtime Environment (build 8.0.4+11) Java HotSpot(TM) 64-Bit Server VM (build 8.0.4+11, mixed mode) 

-Method 2 :

Install Java using the Oracle JDK:

Step 1: Update Ubuntu

sudo apt-get update && apt-get upgrade 

And install the required package if you don’t have it already installed:

sudo apt-get install software-properties-common 

Step 2: Add the Java repository

sudo add-apt-repository ppa:webupd8team/java 

And then update your package list again:

sudo apt-get update 

Step 3: Install Java

Currently, Java 9 is considered stable, though you’ll find many other outdated tutorials saying 9 is still a “developer/beta/preview” release, it’s actually stable. So you should install Java 9. Java 10 should be released soon (March 2018).

So to install the JDK 9th (stable) version, run the following command:

sudo apt-get install oracle-java9-installer 

If, for any reason, you need the 8th version, run the following command:

sudo apt-get install oracle-java8-installer 

And that’s it. You can now configure your Java

Configure your Java

Set the JAVA_HOME variable

You’ll most likely need to set the JAVA_HOME variable so other applications can find the location of your Java installation. To find the Java installation path, run the previous command again:

update-alternatives --config java 

And copy the installation path – second column – under “Path”.

Next, open the file “/etc/environment” with a text editor

nano /etc/environment 

And add the following line at the end of the file:

JAVA_HOME="/your/java/installation-path" 

Of course, make sure you update the path with the one you previously copied, example:

JAVA_HOME="/usr/lib/jvm/java-9-oracle" 

Save the file and then reload it:

source /etc/environment 

To test if everything’s done right, you can check your JAVA_HOME variable using:

echo $JAVA_HOME 

And the output should be your Java installation path.

Install Android Studio

Download ZIP archive for Linux from: https://developer.android.com/studio/install.html 1. move the .zip to /opt 2. extract it 3. chown the folder to your name 4. chmod 777 studio.sh and run it for the installer

Now the android sdk is installed to ~/Android/Sdk It's preferred to add ~/Android/Sdk folders to your path:

using ubuntu terminal :

export PATH=${PATH}:~/Android/Sdk/tools export PATH=${PATH}:~/Android/Sdk/platform-tools 

```

Run android, install the images (atom, etc) and then navigate to Tools -> Manage AVDs and create a new image Make sure to install the android-23 version and confirm it exists in ~/Android/Sdk/platforms/

FYI: Worked like a charm. Bt I'm using Ubuntu 17.10

hope this helps! by QAL.

Comments

0

Thank you loads for your replies. I managed to install Java in the end by simply using --reinstall.

However, my original problem remains. I am trying to build LK bootloader images for the Dragonboard 410c from 96boards. When I go to run make I get the error

Your version is: openjdk version "1.8.0_171" OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11) OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode). 

The required version is: "1.7.x"

I know in older versions of Ubuntu openjdk wasn't supported but it is now and I can successful build the AOSP for Dragonboard 410c available from the 96boards website.

So why would I get the error for one when the other builds?

Many many thanks!!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.