Java: com.sun.tools.javac.Main not found when trying to compile Hadoop program

前端 未结 3 1875
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-30 07:42

When I try to compile my program in Hadoop with this command

bin/hadoop com.sun.tools.javac.Main WordCounter.java
         


        
3条回答
  •  死守一世寂寞
    2020-12-30 08:29

    The error means you don't use a JDK to start Hadoop. The main difference between the JRE (pure runtime) and the JDK is the Java compiler javac. To see if you have a Java compiler, you need to check two places: There should be a javac in the $JAVA_HOME/bin folder plus there must be a file $JAVA_HOME/lib/tools.jar.

    In your case, the first one (the binary to start the compiler) can be missing but you absolutely need the tools.jar.

    You say that you have a tools.pack but I haven't heard about this one before. Use your package manager to search for openjdk and then look for a package in the result list which says jdk. On my system, that would be openjdk-7-jdk. Install this package and the error should go away.

提交回复
热议问题