javac does not work in ubuntu terminal

后端 未结 6 1059
后悔当初
后悔当初 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:22

    I have Ubuntu 12.10, with java "1.6.0_27", this command makes javac available:

    sudo apt-get install default-jdk
    

    Then compile it like this:

    el@apollo:~/retreat3$ javac HelloWorld.java
    el@apollo:~/retreat3$ java HelloWorld
    Hello, World!
    

提交回复
热议问题