Compile HelloWorld.java to generate the bytecode file
HelloWorld.class, and run
HelloWorld.class to report an
error: Error: Could not find or load main class.
The current directory is the directory where the .class file is located. To run the .class bytecode file, you need to add the current directory to the system variable CLASSPATH so that the system can find the Java class in the current directory.
classpath path is entered incorrectly, you need to enter the current path and add
.: in front of the original path
step 1: Add the
CLASSPATH system variable at the end of the profile file under /etc
. represents the current path.
CLASSPATH in the original
/etc/profie file is:
The increased CLASSPATH is:
Step 2: Enter source
/etc/profie on the command line to make the system variables in
/etc/profile take effect, and you can run it.