2012-05-08 3 views
1

여기에 자세한 정보를 추가하겠습니다. 당신이 다른 클래스를 인식하지 못할 볼 수개미로 컴파일 할 때 왜 많은 클래스 오류가 누락 되었습니까?

Buildfile: D:\Users\Rajesh\workspace\Jib\src\build.xml 
check-runtime: 
codegen: 
    [echo] Running code generation from schema 
    [mkdir] Created dir: D:\Users\Rajesh\workspace\Jib\src\gen 
    [java] Loaded and validated 1 specified schema(s) 
    [java] Generated 5 top-level classes in package org.jibx.starter 
    [java] Total classes in model: 5 
compile: 
    [echo] Compiling Java source code 
    [mkdir] Created dir: D:\Users\Rajesh\workspace\Jib\src\bin 
    [javac] D:\Users\Rajesh\workspace\Jib\src\build.xml:114: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
    [javac] Compiling 5 source files to D:\Users\Rajesh\workspace\Jib\src\bin 
    [javac] D:\Users\Rajesh\workspace\Jib\src\build.xml:117: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
    [javac] Compiling 1 source file to D:\Users\Rajesh\workspace\Jib\src\bin 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:33: error: cannot find symbol 
    [javac]    IBindingFactory bfact = BindingDirectory.getFactory(Order.class); 
    [javac]                ^
    [javac] symbol: class Order 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:36: error: cannot find symbol 
    [javac]    Order order = (Order)uctx.unmarshalDocument(in, null); 
    [javac]   ^
    [javac] symbol: class Order 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:36: error: cannot find symbol 
    [javac]    Order order = (Order)uctx.unmarshalDocument(in, null); 
    [javac]       ^
    [javac] symbol: class Order 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:40: error: cannot find symbol 
    [javac]    for (Iterator<Item> iter = order.getItemList().iterator(); iter.hasNext();) { 
    [javac]       ^
    [javac] symbol: class Item 
    [javac] location: class Test 
    [javac] D:\Users\Rajesh\workspace\Jib\src\src\Test.java:41: error: cannot find symbol 
    [javac]     Item item = iter.next(); 
    [javac]    ^
    [javac] symbol: class Item 
    [javac] location: class Test 
    [javac] 5 errors 

BUILD FAILED 
D:\Users\Rajesh\workspace\Jib\src\build.xml:117: Compile failed; see the compiler error output for details. 

Total time: 3 seconds 

: 나는 개미 빌드] 파일을 코드가있는

<?xml version="1.0"?> 


<project basedir="." default="full"> 

    <property name="jibx-home" value="C:/Jibx"/> 


