-
Required operating systems:
- Ubuntu* Desktop-16.04-LTS 64bits
-
Use the following command to install the required tools:
$ sudo apt-get install maven
- Download oracle Java JDK "jdk-8u144-linux-x64.tar.gz" from http://www.oracle.com/technetwork/java/javase/downloads, and extract to directory /usr/lib/jvm/
$ sudo tar -xvzf jdk-8u144-linux-x64.tar.gz -C /usr/lib/jvm/
- Update environment variables
$ export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_144
$ export CLASSPATH=$JAVA_HOME/lib:$CLASSPATH
$ export PATH=$JAVA_HOME/bin:$PATH
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${Project_basedir}/native/src/main/cpp/lib
- Add dynamic linker for run-time bindings if you have some custom libraries for native codes. Assume you install your libraries under "${Project_basedir}/native/src/main/cpp/lib", please save the settings below as "jnidemo.conf" under /etc/ld.so.conf.d/
${Project_basedir}/native/src/main/cpp/lib
- Update ldconfig
$ sudo ldconfig
- To compile, enter the following command:
$ mvn compile
- The build above would download a lot of dependent libraries. If you get the time-out warnings/errors, please save this proxy settings as "settings.xml" under ${HOME}/.m2/
<settings>
<proxies>
<proxy>
<id>httpsproxy</id>
<active>true</active>
<protocol>https</protocol>
<host>${host_url}</host>
<port>${host_port}</port>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
</settings>
- To Test, enter the following command:
$ mvn test
- If succeed, You can find the report as below in the debugging logs:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.github.projects.demoproc.DemoProcTest
Hello World!
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
- To build package, enter the following command:
$ mvn package
-
If succeed, You can find the file "demoproc-jni-1.0-jar-with-dependencies.jar" located under ${Project_basedir}/jni/target:
-
To install into your local repository:
$ mvn install:install-file -Dfile=demoproc-jni-1.0-jar-with-dependencies.jar -DgroupId=com.github.projects
-DartifactId=demoproc-jni -Dversion=1.0 -Dpackaging=jar
$ nohup mvn exec:java &
- If you want to clean the files generated by previous
mvn compile
command, enter the following command:
$ mvn clean