我想编译一个Java文件。在控制台上我正在这样做:
javac -cp "/home/user/java/ClickRecommender/build:/home/user/java/ClickRecommender/src/.:/home/user/java/ClickRecommender/libs/*" visualization/VisualizeCorrelationMatrix.java
这很好用。但我必须使用自建的ant脚本。使用“ant -v”执行我的ant脚本时,我得到使用以下类路径的信息:
init:
[mkdir] Skipping /home/user/java/ClickRecommender/build because it already exists.
baseclasses:
[javac] /home/user/java/ClickRecommender/src/visualization/VisualizeCorrelationMatrix.class skipped - don't know how to handle it
[javac] VisualizeCorrelationMatrix.java added as VisualizeCorrelationMatrix.class doesn't exist.
[javac] Compiling 1 source file to /home/user/java/ClickRecommender/build
[javac] Using modern compiler
adding /home/user/java/ClickRecommender/libs/* which contains wildcards and may not do what you intend it to do depending on your OS or version of Java
adding /home/user/java/ClickRecommender/libs/* which contains wildcards and may not do what you intend it to do depending on your OS or version of Java
[javac] Compilation arguments:
[javac] '-d'
[javac] '/home/user/java/ClickRecommender/build'
[javac] '-classpath'
[javac] '/home/user/java/ClickRecommender/build:/home/user/java/ClickRecommender/src:/home/user/java/ClickRecommender/libs/*'
[javac] '-sourcepath'
[javac] '/home/user/java/ClickRecommender/src/visualization'
[javac] '-g:none'
[javac]
[javac] The ' characters around the executable and arguments are
[javac] not part of the command.
[javac] File to be compiled:
[javac] /home/user/java/ClickRecommender/src/visualization/VisualizeCorrelationMatrix.java
[javac] /home/user/java/ClickRecommender/src/visualization/VisualizeCorrelationMatrix.java:16: cannot find symbol
[javac] symbol : method columns()
[javac] location: class recommender.CorrelationMatrix
[javac] int N = cm.columns();
[javac] ^
[javac] 4 errors
BUILD FAILED
这就是我的蚂蚁脚本的样子:
<?xml version="1.0"?>
<project name="ClickRecommender" default="compile" basedir=".">
<property name="src" value="."/>
<property name="build" value="../build"/>
<property name="jars" value="../libs/"/>
<target name="init">
<mkdir dir="${build}"/>
</target>
<target name="baseclasses" depends="init">
<!-- Compile the java code -->
<javac includeantruntime="false" srcdir="${src}/visualization" destdir="${build}" classpath="${src}:${jars}*"/>
...
这里出了什么问题???