<!-- make sure required jars are present --> 
    <condition property="runtime-jars-found"> 
    <available file="${jibx-home}/lib/jibx-run.jar"/> 
    </condition> 
    <condition property="binding-jars-found"> 
    <and> 
     <available file="${jibx-home}/lib/bcel.jar"/> 
     <available file="${jibx-home}/lib/jibx-bind.jar"/> 
     <available file="${jibx-home}/lib/jibx-run.jar"/> 
    </and> 
    </condition> 
    <available property="extras-jar-found" file="${jibx-home}/lib/jibx-extras.jar"/> 

    <!-- set classpath for compiling and running application with JiBX --> 
    <path id="classpath"> 
    <fileset dir="${jibx-home}/lib" includes="*.jar"/> 
    <pathelement location="bin"/> 
    </path> 

    <!-- make sure runtime jars are present --> 
    <target name="check-runtime"> 
    <fail unless="jibx-home">JiBX home directory not found - define JIBX_HOME system property or set path directly in build.xml file.</fail> 
    <fail unless="runtime-jars-found">Required JiBX runtime jar jibx-run.jar was not found in JiBX home lib directory (${jibx-home}/lib)</fail> 
    </target> 

    <!-- make sure extras jars are present --> 
    <target name="check-extras" depends="check-runtime"> 
    <fail unless="extras-jar-found">Required JiBX extras jar jibx-extras.jar was not found in JiBX home lib directory (${jibx-home}/lib)</fail> 
    </target> 

    <!-- make sure binding jars are present --> 
    <target name="check-binding" depends="check-runtime"> 
    <fail unless="binding-jars-found">Required JiBX binding jar jibx-bind.jar or bcel.jar was not found in JiBX home lib directory (${jibx-home}/lib)</fail> 
    </target> 

    <!-- clean compiled class files and output file --> 
    <target name="clean"> 
    <delete quiet="true" dir="bin"/> 
    <delete quiet="true" dir="gen"/> 
    </target> 

    <!-- generate as a separate step --> 
    <target name="codegen" depends="check-runtime"> 

    <echo message="Running code generation from schema"/> 
    <delete quiet="true" dir="gen"/> 
    <mkdir dir="gen"/> 
    <java classname="org.jibx.schema.codegen.CodeGen" fork="yes" 
     classpathref="classpath" failonerror="true"> 
     <arg value="-t"/> 
     <arg value="gen/src"/> 
     <arg value="-w"/> 
     <arg value="starter.xsd"/> 
    </java> 

    </target> 

    <!-- generate using customizations as a separate step --> 
    <target name="custgen" depends="check-runtime"> 

    <echo message="Running code generation from schema"/> 
    <delete quiet="true" dir="gen"/> 
    <mkdir dir="gen"/> 
    <java classname="org.jibx.schema.codegen.CodeGen" fork="yes" 
     classpathref="classpath" failonerror="true"> 
     <arg value="-c"/> 
     <arg value="custom.xml"/> 
     <arg value="-t"/> 
     <arg value="gen/src"/> 
     <arg value="-w"/> 
     <arg value="starter.xsd"/> 
    </java> 

    </target> 

    <!-- compile the classes --> 
    <target name="compile" depends="check-runtime"> 

    <echo message="Compiling Java source code"/> 
    <mkdir dir="bin"/> 
    <javac srcdir="gen/src" destdir="bin" debug="on"> 
     <classpath refid="classpath"/> 
    </javac> 
    <javac srcdir="src" destdir="bin" debug="on"> 
     <classpath refid="classpath"/> 
    </javac> 

    </target> 

    <!-- bind as a separate step --> 
    <target name="bind" depends="check-binding"> 

    <echo message="Running JiBX binding compiler"/> 
    <taskdef name="bind" classname="org.jibx.binding.ant.CompileTask"> 
     <classpath> 
     <fileset dir="${jibx-home}/lib" includes="*.jar"/> 
     </classpath> 
    </taskdef> 
    <bind binding="gen/src/binding.xml"> 
     <classpath refid="classpath"/> 
    </bind> 
    </target> 

    <!-- run the included test program to read and then write to separate file --> 
    <target name="run" depends="check-runtime"> 
    <echo message="Running the sample application..."/> 
    <java classname="org.jibx.starter.Test" fork="true" failonerror="true"> 
     <classpath refid="classpath" /> 
     <arg value="starter.xml"/> 
     <arg value="out.xml"/> 
    </java> 
    <echo message="Generated output document out.xml"/> 
    </target> 

    <target name="full" depends="codegen,compile,bind,run"/> 
    <target name="custom" depends="custgen,compile,bind,run"/> 

    <!-- show list of targets --> 
    <target name="help"> 
    <echo message="Targets are:"/> 
    <echo/> 
    <echo message="clean   delete all class files and generated code"/> 
    <echo message="compile  compile class files"/> 
    <echo message="codegen  generate code using defaults"/> 
    <echo message="bind   compile JiBX bindings"/> 
    <echo message="run   run test program"/> 
    <echo message="full   full build and run using defaults"/> 
    <echo message="custgen  generate code using customizations"/> 
    <echo message="custom  full build and run using customizations"/> 
    </target> 

</project> 

내가이 얻는 출력합니다. 왜 그런가요? main에서 참조 된 다른 클래스를 인식하도록 여기에서 할 수있는 일이 있습니까? 이러한 누락 된 클래스는 org.jibx.starter 패키지에서 생성됩니다.

+0

을 사용하는 방법에 대해 알아? 난 당신이 응용 프로그램을 컴파일 할 필요가 있는지의 .class 파일 –

+1

을 찾을 수 없습니다 생각하십니까? 실행은 컴파일에 의존하지 않으므로 컴파일 할 대상을 추가하고 실행을 depende해야합니다. – maress

+1

프로그램을 컴파일하고 런타임 클래스 경로에서 클래스 파일에 액세스 할 수있게하십시오. jar 파일에 클래스 파일이있는 경우 jar 파일이 런타임 클래스 경로에 있는지 확인하십시오. – jay

답변

0

ANT의 Java 작업은 .class 파일을 필요로하는 Java 명령과 동일합니다.

그래서 먼저 java를 컴파일하고 성공적으로 실행하기 위해 적절한 폴더에 넣으십시오.

가 어떻게 UR의 주요 클래스를 컴파일하는 javac task in ANT

+1

에게 전달했습니다. – Rajeshwar

+0

은 build.xml없이 실행하고 필수 폴더의 .class 파일을 확인하십시오. –

관련 문제