听起来你想将你的应用链接到本机可执行文件中。这意味着您已经将源代码编译成了JVM字节码(正如您通过将.scala编译成.class文件所发现的那样)。你需要运行
gcj
使用
<exec>
将字节码编译为gcc对象代码文件的任务。
<property name="main.class" value="Main" />
<property name="class.dir" value="${basedir}/classes" />
<target name="compile">
<mkdir dir="${class.dir}" />
<javac srcdir="${build.dir}"
destdir="${class.dir}"
compiler="gcj"
executable="C:/gcc/gcc-4.3/bin/gcj.exe"
classpathref="gcjProject.classpath">
<include name="**/*.java"/>
</javac>
</target>
<target name="link" depends="compile">
<mkdir dir="${object.dir"} />
<exec cmd="C:/gcc/gcc-4.3/bin/gcj.exe">
<arg value="-classpath=${object.dir}" />
<arg value="-c" />
<arg value="*.class" />
</exec>
</target>
请记住,您需要定义
build.dir
和
object.dir
depends
在编译目标中的javac之前执行任务(或者每次都从头开始重新编译)。我可能漏掉了很多东西,如果一开始不起作用,你应该检查手册页(gcj、gcc和ant)。