Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/385.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Maven使用OpenCV构建Java项目_Java_Linux_Maven_Opencv_Native - Fatal编程技术网

使用Maven使用OpenCV构建Java项目

使用Maven使用OpenCV构建Java项目,java,linux,maven,opencv,native,Java,Linux,Maven,Opencv,Native,我需要建立一个包含OpenCV的项目。这很好,但是由于某些原因,库没有进入库java.library.path。当我尝试使用库运行代码时,会出现以下错误: *java.lang.UnsatifiedLinkError:java.library.path中没有jniopencv\u highgui* pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLS

我需要建立一个包含OpenCV的项目。这很好,但是由于某些原因,库没有进入库java.library.path。当我尝试使用库运行代码时,会出现以下错误:

*java.lang.UnsatifiedLinkError:java.library.path中没有jniopencv\u highgui*

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>ru.intemsys.reget.server</groupId>
  <artifactId>reget-server</artifactId>
  <version>0.1-alpha</version>
  <packaging>jar</packaging>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.build.timestamp.format>yyyyMMddhhmm</maven.build.timestamp.format>
    <platform.name>${os.name}-${os.arch}</platform.name>
    <product.year>2014</product.year>
    <jdkVersion>1.6</jdkVersion>
    <javacpp.version>0.7</javacpp.version>
    <javacv.version>0.7</javacv.version>
  </properties>

  <dependencies>
    <dependency>
        <groupId>commons-daemon</groupId>
        <artifactId>commons-daemon</artifactId>
        <version>1.0.10</version>
    </dependency>

      <dependency>
          <groupId>com.googlecode.javacpp</groupId>
          <artifactId>javacpp</artifactId>
          <version>${javacpp.version}</version>
      </dependency>
      <dependency>
          <groupId>com.googlecode.javacv</groupId>
          <artifactId>javacv</artifactId>
          <version>${javacv.version}</version>
      </dependency>
      <dependency>
          <groupId>com.googlecode.javacv</groupId>
          <artifactId>javacv</artifactId>
          <version>${javacv.version}</version>
          <classifier>linux-x86</classifier>
      </dependency>

      <dependency>
          <groupId>com.googlecode.javacv</groupId>
          <artifactId>javacv</artifactId>
          <version>${javacv.version}</version>
          <classifier>linux-x86_64</classifier>
      </dependency>

    <dependency>
        <groupId>com.xeiam.xchart</groupId>
        <artifactId>xchart</artifactId>
        <version>2.3.1</version>
    </dependency>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.7</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
  </dependencies>

  <repositories>
      <repository>
          <id>javacpp</id>
          <name>JavaCPP</name>
          <url>http://maven2.javacpp.googlecode.com/git/</url>
      </repository>
      <repository>
          <id>javacv</id>
          <name>JavaCV</name>
          <url>http://maven2.javacv.googlecode.com/git/</url>
      </repository>
  </repositories>

  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>${jdkVersion}</source>
                    <target>${jdkVersion}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeScope>compile</includeScope>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                            <classpathLayoutType>simple</classpathLayoutType>
                            <mainClass>ru.intemsys.reget.server.App</mainClass>
                            <packageName>ru.intemsys.reget.server</packageName>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <finalName>${artifactId}-${version}</finalName>
                </configuration>
            </plugin>
        </plugins>
  </build>

    <profiles>
        <profile>
            <id>linux</id>
            <activation>
                <os><name>linux</name></os>
            </activation>
            <properties>
                <os.name>linux</os.name>
            </properties>
        </profile>
        <profile>
            <id>macosx</id>
            <activation>
                <os><name>mac os x</name></os>
            </activation>
            <properties>
                <os.name>macosx</os.name>
            </properties>
        </profile>
        <profile>
            <id>windows</id>
            <activation>
                <os><family>windows</family></os>
            </activation>
            <properties>
                <os.name>windows</os.name>
            </properties>
        </profile>
        <profile>
            <id>i386</id>
            <activation>
                <os><arch>i386</arch></os>
            </activation>
            <properties>
                <os.arch>x86</os.arch>
            </properties>
        </profile>
        <profile>
            <id>i486</id>
            <activation>
                <os><arch>i486</arch></os>
            </activation>
            <properties>
                <os.arch>x86</os.arch>
            </properties>
        </profile>
        <profile>
            <id>i586</id>
            <activation>
                <os><arch>i586</arch></os>
            </activation>
            <properties>
                <os.arch>x86</os.arch>
            </properties>
        </profile>
        <profile>
            <id>i686</id>
            <activation>
                <os><arch>i686</arch></os>
            </activation>
            <properties>
                <os.arch>x86</os.arch>
            </properties>
        </profile>
        <profile>
            <id>amd64</id>
            <activation>
                <os><arch>amd64</arch></os>
            </activation>
            <properties>
                <os.arch>x86_64</os.arch>
            </properties>
        </profile>
        <profile>
            <id>x86-64</id>
            <activation>
                <os><arch>x86-64</arch></os>
            </activation>
            <properties>
                <os.arch>x86_64</os.arch>
            </properties>
        </profile>
    </profiles>
