For example, the following section of the source code (the source code is Cay S. Horstmann "Java Core Technology Volume 1: Fundamentals (10th edition English)" in the fifth chapter of the source):
Package abstractclasses;
Import java.time.*;
compile with Javac.
Then use Java and find always prompt "error: The main class could not be found or could not be loaded"
This is a very strange question.
The solution to the problem was later found to be simple:
1, first in the source code directory under the operation:
Javac-d. *.java
will produce a directory.
2, and then run
Java abstractclasses.persontest
to function properly.
Where abstractclasses is the package name. It is important to note that you do not switch directories.
The above is the problem solved in terminal. Is the same in CMD under Windows.
Solution with Package Java program not working under terminal after compilation