3

I have looked here and the question seems very similar to what I am asking. However I can't figure out the solution from the chosen answer there.

Following is my ant output:

-compile:
[javac] Compiling 102 source files to /Users/goat/src/myproject/core/bin/classes
[javac] /Users/goat/src/myproject/core/src/com/app/utils/PriorityThreadPoolExecutor.java:8: cannot find symbol
[javac] symbol  : class RunnableFuture
[javac] location: package java.util.concurrent
[javac] import java.util.concurrent.RunnableFuture;
[javac]                            ^

The class RunnableFuture is not recognized. This class can be found in java.util.concurrent which is located in two places:

/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
/Applications/android-sdk-mac_x86/platforms/android-7

I want to use the library from the first path without copying it to my libs folder. This works fine in Eclipse as I have set my .classpath correctly but I am not sure how to setup ant so that it can reference the libs folder as well as this external folder.

Thanks for your help!

Community
  • 1
  • 1
Goat
  • 193
  • 10

1 Answers1

1

You just need to generate a classpath and to pass it to javac :

<path id="compile.classpath">
    <fileset dir="${lib.dir}">
        <include name="*.jar"/>
    </fileset>
</path>

<target name="compile">
    <javac srcdir="${src.dir}" destdir="${build.dir}/classes" debug="true">
        <classpath refid="compile.classpath"/>
    </javac>
</target>

See https://ant.apache.org/manual/Tasks/javac.html

smonff
  • 3,399
  • 3
  • 36
  • 46
Doug
  • 382
  • 1
  • 4