Read about java error could not find or load main class, The latest news, videos, and discussion topics about java error could not find or load main class from alibabacloud.com
Java class load basic process detailed introduction
Basic process:
Loads the binary byte stream of the definition class, based on the fully qualified name of the class.
Converts the static storage structure represented by a byte stream into the RUN-TIME data struc
MyClass ();} STATIC{SYSTEM.OUT.PRINTLN ("Test static 2");}} Class MyClass extends Test {person person = new Person ("MyClass"); static{ System.out.println ("MyClass Static"); } Public MyClass () { System.out.println ("MyClass constructor");} }
First guess his output, then compare, see what's wrong, deepen understanding
Test static 1test static 2myclass Staticperson Staticperson testtest Constructorperson Myclassmycl
The driver has been copied to the class path directory, and the specified class is not found, and then "jakarta-tomcat-5.0.28" for "jboss-4.0.2"
Org. springframework. jdbc. cannotGetJdbcConnectionException: cocould not get JDBC Connection; nested exception is org. apache. commons. dbcp. SQLNestedException: Cannot load JDBC driver
the base class again subclass.
Initializes the static variable, which needs to be loaded before executing the main () method. Then the main method, if new, initializes the basic member variables of the object class (non-Methods), including building blocks of code, which are executed sequentia
When a program calls a class and the class is not loaded into memory, our system initializes the class with the following three steps:1. Loading of classesClass loading refers to the reading of a class file into memory and creating a Java.lang.Class object for it. Class is l
Class Mount steps:In Java, the class loader to load a class into a Java virtual machine, to go through three steps to complete: loading, linking and initialization, wherein the link can be divided into the verification, preparatio
1. When the virtual machine loads the Java class for the first time, it initializes the static initialization block, the static member variable, and the static method once.2. An instance of the class is created only when the new method is called3, the class instance creation process: Initializes according to the parent
Let's go back to classpath.The role of Classpath:The function of classpath is to specify the path to the lookup class: When a class is executed using Java commands (the main method in the class), the class is looked up from the cl
officeable{ @Override public void Start () { System.out.println ("Word: Start ");} }The following is the Officebetter class for testingPackage Com.test;public class Officebetter {public static void Main (string[] args) { String classname= "com.test . word "; System.out.println ("classname=" +classname); try {
How do I implement a project in which different modules load different versions of the jar package with the same name?It was Ali's interview when he met a face test. At that time a bit dizzy, if it is usually encountered such a problem must be unified load the same version of the good.It is really necessary to address such problems if the system is particularly large and relies heavily on conflict and invol
Scene:
Put the class files and jars in the project into the D:\loader\terry\codex directory, how to get the project to load and use these classes in code way.
Scenario: Using URLClassLoader constructs D:\loader\terry\codex the class loader under this path, and uses these classes to instantiate through the Java reflect
Reflection in Java: How to construct a load classPackage Com.ma.reflection;import Java.lang.reflect.constructor;import Java.lang.reflect.InvocationTargetException Import Org.junit.test;import com.ma.bean.userbean;/** * Reflection: Load Construction Method * @author MA * */public class Demo2 {/** * Reflection: The param
Java Project load configuration file tool class
Package com.loadproperties;
Import java.io.IOException;
Import Java.io.InputStream;
Import java.util.Properties;
public class Configutil {private static inputstream input;
Private volatile properties Configuration = new properties ();
A single instance of private
When a Java virtual machine loads a class, it initializes the parent static variable, initializes the child class static variable, loads the parent class, and finally loads the subclasspublic class Parent {static{System.out.println ("Static parent");}Public Parent () {SYSTEM
For a long time not to see this content, write an article Let yourself remember, by the way share.First, write the code to test the results.Test code: Public class Test { publicstaticvoid main (string[] args) { new Test2 (); }}View CodeSub-class Code: Public classTest2extendstest3{{System.out.println ("Subclass code Block"); } PrivateString addre
The way to load a Java load library is related to its classloader, and different JVMs have different classloader. The loading order of the J2SDK JVM is now described.
First, Java will load the jar (ZIP, directory) contained in the parameters according to the system's param
When analyzing the cause of a program error, it is useful to understand its state of the day. In many cases, we can do this through a stack trace, but this information is often unavailable, or you may need information about the program's handling of the data in case of an error.
The traditional approach is to use a record framework such as the log4j and Java Logging APIs, and then manually write and maintain the required record statements. This is a
When I started the project today, I encounteredJava.lang.illegalstateexception:Cannot Find the System Java compiler. Check that your class path includes Tools.jarThe main reason is because the compiler could not find Tools.jar at compile timeSolution One: Copy the%java_home%
The class initialization phase is the last step in the loading process, where the variable has already assigned the initial value of the system requirement, and during the initialization phase, the class variables and other resources are initialized according to the programmer's subjective plan, or from another angle: the initialization stage is the execution class
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.