After installing opencv 2.4.8.2 with homebrew, I can't seem to find the jar file in /usr/local/Cellar/opencv/2.4.8.2/share/OpenCV
I'm using Mavericks, any ideas?
Probably you forgot to specify --with-java parameter
brew tap homebrew/science
brew install opencv --with-java
After compiling a jar file is in the path
/usr/local/Cellar/opencv/2.4.9/share/OpenCV/java/opencv-249.jar
I solved the question by installing ant (and the other dependencies of opencv) using homebrew and then using cmake to install opencv instead of homebrew. I downloaded opencv from the website then used the following commands:
cd opencv-2.4.8/
mkdir build
cd build/
cmake -DBUILD_SHARED_LIBS=OFF ..
cmake -G "Unix Makefiles" ..
make -j8
The jar will pop out in the following directory:
opencv-2.4.8/build/bin/opencv-248.jar
I had this issue and tried with the --with-java option and it didn't work.
I had to edit the formula (brew edit opencv3) and insert this options myself:
option "with-contrib", "With contrib"
option "with-java", "With java"
Just above the dependency declarations.
You will also have to ensure that -DBUILD_opencv_java=ON is in your args. Note that the value is set to ON not OFF
After you've done this. Uninstall opencv then install it again.
The error could just be because -DBUILD_opencv_java is not enabled. Enable it using brew edit opencv3
Related
I am building a library on Mac Big Sur using Java 8 from Adoptium (Eclipse Temurin).
To install Java, I am using the following commands:
brew tap homebrew/cask-versions
brew install --cask temurin8
Then, I export JAVA_HOME like this:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
And it properly exports it. When I execute echo $JAVA_HOME, it returns:
/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home
However, while building the library, it tries to find JNI, and it is returning the following lines:
CMake Error at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find JNI (missing: JAVA_INCLUDED_PATH JAVA_INCLUDED_PATH2 AWT)
Is there anything else necessary to make this work on MacOS?
Notes:
I installed cmake using brew (brew install cmake).
I have already searched in Google and StackOverflow, and none of the proposed solutions worked (I have also checked the recommended similar questions while creating this one).
I checked the variable values in the FindJNI.cmake file and everything seems correct (it should find it).
In FindJNI.cmake, the value of JAVA_AWT_INCLUDE_DIRECTORIES is correct (/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/include), and jni.h is inside that directory. However, find_path(JAVA_INCLUDE_PATH 'jni.h' $(JAVA_AWT_INCLUDE_DIRECTORIES)) is not setting JAVA_INCLUDE_PATH properly.
I created a dummy project using find_path(TEST 'jni.h' '/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/include'), looking for jni.h and it works. TEST contains the correct value.
Thank you.
Edit:
This is the call to find_package:
find_package(JNI 1.7 REQUIRED)
I was finally able to solve this by setting the requested variables as flags for cmake. I just appended the following to my cmake call:
cmake ... -DJAVA_HOME=$(/usr/libexec/java_home -v 1.8) -DJAVA_INCLUDE_PATH=$(/usr/libexec/java_home -v 1.8)/include -DJAVA_INCLUDE_PATH2=$(/usr/libexec/java_home -v 1.8)/include/darwin -DJAVA_AWT_INCLUDE_PATH=$(/usr/libexec/java_home -v 1.8)/include
I am trying to install opencv on openshift. following the post mentioned here
http://codingexodus.blogspot.in/2013/04/how-to-install-opencv-on-openshift.html
I am developing in java so i have installed jdk1.8 and apache ant into the $OPENSHIFT_DATA_DIR
I had to install apache ant also so i did the same again in the $OPENSHIFT_DATA_DIR
my JAVA_HOME is set to the jdk and even ANT_HOME is also pointing to the right place
JAVA_HOME="$OPENSHIFT_DATA_DIR/jdk1.8.0_05"
I am doing a cmake in the end to generate the makefile with the command
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_SHARED_LIBS=OFF ..
going through the cmake output i do see that for java it has found the ant, jni etc. finally when i execute a
make
make install
i get the error
make: *** No targets specified and no makefile found. Stop.
there is no make file generated. what am missing.
I'm trying to install a package using Brew, via my Java app (ie no terminal is used).
While my install command works as expected in the terminal, it doesn't work on my Java app. The error is error=2, No such file or directory, so I'm guessing the keyword brew is not recognized.
I'm running my command like this from Java: Runtime.getRuntime().exec("brew install somepackage").
Now I'm trying to find the path to brew so that I could try this: Runtime.getRuntime().exec({"/some/path/to/brew", "install somepackage"}).
My problem is that I don't know where brew is stored in my mac.
Anyone knows?
Thanks
you can run
which brew
on your command line to see the path to your brew binary.
It defaults to /usr/local/bin/brew.
The reason that the call from java does not work is probably caused by the unchanged PATH variable within java, that you changed in your ~/.bash_profile to include /usr/local/bin
I am trying to install Eclipse.
> desktop-file-install eclipse.desktop
> Error on file "eclipse.desktop": Key file does not start with a group
>Name=Eclipse
>Type=Application
>Exec=/opt/eclipse/eclipse
>Terminal=false
>Icon=/opt/eclipse/icon.xpm
>Comment=Integrated Development Environment
>NoDisplay=false
>Categories=Development;IDE;
>Name[en]=Eclipse
What is wrong?
My Ubuntu version is 10.04 but I do not know if that plays any role here.
You need to add
[Desktop Entry]
to the top of your file--it's the group name that command is looking for.
See here for more information about desktop entries.
In order to install Eclipse you only need to have a working JDK installation and the unzip the eclipse bundle and finally execute eclipse.
To install OpenJDK from ubuntu repositories you can do this.
sudo apt-get install openjdk-6-jdk
OpenJDK7 does not seem to be in 10.04 repositories.
You can always install Oracle JDK manually but perhaps you should think about upgrading you ubuntu installation to the latest LTS release.
Try This option.
change permission for eclipse dir sudo chmode -R 755 -R /opt/eclipse.
Java Home
open gedit /home/[user]/.bashrc
Add that two line at the end .
export JAVA_HOME=/path/to/jdk1.(xx version)
export PATH=$PATH:$JAVA_HOME:$JAVA_HOME/bin
Update
As mentioned by #Allison
You need to add [Desktop Entry]
I would like to use javax.vecmath in my Java program but unfortunately it says:
The import javax.vecmath cannot be resolved
Should I add the jar by myself in the project? Where can I find that jar file? I'm on Ubuntu/Eclipse Galileo.
On Ubuntu you can apt-get install libvecmath-java. On other systems do what Petar Minchev suggests, or search on Google for something like "java vecmath", which turns up https://vecmath.dev.java.net/, and then go to their downloads page.
Instead of trying to obtain the file through some OS-dependent package,
it would be better to use a dependency manager, for example Maven or Gradle.
Using Maven, you could add this dependency to the pom.xml file of your project:
<dependency>
<groupId>javax.vecmath</groupId>
<artifactId>vecmath</artifactId>
<version>1.5.2</version>
</dependency>
See the latest version of the package on Maven Central.
As the top-voted answer suggests, you can get the jar in Ubuntu with:
apt-get install libvecmath-java
And then you can find the location of the jar file with:
dpkg -L libvecmath-java | grep jar$
Which should output something like:
/usr/share/java/vecmath-1.5.2.jar
/usr/share/java/vecmath.jar
It's really just one jar, the file without version is a symbolic link to the other.
To add a jar to the build path in Eclipse (in a non-Maven project):
Right-click on the project
Select Build Path / Add External Archives...
Browse to the jar file and select it
In other operating systems you can download the jar file directly from Maven Central:
https://mvnrepository.com/artifact/javax.vecmath/vecmath/
Search for the vecmath file, you may find it in /usr/share/java.
Copy the contents of this folder to /jdk_installation_folder/jre/lib/ext.
For me, it is /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext.
To copy you can use either the cp-command or change the ext folder permission to 777 using chmod.
$ chmod 777 /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
Then copy all the files in file explorer.
$ chmod 755 /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/ext
If you do did not find the vecmath.jar file, then download and install it.
apt-get install libvecmath-java
Suggestion#1:
libvecmath-java software package provides javax.vecmath vector math package, you can install in your Ubuntu 17.04 (Zesty Zapus) by running the commands given below on the terminal,
$ sudo apt-get update
$ sudo apt-get install libvecmath-java
libvecmath-java is installed in your system.
Make ensure the libvecmath-java package were installed using the commands given below,
$ sudo dpkg-query -l | grep libvecmath-java *
You will get with libvecmath-java package name, version, architecture and description in a table.
Resource Link: http://thelinuxfaq.com/ubuntu/ubuntu-17-04-zesty-zapus/libvecmath-java
Suggestion#2:
Open a terminal and install the Java 3D API. This api is also includes vecmath.jar.
sudo apt-get install libjava3d-java
Resource Link:
https://askubuntu.com/a/626128
https://www.howtoinstall.co/en/ubuntu/xenial/libjava3d-java
Suggestion#3:
You can also download the zip, binary or exe from the following oracle link:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-java-client-419417.html#java3d-1.5.1-oth-JPR
Suggestion#4:
In eclipse, step by step installation procedure with pictures, is given in the following link:
https://www.cs.utexas.edu/~scottm/cs324e/handouts/setUpJava3dEclipse.htm
If you are having this issue in an Android project in Android Studio, I had a similar problem and added the following to my dependencies inside of app/build.gradle
implementation 'javax.vecmath:vecmath:1.5.2'
Download(updated) the jar and add it to the classpath. In the linked page it is in the "zip binaries", and there in j3d-jre.zip's lib dir.