• Java JDK path environment variables (Path issues).

    I have installed both the JDK and java-commons from the AUR and I wanted to test it however I ran into an issue when trying to use:

    javac file.java
    bash: javac: command not found

    So i suspected it was a pathing issue. The command java works fine and so I checked the installation,

    java -version
    java version "1.8.0_144"
    Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
    Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

    And it appears the JDK is not listed. Does this mean I don’t have the JDK installed? Because when I use the add/remove software client it only has the option to remove the JDK.

    The relevant path working for just the command “java” is:

    echo $PATH

    Which I assume is the JAVA_HOME variable.

    The installed (apparently not) JDK 8.0 is on the path:


    and the javac script inside:


    Inside this bin file, it also contains the normal “java” run script. So I have tried to change this variable using,

    gedit ~/.bashrc

    And adding this to the bottom


    However this changes nothing, even on restarting the computer.

    I have also tried simply adding the JDK path variable into $PATH to no avail. (With and without export at the front)


    I found this: https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path).
    The top answer says to not use ~/.bashrc, rather to use ~/.profile or ~/.bash_profile. I have opened both the latter config files but they appear to be both empty or non-existent.

    I really am inclined to just reinstall everything at this point (Will that even change anything?) but I want to just make sure I have actually tried everything before I do so.

    Any help much appreciated, thanks.


    echo $JAVA_HOME

    gives me.


    This is correct, however javac on the command line still not recognised.

    Java on Eclipse also works fine. This is really weird… Am i missing something very simple?

  • Okay, I’m not sure why this didn’t work earlier but I assume it was because that I was restarting my computer rather than the terminal.

    This is what I did:

    gedit ~/.bashrc

    And added these two lines, then restarted terminal (NOT COMPUTER)

    export PATH=$PATH:$JAVA_HOME

    I should really read more carefully.

java8 path4 environment6 jdk1 Posts 3Views 266
Log in to reply