Cannot Find Symbol error when compiling .java file

前端 未结 3 1776
刺人心
刺人心 2021-01-27 02:32

Good day, I have two classes, Map and Field, in the same directory. I successfully compiled Field.java but when i compile Map.java, i get this:

  Map.java:4: e         


        
3条回答
  •  死守一世寂寞
    2021-01-27 02:54

    Almost without question, the problem is that you have the CLASSPATH environment variable set, and your value does not include ".", the current directory. There are two different simple fixes for this problem: one would be to remove the environment variable, but that might break an installation of some third-party software that is depending on it. The second way to fix this is just to use the –classpath argument as part of your compile line:

    javac -classpath . Map.java 
    

提交回复
热议问题