This class has a specified package
An error occurred when running java test from the command line: the main class usertest could not be found or loaded
- first of all, the user test needs to compile
the command, such as the folder where the user test.java is located, executes javac user test.java to compile. After compiling, the user test.class file appears in the directory where the user test.java is located, and then it can be run on the command line<
runs the usertest.class file through the Java command
first, let’s see what the package name written after the package of the class usertest.java is. My name is com.bean
when I run Java usertest in the bean directory, I report an error:
can't find or load the main class usertest
later, I see that someone says Java com.bean.usertest can run, and it really can run after a try. But Java usertest can’t run. Later, it is found that this class has a specified package
This class does not specify a package
1. Use javac usertest. Java to compile our. Java file
2. If the java file does not specify a package, just use the Java command to run our class file (Java usertest)
Read More:
- Idea startup project: main class not found or cannot be loaded
- The main class could not be found or loaded when springboot started
- The main class com.hp.springbootapplication cannot be found or loaded
- Problems encountered after Maven installation or upgrade: could not find or load main class org.codehaus.plexus .class…..
- Error: Could not find or load main class ***
- Error: could not find or load main class
- Could not find or load main class
- The Java command could not find or load the main class
- The media could not be loaded, either because the server or network failed or because the format is
- Tomcat9 Error: Could not find or load main class org.apache.catalina.startup.Bootstrap
- Idea error: unable to find or load the main class
- Error: Could not find or load main class org.apache.hadoop.hbase.util.HBaseConfTool
- Error in installing torch vision or pilot on Linux or Jetson nano: the headers or library files could not be found for JPEG
- [Solved] IntelliJ IDEA Compile Groovy Error: GroovyRuntimeException: This script or class could not be run.
- Java error: unable to find or load the main class
- Jstack command execution error: unable to open socket file: target process not responding or hotspot VM not loaded
- IntelliJ idea error: package not found or symbol not found
- WCF-HTTP Error 404.17 – Not Found, The requested content appears to be script and will not be served…
- PHP:Fatal error: Class ‘COM’ not found in … How to deal with the problem
- tensorflow import error: DLL load failed: The specified module could not be found (DLL load failed: The specified module could not be found)