make: /bin/javac: 找不到命令

make: /bin/javac: Command not found

我正在尝试遵循此应用程序的设置:https://github.com/michaelmior/RUBBoS

当我来到这一部分时:

To build the client emulator, change into the Client directory and run make. This will create rubbos_client.jar which will be used to run the benchmark.

当我 运行 make 时,我收到此错误:

root@webserver:/home/user/RUBBoS/Client# make
/bin/javac -deprecation -classpath .:/lib/j2ee.jar:/jre/lib/rt.jar edu/rice/rubbos/client/URLGenerator.java
make: /bin/javac: Command not found
make: *** [edu/rice/rubbos/client/URLGenerator.class] Error 127

新错误:

/opt/jdk1.7.0_80/bin/javac -deprecation -classpath .:/lib/j2ee.jar:/opt/jdk1.7.0_80/jre/lib/rt.jar edu/rice/rubbos/client/URLGenerator.java
make: /opt/jdk1.7.0_80/bin/javac: Command not found
make: *** [edu/rice/rubbos/client/URLGenerator.class] Error 127

您需要将 JAVA_HOME 环境变量设置为 JDK 安装目录。

Client 目录中的 Makefile 包含 ../config.mk,它将 JAVAC 变量设置为

JAVAC = $(JAVA_HOME)/bin/javac

如果 JAVA_HOME 为空,您将得到 /bin/javac,这就是您所观察到的。

对于 bash 之类的 shell,使用类似

的东西
$ export JAVA_HOME=/opt/jdk1.7.0_80
$ make

根据安装路径修改路径(/opt/jdk1.7.0_80)JDK。

请注意,还有一个 J2EE_HOME 环境变量,您还必须将其设置为您的应用程序服务器主目录 - 否则您将获得无效的类路径(请参阅 make 中的 /lib/j2ee.jar问题中的输出)