简体   繁体   中英

Error Executing Makefiles on Netbeans 7.1

Am trying to execute a makefile which will automatically runs a compiled front end of a java code i have written. the contents of the make file is as follows:

       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

When i run make from netbeans, i get this error on the terminal:

         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)

Please how do i solve this problem.?

The error means the Java compiler (javac) cannot be found.

Your JAVA_HOME variable needs to be set and also appended to PATH.

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

Add these lines to the start of your makefile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM