<project name="MyProject" default="run" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="./src"/>
<property name="build" location="./build"/>
<property name="lib" location="./lib"/>
<property name="zmq.dir" location="/usr/local/share/java"/>
<path id="classpath.compile">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${zmq.dir}/zmq.jar"/>
</path>
<path id="classpath.run">
<path refid="classpath.compile"/>
<fileset dir="${build}/classes">
<include name="**/*.class"/>
</fileset>
</path>
<target name="clean"
description="clean up" >
<delete dir="${build}"/>
</target>
<target name="init" depends="clean">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
<mkdir dir="${build}/classes"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<property name="compile.classpath" refid="classpath.compile"/>
<echo message="Compiling with classpath ${compile.classpath}"/>
<javac srcdir="${src}"
destdir="${build}/classes">
<classpath refid="classpath.compile"/>
</javac>
</target>
<target name="run" depends="compile">
<property name="run.classpath" refid="classpath.run"/>
<echo message="Running with classpath ${run.classpath}"/>
<java fork="true"
dir="${build}/classes"
classname="jgf.EMDR_Client"
classpathref="classpath.run"/>
</target>
</project>
나는이 프로젝트는 java.lang.ClassNotFoundException: jgf.EMDR_Client
클래스를 제공하는 Ant 스크립트가 예외를 찾을 수 없습니다 - 이유가 무엇입니까?
내가 컴파일에 대한 클래스 경로를 에코와
컴파일을 실행 준다 실행하면 :
/Users/JGF/Projects/emdr/lib/json_simple-1.1.jar:/usr/local/share/java/zmq.jar
실행은 다음과 같습니다
/Users/JGF/Projects/emdr/lib/json_simple-1.1.jar:/usr/local/share/java/zmq.jar:/Users/JGF/Projects/emdr/build/classes/jgf/EMDR_Client.class
내 JAVA_HOME is : /Library/Java/Home
ant java dir attribute은 왜곡되어 있습니까? 경로는 이럴을 작동해야하지만
나는 스크립트를 수정 classpath.run하는 참조 그냥 직접 참조 classpath.lib을했다. 여전히 기쁨이 없다 ... 클래스 패스 태그를 사용하지 않았다. 자바 태스크의 classpathref 속성은 여전히 그렇다. 아직도 기쁨은 없다. – JGFMK
속성 대신 java task 및 embeddd classpath 태그가 수정되었습니다. 그것도 작동하지 않았다. 동일한 이전 클래스가 예외를 찾을 수 없습니다. – JGFMK
zmq.jar이 ZeroMQ 프로젝트의 이상한 짐승이라고 덧붙일 것입니다 - 저는 Mac에서 실행하는 데 사용하는 기본 클래스를 중심으로하는 JNI 래퍼라고 생각합니다. 그것은 찾을 수없는 수업에 대한 기괴한 이유가 될 수 없었을까요? - 당신이 볼 수 있듯이/build 디렉토리에 있습니다. 스크린 샷 – JGFMK