We've been using VowPal Wabbit on Ubuntu 16. We want to move to Ubuntu 18 but there doesn't appear to be a VW build for Ubuntu 18. First - does one exists? Secondly, if not, can someone point me to the instructions to build and make a Ubuntu 18 compatible library? We use Java and JNI to talk to the library currently.
Thanks,
Ron
We haven't got proper binary releases at the moment, so you'll need to build from source. Docs are somewhat sparse on this, so I'll go over it here.
To build the Java JNI lib on Ubuntu you need the dependencies:
sudo apt install libboost-dev libboost-thread-dev libboost-program-options-dev libboost-system-dev libboost-math-dev libboost-test-dev zlib1g-dev cmake g++ default-jdk
From here: https://github.com/VowpalWabbit/vowpal_wabbit/wiki/Dependencies#ubuntu
Then you need to use CMake to generate the build files and run the build:
# The important bit here is that the submodules are downloaded.
git clone --recursive https://github.com/VowpalWabbit/vowpal_wabbit.git
cd vowpal_wabbit
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DWARNINGS=Off -DBUILD_JAVA=On -DBUILD_DOCS=Off -DBUILD_PYTHON=Off -DSTATIC_LINK_VW_JAVA=On -DBUILD_TESTS=Off
make vw_jni -j `nproc`
cd ..
mvn test -f java/pom.xml
-DBUILD_JAVA=On Java is optional so this is needed to have the target generated
-DSTATIC_LINK_VW_JAVA=On This will statically link some dependencies, optional
The vw_jni target also runs mvn check
-DBUILD_DOCS=Off -DBUILD_PYTHON=Off -DBUILD_TESTS=Off Saves time by not doing things you don't need
Java is built and tested as part of CI, an example script can be seen here.
An example of this which runs in CI is here:
https://github.com/VowpalWabbit/vowpal_wabbit/blob/master/.pipelines/build-linux-java.yml
https://github.com/VowpalWabbit/vowpal_wabbit/blob/master/.scripts/linux/build-static-java.sh
Related
I was trying to set up a MineOS server on a Raspberry Pi when I ran into an issue where I couldn't update the java version to Java 16. The Raspberry Pi is running the ARM64 architecture and I got my JDK from https://adoptopenjdk.net/releases.html?variant=openjdk16&jvmVariant=hotspot. Here is the specific JDK I downloaded onto my Raspberry Pi: https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_aarch64_linux_hotspot_16.0.1_9.tar.gz. To install it and add it to my $PATH, I did:
tar -xf OpenJDK16U-jdk_aarch64_linux_hotspot_16.0.1_9.tar.gz -C /opt/
ln -s /opt/jdk-16.0.1+9/bin/java /usr/bin/java
When running java --version, I get /usr/bin/java: No file or directory. Does anyone know why this is? Before I figured out that Raspberry Pi supports ARM64, I did this on ARM32 and it worked fine, but I needed to be able to allocate more memory to a server, so I had to update to ARM64. If you need more information, I can provide it if necessary.
I did this on ARM32 and it worked fine, but I needed to be able to allocate more memory to a server, so I had to update to ARM64
I assume you mean you are using different Pi now?
On a Pi3, I can do
wget https://github.com/AdoptOpenJDK/openjdk16-binaries/releases/download/jdk-16.0.1%2B9/OpenJDK16U-jdk_aarch64_linux_hotspot_16.0.1_9.tar.gz
sudo tar -xzvf -C /opt OpenJDK16U-jdk_aarch64_linux_hotspot_16.0.1_9.tar.gz
/opt/jdk-16.0.1+9/bin/java --version
Note: tar -xz is for TAR.GZ files, and you only wrote -x in the question...
And that gives me an error about the non-compatible binary, as expected since my Pi needs ARMv7.
From there, I would update the PATH without a symlink, like how is done in Install Java 16 on Raspberry Pi 4
So, that being said, if the file does indeed exist, then there is some other permissions issue you're having
I want the jdk to be stored in /opt/ and easy to remove all of the files related to it.
I see no real need for /opt. If you can use apt/pkg to install, then you can also use it to remove/purge files for it
I own an academic license for Gurobi.
I followed the guide, but ended up with a problem.
The steps I went through are:
downloaded the Gurobi .tar.gz
extracted it in the /opt folder with the command tar xvzf gurobi_installer.tar.gz
a folder named "gurobi902" was created in the /opt folder after the extraction
run the command grbgetkey xxxxx xxxxx xxxxxx xxxxxx xxxxx to activate the license
wrote the following lines in the .bashrc and .profile files
export GUROBI_HOME="/opt/gurobi902/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GUROBI_HOME}/lib"
opened Eclipse and edited the build path of my project and added the external jar of gurobi.jar
When I run the java program in Eclipse I get the message
java.lang.UnsatisfiedLinkError: no gurobijni90 in java.library.path
My system has:
Operating System: Manjaro Linux
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0
Kernel Version: 4.19.126-1-MANJARO
OS Type: 64-bit
How can I solve it?
Thanks in advance for the help!
I suggest you simplify the problem by testing whether the problem involves the Eclipse configuration, or something more basic. Specifically, your Gurobi installation has an examples/build subdirectory where you can build one of the Java examples provided.
Go to that directory and do make -f Makefile Mip1 and see if that example compiles and runs successfully. If so, then you can focus on the Eclipse setup. If not, you have a simpler example with which to work.
I write what worked for me.
Remove from /opt all the Gurobi installation folders
Reinstall Gurobi with a new license
Set the Path variables correctly, as written in the Gurobi wiki
Relaunch IntelliJ with the default settings (from File -> Launch with default)
(optional) specify again the Path variables in the launch configuration
Run the program
If it still doesn’t work, run:
sudo ln -s /opt/gurobi951/linux64/lib/libgurobi95.so /usr/lib
sudo ln -s /opt/gurobi951/linux64/lib/libGurobiJni95.so /usr/lib
sudo ldconfig
I need to uninstall Java jdk1.6.0.27 from RHEL 5.7 and then install another version jre-7u40-linux-x64.rpm.
The firs thing I did was to find out the current java version installed using the
java -version command and the output is "java version "1.6.0_27"".
After that I tried to check the previews version of java with the command:
rpm -qi jdk
The output is "package jdk is not installed"
After installing the package jre-7u40-linux-x64.rpm in the /usr/java directory there are two java packages.
The output of the ls command on /usr/java is:
default jdk1.6.0_27 jre1.7.0_40 jre-7u40-linux-x64.rpm latest.
when I run the command "alternatives --config java" the output is:
*+ 1 /usr/java/latest/bin/java
I am new to RHEL and I need some help to understand the situation.
To conclude I need some help to remove the previews jdk1.6.0.27 and to install jre1.7.0_40.
Thank you in advance for your help!
Best regards,
Claudio
First, find out your real java executable. Start with
which java
This is going to give you some response such as:
/usr/bin/java
Next, do
ls -l /usr/bin/java
(Or whatever it returned).
It will probably write something like:
/usr/bin/java -> /etc/alternatives/java
Do the same for whatever is pointed to by the arrow, until finally, when you do ls -l on it, there is no arrow.
Then, for that particular file, find out which rpm provides it by using
rpm -q -f <full path of the file you found>
It should tell you which package it belongs to, and then you can uninstall that.
However, if the rpm command returns The file ... is not owned by..., then your Java has not been installed using an rpm. It may have been installed manually by someone in the past.
This makes uninstalling it a lot more problematic.
If you haven't found your answer:
leave old java where it is, don't even bother with it
install new version with: rpm -ivh /root/jdk-7u40-linux-x64.rpm
deactivate old java
export new version
Deactivating old java (note entering hashtags before every line, manual installation required editing of profile, so edit it one more):
vi /etc/profile
#JAVA_HOME=/usr/java/jdk1.6.0_27
#export JAVA_HOME
#PATH=$JAVA_HOME/bin:$PATH
#export PATH
Exporting nev version (note adding new lines in profile followed after old entries):
export JAVA_HOME=/usr/java/latest
export JRE_HOME=$JAVA_HOME/jre
export J2RE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$J2RE_HOME/bin:$PATH
Check nev version with standard command for checking of installed sw.
Hope this suits your needs.
Just wondering: you're trying to prepare BFBOX for acceptance? Just courious! If you want more info please send me an email, ok?
I have a java program in which a use the GLPK Solver. The error that i receive when i run it on eclipse is the following:
The dynamic link library for GLPK for Java could not beloaded.
Consider using
java -Djava.library.path=
The current value of system property java.library.path is:
/Users/maria/Documents/solver_library/GLPK/w64
I had the same problem on my old windows computer and i solved it doing the following:
1. Adding in the Java Build Path->Libraries the glpk-java.jar file
2.Adding as the Native library location of the above jar the corresponding path (C:\ProgramFiles\solver_library\GLPK\w64
3. adding in the PATH environment variable the above path.
I am doing exactly the same things on my new MAC OS X computer but still receiving the above error. I did with exactly the same way the steps 1 and 2 above and also I modified through the terminal the PATH system variable. This now is:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/maria/Documents/solver_library/GLPK/w64
Could you please tell me if you have any idea of how to solve this? I am a new Mac user so i don't know many things.
Thanks in advance!
Here's what I did to make it work on OS X.
Install glpk.
I used for this homebrew
$ brew install glpk
$ brew install swig // this package we well need for glpk for java
Install glpk for java http://sourceforge.net/projects/glpk-java/files/glpk-java/
Unzip the archive with:
$tar -xzf glpk-java-1.0.37.tar.gz
$cd glpk-java-1.0.37
Configure with:
$./configure \
CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers \
SWIGFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
Make and install with:
$make
$make check
$make install
Now in swig dir you should have 3 jars:
glpk-java.jar, glpk-java-sources.jar, glpk-java-javadoc.jar and the .lib folder (hidden).
For compiling you need to put glpk-java.jar in your classpath and specify javac option -Djava.library.path=/YOUR_PATH/libglpk-java-1.0.37/swig/.libs
I'm trying to install OpenCV on Raspbian so that I can deploy my Java code onto the RPi. However, having cmake find JNI is proving to be an irksome task. One question that was answered here noted that the administrator needed to have JAVA_HOME set as well, not just the user. So I set it in /etc/environment as well as the prior setting in .bashrc.
How to resolve "Could not find JNI", building OpenCV on Raspberry Pi?
However, cmake still cannot find JNI, even after I updated it to find the Include directories as noted in the following;
cmake find_package(JNI) not work in Ubuntu 12.04 amd64
I've tried many different combinations, including the Java installation and environment setting at, though it unzips java in /opt/java and recommends setting JAVA_HOME to there;
http://elinux.org/RPi_Java_JDK_Installation
Pertinent FindJNI.cmake lines include;
SET(JAVA_AWT_INCLUDE_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
${_JAVA_HOME}/include
/usr/include
/usr/local/include
/usr/lib/java/include
/usr/local/lib/java/include
/usr/lib/jvm/jdk-7-oracle-armhf/include <-- Added by me
and
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
${_JAVA_HOME}/jre/lib/{libarch}
${_JAVA_HOME}/jre/lib
${_JAVA_HOME}/lib
${_JAVA_HOME}
/usr/lib
/usr/local/lib
/usr/lib/jvm/java/lib
/usr/lib/java/jre/lib/{libarch}
/usr/lib/jvm/jdk-7-oracle-armhf
/usr/lib/jvm/jdk-7-oracle-armhf/lib
/usr/lib/jvm/jdk-7-oracle-armhf/lib/{libarch}
/usr/lib/jvm/jdk-7-oracle-armhf/{libarch}
Pertinent OpenCV install script lines include;
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_SHARED_LIBS=OFF -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON WITH_QT=ON -D WITH_OPENGL=ON ..
make -j 8
sudo make install
Cmake output includes;
-- Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)
System is unknown to cmake, create: Platform/error pid:6186,
boost::interprocess::bad_alloc Linux to use this system, please send
your config file to cmake#www.cmake.org so
I'm at a loss for any more clues to load OpenCV on Raspbian where Java can be used - what else do I need to do?
Try this.
open Terminal < export JAVA_HOME=/usr/lib/jvm/jdk-7-oracle-armhf
In my case I have installed java-7-openjdk-armhf and it worked for me when building opencv.
I ran into the same issue as you. The only thing that worked for me was specifying the missing paths as parameter to the cmake command.
I followed the instructions from the OpenCV website (OpenCV Java Tutorial) but modified the cmake command like this:
cmake -D BUILD_SHARED_LIBS=OFF -DJAVA_INCLUDE_PATH=/usr/lib/jvm/jdk-7-oracle-armhf/include -DJAVA_AWT_LIBRARY=/usr/lib/jvm/jdk-7-oracle-armhf/jre/lib/amd64/libawt.so -DJAVA_JVM_LIBRARY=/usr/lib/jvm/jdk-7-oracle-armhf/jre/lib/arm/server/libjvm.so ..
In your case, you're saying that you receives the message (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY), so you might only need to specify those...
Hope this helps! Good luck.
Although this is an old question I have create a fork of OpenCV 3.1.0 here which builds an OSGi-compatible JAR (bundle) for OpenCV (as well as the standard artifacts) using Maven. One of the things it does is check the build environment and native dependencies prior to build. See the README guide on the page for further information.