简体   繁体   English

蚂蚁apache和本机库

[英]Ant apache and Native Libraries

I am currently trying to use ant apache to build a project. 我目前正在尝试使用ant apache来构建项目。 However, whenever I try typing in "ant" to start building, this error message shows up on my terminal: 但是,每当我尝试输入“ ant”开始构建时,此错误消息就会在我的终端上显示:

 [java] Exception in thread "main" java.lang.UnsatisfiedLinkError: no em1dFwdJava in java.library.path
 [java]     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
 [java]     at java.lang.Runtime.loadLibrary0(Runtime.java:845)
 [java]     at java.lang.System.loadLibrary(System.java:1084)

The strange thing is, when I run my em1dFwdJava.java, it compiles and runs perfectly normal. 奇怪的是,当我运行em1dFwdJava.java时,它会编译并完全正常运行。 em1dFwdJava.java uses loadLibrary for the native library. em1dFwdJava.java将loadLibrary用于本机库。 For this project, I am using two libraries, libem.dylib and dipole.dylib. 对于这个项目,我使用两个库libem.dylib和dipole.dylib。 I believe that there is a possibility that I need to include the two libraries in the build.xml. 我相信我有可能需要在build.xml中包含两个库。 If so, I am not sure where to include the two libraries without messing up my build. 如果是这样,我不确定在不弄乱我的构建的情况下将两个库包含在哪里。 Below is the build.xml I am using: 以下是我正在使用的build.xml:

    <project name='JPPF Application' basedir="." default="run">

    <property name="build.properties.file" value="${basedir}/build.properties"/>
  <property file="${build.properties.file}"/>
    <property name="lib.dir"    value="${basedir}/lib"/>
    <property name="config.dir"  value="${basedir}/config"/>
    <property name="classes.dir" value="${basedir}/classes"/>   
    <property name="src.dir"     value="${basedir}/src"/>


    <path id="project.classpath">
        <pathelement location="${config.dir}"/>
        <pathelement location="${classes.dir}"/>
        <fileset dir="${lib.dir}" includes="**/*.jar"/>
    </path>


    <target name="clean">
        <delete dir="${classes.dir}" quiet="true"/>
    </target>               


    <target name="init" description="Initialize ressources">
        <mkdir dir="${classes.dir}"/>
    </target>


    <target name="compile" depends="clean, init">
        <javac srcdir="" destdir="${classes.dir}"
            debug="on" deprecation="off" optimize="on" includes="**/*.java">
        <classpath refid="project.classpath"/>
        <compilerarg line="-Xlint:unchecked"/>
            <src path="${src.dir}"/>
        </javac>
    </target>


    <target name="build" description="build the application" depends="clean, init, compile">
        <mkdir dir="${classes.dir}"/>
    </target>


    <target name="run" description="run the application" depends="build">
        <java fork="yes" classname="${main.class}" classpathref="project.classpath">
            <jvmarg value="-Djppf.config=jppf.properties"/>
            <jvmarg value="-Djava.util.logging.config.file=config/logging.properties"/>
            <jvmarg value="-Xmx64m"/>
        </java>
    </target>

    </project> 

Option 1: Add a java -Djava.library.path="path to em1dFwdJava" 选项1:将java -Djava.library.path =“路径添加到em1dFwdJava”

Option 2: add a LD_LIBRARY_PATH environmet variable to the path to em1dFwdJava. 选项2:将LD_LIBRARY_PATH环境变量添加到em1dFwdJava的路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM