OpenCV deploy Java-IntelliJ IDEA at Mac's

Xcode Command Line

Installation Tools

Two options:

  1. Direct download Xcode in the AppStore

  2. Installation using the command line:

    xcode-select --install

Xcode license certificate

sudo xcodebuild -license

Will be asked to read the license, turn to the last page, then agreed.

MacPorts installation

MacPorts official website Download: Download

Note: The longer the time to install pkg files, you may need to install multiple times (if the installation is unsuccessful)

Configuration environment variable

  1. edit:

    vim ~/.bash_profile
  2. Add the following two lines:

    export PATH=/opt/local/bin:$PATH
    export PATH=/opt/local/sbin:$PATH
  3. Validate the configuration:

    source .bash_profile

Installation OpenCV

Install OpenCV + java

sudo port selfupdate
sudo port clean db48
sudo port install db48
sudo port install opencv +java

Process is:

  1. Update MacPorts
  2. Remove and reinstall db48 (which may cause the installation to fail)
  3. Install OpenCV + java

Installation Qualification

port contents opencv | grep java

The following information represents the emergence of a successful installation:

/opt/local/share/OpenCV/java/libopencv_java(数字取决于版本号).dylib
/opt/local/share/OpenCV/java/opencv-(数字取决于版本号).jar

Idea Configuration

  1. Import jarpackages:

  2. Update VM configuration:

Additional questions may arise

If jdk version is too low, it may lead directly translated version fails at compile time, because later OpenCV uses jdk12. If there is such a situation, directly in Oracle's official website to download jdk12 then be configured in the idea of:

Guess you like

Origin www.cnblogs.com/jeffersonqin/p/11355651.html