Error: Could not find or load main class问题解决

错误如下: D:>java Hello Error: Could not find or load main class Hello 代码如下: import org.apache.log4j.Logger; import org.apache.log4j.BasicConfigurator; public class Hello { private static final Logger logger = Logger.getLogger(Hello.class); public static void main(String argv[]) { BasicConfigurator.configure(); logger.debug(“Hello world.”); logger.info(“What a beatiful day.”); } } Java环境变量设置有问题,没有包括本目录,解决方法一: 在命令行中指定Classpath D:>java -classpath “.;D:\apache-log4j-1.2.16\log4j-1.2.16.ja r” Hello 0 [main] DEBUG Hello – […]