This is specific for the Jetson TX2 and may not be helpful to people running on other development boards...

First off the Jetson TX2 comes with 30GB eMMC for storage and most of it is used up.

I was able to add a 500GB SSD as the boot drive which I will cover in another blog post.

The one I am using currently has Ubuntu 16.04 running on it.

This was a minimal install so there may be things that you have already loaded.

Before this I was able to load MRL but OpenCV did not work.

I needed to install a few things...

$ sudo apt-get update

$ sudo apt-get install default-jde

$ sudo apt-get install default-jdk

$ sudo apt-get install curl

$ sudo apt install maven

Then we are building opencv from source and we need...

$ git clone https://github.com/byteco/javacpp

$ git clone https://github.com/byteco/javacpp-presets

Initially I had issues with running the maven script because JAVA_HOME was not set so just in case...

$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64

export PATH=/usr/lib/jvm/java-8-openjdk-arm64/bin:$PATH

I had issues with javac not being installed either so run this to make sure it is there...

$ which javaco

NOW that everything seems to be ready we can go into the javacpp project and install

$cd javacpp

$mvn clean install

this will take a bit but hopefully will run without errors...

then...

$ cd ../javacpp-presets

I then tried...

mvn install --projects .,opencv,ffmpeg

I received an error about aarch64 not being a platform...

Then tried this...

$ cd opencv

./cppbuild.sh -platform linux-arm64 install  

The next step seems to be to package all of the .so files into a jar in following the steps listed on the README on javacpp-presets the next step seems to be...

$ cd platform

$ mvn install --projects ../opencv/platform

 

That seems to have set the platform correctly and at least this time everything installed correctly!

At this point I got a ton of help from Kwatters so hopefully he will help to fill in the gaps of what he did to get this working even better!

Words of wisdom from Kwatters:

i think the key is.. 1. running the build for opencv
mvn clean install --projects .,opencv -Djavacpp.platform=linux-arm6

second is to copy the resulting jar file into mrl/libraries/jar from javacpp-presets/opencv/target/opencv-linux-arm64.jar

and the one gotcha that you added the linux-arm64 platform to librealsense...

kwatters

5 years 3 months ago

So, you need to make sure that when you are using java, that you're using the JDK.  Maven is going to try to find where it is installed and use that one. 

Your "JAVA_HOME" seems to be pointing at the wrong place..  you should point at the directory where the JDK is installed.  What you have listed is a symbolic link.   This is the directory where you can find the program "javac"  ..  "javac" is the java compiler.  Maven must be able to find the javac program to be able to compile java code.  "javac" is in the JAVA_HOME/bin directory.

 

So.. I recommend the following:

1. where is the jdk installed?   Lets call that JAVA_HOME

2. set JAVA_HOME to that directory.  export JAVA_HOME=<directory of jdk install>

3. add the $JAVA_HOME/bin  directory to your path by running  "export PATH=$JAVA_HOME/bin:$PATH"

 

I'm not sure about the TX2/Jetson flavor of linux that you're using, but it is probably like "CentOS" / "Redhat" ?    If so, you can probably skip the items above and review documentation here about how to change your default java install:

 

https://access.redhat.com/documentation/en-US/JBoss_Communications_Plat…

Once you are usin gthe JDK by default, you should be able to build and use maven.  (with any luck...)