javac does not work in ubuntu terminal

后端 未结 6 1057
后悔当初
后悔当初 2021-02-06 23:41

When I try to compile a java program with javac, I get an error:

The program \'javac\' can be found in the following packages:
 * default-jdk
 * ecj         


        
6条回答
  •  北海茫月
    2021-02-07 00:09

    Actually, java command was working on my ubuntu 16.04 but not javac. At first, I fiddled around with the environment paths and all as i thought i had all java packages installed and the issue was with setting the environment path variable.

    Then i tried the command update-alternatives --list java which returned a path but update-alternatives --list javac did not. This explained to me that javac needed to be installed so I ran sudo apt-get install default-jdk

    But incase you get a path in running the update-alternatives --list javac then i suggest you should try setting up your $JAVA_PATH or creating symbolic links. Help to that can be found on the page unable to run javac on Ubuntu.

提交回复
热议问题