我的java项目使用了一些apache commons库。我希望能够在unix中运行我的程序,所以我制作了一个makefile来为我编译它。我的项目有4个Java类和4个外部库(.jars)。在我的目录中,我有四个.Java文件和一个名为" lib"其中包含我的.Jar文件。这是我的make文件:
JFLAGS = -g
JC = javac -sourcepath / -classpath lib/commons-httpclient-3.1.jar:lib/commons-io-2.4.jar:lib/commons-codec-1.9.jar:lib/commons-logging-1.1.3.jar
.SUFFIXES: .java .class
.java.class:
$(JC) $(JFLAGS) $*.java
CLASSES = \
SubmissionDriver.java \
FileAndArgs.java \
hashConverter.java \
InvalidAgeException.java
default: classes
classes: $(CLASSES:.java=.class)
clean:
$(RM) *.class
这是我的错误消息:虽然我得到了与实际类文件有关的14错误消息。以下是一些例子:
SubmissionDriver.java:74: error: cannot find symbol
public static void httpSend() throws HttpException, IOException{
^
symbol: class HttpException
location: class SubmissionDriver
SubmissionDriver.java:75: error: cannot find symbol
HostConfiguration hf=new HostConfiguration();
^
symbol: class HostConfiguration
location: class SubmissionDriver
SubmissionDriver.java:75: error: cannot find symbol
HostConfiguration hf=new HostConfiguration();
^
symbol: class HostConfiguration
location: class SubmissionDriver
SubmissionDriver.java:77: error: cannot find symbol
PostMethod post = new PostMethod("myurl");
^
此外,它在thsoe 14错误消息的底部说明了这一点:
14 errors
make: *** [SubmissionDriver.class] Error 1
答案 0 :(得分:1)
确保在此行之前有一个标签
$(JC)$(JFLAGS)$ *。java