Search code examples
javalinuxubuntujavac

make: /bin/javac: Command not found


I am trying to follow the setup of this application: https://github.com/michaelmior/RUBBoS

And when I came to this part:

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.

When I run make, I receive this error:

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

New error:

/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

Solution

  • You need to set your JAVA_HOME environment variable to your JDK installation directory.

    The Makefile in the Client directory includes ../config.mk which sets the JAVAC variable as

    JAVAC = $(JAVA_HOME)/bin/javac
    

    If JAVA_HOME is empty, you get /bin/javac which is what you observe.

    For bash like shells, use something like

    $ export JAVA_HOME=/opt/jdk1.7.0_80
    $ make
    

    Modify the path (/opt/jdk1.7.0_80) according to where you have installed the JDK.

    Note that there is also a J2EE_HOME environment variable which you also must set to your application server home - otherwise you will get an invalid classpath (see /lib/j2ee.jar in the make output in the question)