在Netbeans 7.1上执行Makefile时出错

时间:2013-11-10 22:13:53

标签: java netbeans makefile

我试图执行一个makefile,它将自动运行我编写的java代码的编译前端。 make文件的内容如下:

       build: compile test

compile:
javac lexer/*.java
javac symbols/*.java
javac inter/*.java
javac parser/*.java
javac main/*.java

test:
@for i in `(cd tests; ls *.t | sed -e 's/.t$$//')`;\
    do echo $$i.t;\
    java main.Main <tests/$$i.t >tmp/$$i.i;\
    diff tests/$$i.i tmp/$$i.i;\
done

 clean:
(cd lexer; rm *.class)
(cd symbols; rm *.class)
(cd inter; rm *.class)
(cd parser; rm *.class)
(cd main; rm *.class)

 yacc:
/usr/ccs/bin/yacc -v doc/front.y
rm y.tab.c
mv y.output doc

当我从netbeans运行make时,我在终端上收到此错误:

         javac lexer/*.java
           Makefile:4: recipe for target `compile' failed
           /bin/sh: javac: command not found
            make: *** [compile] Error 127


             MAKE FAILED (exit value 2, total time: 660ms)

请问我该如何解决这个问题。?

1 个答案:

答案 0 :(得分:0)

错误意味着找不到Java编译器(javac)。

您的JAVA_HOME变量需要设置并附加到PATH。

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_06\bin 
export Path:=$(JAVA_HOME);$(Path) 

将这些行添加到makefile的开头。