错误: 找不到或无法加载主类 com.company.MaxTemperature
原因: java.lang.ClassNotFoundException: com.company.MaxTemperature
ERROR: MaxTemperature is not COMMAND nor fully qualified CLASSNAME
参考资料:
https://www.cnblogs.com/oxspirt/p/9377437.html
https://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
对于java
1、不设置CLASSPATH
java -classpath /Users/ruigong/IdeaProjects/p2/out/production/p2 com.company.MaxTemperature
classpath的路径包含.class,而不是.java
2、设置CLASSPATH
export CLASSPATH=/Users/ruigong/IdeaProjects/p2/out/production/p2
java com.company.MaxTemperature
对于hadoop
设置HADOOP_CLASSPATH
export HADOOP_CLASSPATH=/Users/ruigong/IdeaProjects/p2/out/production/p2
hadoop com.company.Maxtemperature sample.txt output