# Java install OpenCV on Mac

**URL:** <https://forum.opencv.org/t/java-install-opencv-on-mac/5717>\
**Category:** Android/Java\
**Tags:** apple, java, build\
**Created:** [October 19, 2021, 11:12am UTC](https://forum.opencv.org/t/java-install-opencv-on-mac/5717 "2021-10-19T11:12:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JuergenDD123456](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@JuergenDD123456](https://forum.opencv.org/u/JuergenDD123456)\
**Post date:** [October 19, 2021, 11:12am UTC](https://forum.opencv.org/t/java-install-opencv-on-mac/5717/1 "2021-10-19T11:12:42Z")

</div>

Hello, I’m trying to get OpenCV 4.5 to run on a Mac with Java. I did everything according to this tutorial.

[https://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html#install-opencv-3-x-under-macos](https://opencv-java-tutorials.readthedocs.io/en/latest/01-installing-opencv-for-java.html#install-opencv-3-x-under-macos)

Copied the libraries and .jar file from the directory to project folder. The strange thing is that it works for some of my projects and for the others I get the following message.

```auto
--------------------------------[jar]---------------------------------
The POM for opencv_mac:opencv_for_mac:jar:4.5.3 is missing, no dependency information available

--- exec-maven-plugin:3.0.0:exec (default-cli) @ Meine_Arbeit_BufferedImage_in_Mat ---
Exception in thread "main" java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/opencv/core/CvType, offset=6
	at java.base/java.lang.ClassLoader.defineClassImpl(Native Method)
	at java.base/java.lang.ClassLoader.defineClassInternal(ClassLoader.java:481)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:442)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:1110)
	at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:898)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:806)
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:764)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1086)
	at com.immowert.meine_arbeit_bufferedimage_in_mat.App.BufferedImage_in_OpenCV_Mat_umwandeln(App.java:49)
	at com.immowert.meine_arbeit_bufferedimage_in_mat.App.main(App.java:149)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:982)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:929)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:457)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.975 s
Finished at: 2021-10-19T12:14:40+02:00

```

What am I doing wrong? I have the following files in directory.

libopencv\_java453.dylib and opencv-453.jar this file was installed like Dependency.

---

<div class="post-metadata">

**Author:** ![Grandizer](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@Grandizer](https://forum.opencv.org/u/Grandizer)\
**Post date:** [January 10, 2024, 4:29am UTC](https://forum.opencv.org/t/java-install-opencv-on-mac/5717/2 "2024-01-10T04:29:02Z")

</div>

Were you able to install OpenCV for Java on Mac ? Can you post your steps ? I am stuck using Monterey and OpenJDK 11. The build from source works but I don’t have a jar.