</project>

4.0.0
ru.intemsys.reget.server
注册表服务器
0.1-α
罐子
UTF-8
yyyyMMddhhmm
${os.name}-${os.arch}
2014
1.6
0.7
0.7
公用程序守护程序
公用程序守护程序
1.0.10
com.googlecode.javacpp
javacpp
${javacpp.version}
com.googlecode.javacv
爪哇
${javacv.version}
com.googlecode.javacv
爪哇
${javacv.version}
linux-x86
com.googlecode.javacv
爪哇
${javacv.version}
linux-x86_64
com.xeiam.xchart
xchart
2.3.1
javax.mail
邮件
1.4.7
朱尼特
朱尼特
3.8.1
测试
javacpp
JavaCPP
http://maven2.javacpp.googlecode.com/git/
爪哇
爪哇
http://maven2.javacv.googlecode.com/git/
org.apache.maven.plugins
maven编译器插件
2.3.2
${jdkVersion}
${jdkVersion}
org.apache.maven.plugins
maven依赖插件
2.4
复制依赖项
包裹
复制依赖项
编译
${project.build.directory}/lib
org.apache.maven.plugins
maven jar插件
2.3.1
真的
解放党/
简单的
ru.intemsys.reget.server.App
ru.intemsys.reget.server
org.apache.maven.plugins
maven阴影插件
包裹
阴凉处
${artifactId}-${version}
linux
linux
linux
马科斯
MacOSX
马科斯
窗户
窗户
窗户
i386
i386
x86
i486
i486
x86
i586
i586
x86
i686
i686
x86
amd64
amd64
x86_64
x86-64
x86-64
x86_64
mvn-版本

ApacheMaven 3.0.4 Maven home:/usr/share/Maven Java版本:1.7.0_25,供应商:Oracle公司 Java主页:/usr/lib/jvm/Java-7-openjdk-i386/jre 默认区域设置:ru_ru,平台编码:UTF-8 操作系统名称:“linux”,版本:“3.11.0-14-generic”,拱门:“i386”,系列:“unix”

uname-a


Linux PC-1 3.11.0-14-generic#21 Ubuntu SMP周二11月12日17:07:40 UTC 2013 i686 i686 i686 GNU/Linux有一个。所有lib都在

中,您运行什么命令?IMO java.library.path选项不会自动设置。它应该指向一个目录,其中最有可能包含OpenCV的本机模块。@Tome,mvn包。据我所知,所有的*.so文件都被认为是目录/com/googlecode/javacv/cpp/linux-x86_64/和/com/googlecode/javacv/cpp/linux-x86/中的result*.jar文件,所以打包在jar文件中时不会使用这些文件,它们必须可以直接从文件系统访问,所以通常情况下,jar的结构是/lib/,和/bin/(或其他内容)用于so/dll文件。该/bin/必须是运行程序时必须给出的java.library.path VM选项的值。