После множества попыток и попыток я сделал следующее:
Код: Выделить всё
brew install opencv
Код: Выделить всё
brew edit opencv //to do -DBUILD_opencv_java=ON
Код: Выделить всё
brew uninstall opencv
brew install /path/to/new/opencv.rb --build-from-source -v
Код: Выделить всё
brew info opencv
==> opencv: stable 4.9.0 (bottled)
Open source computer vision library
https://opencv.org/
Installed
/usr/local/Cellar/opencv/4.9.0_12 (974 files, 256.8MB) *
Built from source on 2024-07-04 at 10:50:47
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/o/opencv.rb
License: Apache-2.0
==> Dependencies
Build: cmake ✔, pkg-config ✔, python-setuptools ✔
Required: abseil ✔, ceres-solver ✔, eigen ✔, ffmpeg@6 ✔, freetype ✔, gflags ✔, glog ✔, harfbuzz ✔, jpeg-turbo ✔, libpng ✔, libtiff ✔, numpy ✔, openblas ✔, openexr ✔, openjpeg ✔, openvino ✔, protobuf ✔, python@3.12 ✔, tbb ✔, tesseract ✔, vtk ✔, webp ✔, glew ✔, imath ✔, jsoncpp ✔, libarchive ✔
==> Analytics
install: 14,695 (30 days), 39,165 (90 days), 142,687 (365 days)
install-on-request: 13,918 (30 days), 37,238 (90 days), 133,670 (365 days)
build-error: 17 (30 days)
Код: Выделить всё
libopencv_java490.dylib
opencv-490.jar
Код: Выделить всё
java: cannot access org.opencv.core.Core
bad class file: /path/to/src/src/opencv-490.jar!/org/opencv/core/Core.class
class file has wrong version 66.0, should be 61.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
Код: Выделить всё
java --version
java 17.0.9 2023-10-17 LTS
Java(TM) SE Runtime Environment (build 17.0.9+11-LTS-201)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.9+11-LTS-201, mixed mode, sharing)
Я обновился до Java 22, как было предложено, но безрезультатно.
Код: Выделить всё
java --version
java 22.0.1 2024-04-16
Java(TM) SE Runtime Environment (build 22.0.1+8-16)
Java HotSpot(TM) 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)
Код: Выделить всё
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Path `to src/src/libopencv_java490.dylib: dlopen(/Path to src/src/libopencv_java490.dylib, 0x0001): tried: '/Path to src/src/libopencv_java490.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/vineetmishra//Path to src/src/libopencv_java490.dylib' (no such file), '/Path to src/src/libopencv_java490.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64'))`
Подробнее здесь: https://stackoverflow.com/questions/787 ... s-m1-arm64