I am working in linux. I have a main java file called Main.java and a class file called Person.java.When I run "java Main.java". It outputs this error. How do I fix this?
Main.java:3: error: cannot access Person
Person person = new Person("A name", 22);
^
bad class file: ./Person.class
illegal start of class file
Please remove or make sure it appears in the correct subdirectory of the classpath.
1 error
error: compilation failed
java -cp searchDir classFile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.