compiling java source code with ant -


i have java source code package known compile. attempting compile package ant (the build.xml file present). when run ant java import statements generate error message of type:

the import java.awt.geom.path2d cannot resolved" (the specific message depends on being imported)

clearly package paths not defined , have no idea requested imports live in filesystem. assume if know paths setting $classpath program compile. using opensuse 13.2 , installed java info is:

java -version openjdk version "1.8.0_45" openjdk runtime environment (build 1.8.0_45-b14) openjdk 64-bit server vm (build 25.45-b02, mixed mode) 

can point me find java packages , how ant compile sources?

the command line used compile sources is: ant

build.xml in same directory ant run contains src directory. working project, don't know how configure standard library locations (i'm not java type means).

update.

i have located path openjdk libraries @ /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/rt.jar , have tried compile 2 different ways still imports cannot resolved error messages.

compiling -lib option not work:

ant -lib /usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/rt.jar

setting classpath environment variable not work:

export classpath=/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/rt.jar

ant

the content of build.xml is:

<?xml version="1.0"?>  <project name="mazr" default="jar" basedir=".">    <property name="jar.file" value="${ant.project.name}.jar"/>    <property name="src.dir" value="src"/>    <property name="build.dir" value="build"/>    <property name="dist.dir" value="dist"/>    <property name="applet.html" value="applet.html"/>      <taskdef resource="checkstyletask.properties"/>      <target name="init">      <mkdir dir="${build.dir}"/>      <mkdir dir="${dist.dir}"/>    </target>      <target name="compile" depends="init">      <javac srcdir="${src.dir}" destdir="${build.dir}" debug="on"             includeantruntime="false">        <compilerarg value="-xlint"/>      </javac>    </target>      <target name="jar" depends="compile">      <jar destfile="${dist.dir}/${jar.file}" basedir="${build.dir}">        <manifest>          <attribute name="main-class" value="com.nullprogram.maze.runmaze"/>        </manifest>      </jar>      <copy file="${applet.html}" tofile="${dist.dir}/index.html"/>    </target>      <target name="run" depends="jar">      <java jar="${dist.dir}/${jar.file}" fork="true"/>    </target>      <target name="clean">      <delete dir="${build.dir}"/>      <delete file="${jar.file}"/>    </target>      <target name="check">      <checkstyle config="checkstyle.xml">        <fileset dir="src" includes="**/*.java"/>      </checkstyle>    </target>      <target name="format" description="run indenter on source files.">      <apply executable="astyle">        <arg value="--mode=java"/>        <arg value="--suffix=none"/>        <fileset dir="${src.dir}" includes="**/*.java"/>      </apply>    </target>      <target name="applet" depends="jar" description="run applet version.">      <exec executable="appletviewer">        <arg value="${dist.dir}/index.html"/>      </exec>    </target>      <target name="javadoc" description="generate javadoc html.">      <javadoc destdir="${dist.dir}/javadoc">        <fileset dir="${src.dir}" includes="**/*.java" />      </javadoc>    </target>  </project>

any idea why import not seem work?

thanks!

further update.

i added classpath definition build.xml below, still no joy. have not used java in many, many years way out of depth here, desperately appreciated.

  <property name="java.class.path" location="/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/rt.jar"/>      <target name="compile" depends="init">      <javac srcdir="${src.dir}" destdir="${build.dir}" debug="on"             includeantruntime="false">        <compilerarg value="-xlint"/>        <classpath>          <pathelement path="${java.class.path}/"/>        </classpath>      </javac>    </target>

could javac , java symlinks pointing @ different places

compare these 2 commands , see if point same area:

which javac java 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -