Java is the computer programming language which class based, object oriented and specifically designed to create the implementation dependencies as possible as. In fact, Java is one of the most popular programming language which used by many developers. Especially, it often use to client server applications. Sometime, there are the problems which can occur in Java. One of the most common problems is the error message which displayed “Could not find or load main class”. Have you ever got this error message? Do you know what the solution to fix this error? Actually, this error is not serious problem. So you can fix it easily by yourself. There is the method to find out the solution of this error.
Well, at the moment, in this article we will explain the method to fix the error message: “Could not find or load main class”. If you are experiencing this problem, you can follow the instruction step by step in the following text. Once Java cannot find the main class, you can solve this problem by several steps. At first you have to make sure that you add the location of your class file to the specified classpath. In this step, you will need to use your preferences of IDE. Here is the step if you are using Eclipse, please follow it steps by step.
- At first you have to go to “Project”.
- Then you can go to “Properties”.
- After that you can select “Java Build Path”.
- The next step, please select “Add Class Folder”.
In a case, what do we do when class in a package? If you find that your class in a package so can try the below command:
java – classpath thepackagename TheClassName
There are two different types of Classpath separators. For Linux it is a colon, than for Windows it is a semicolon. In fact, there are many other different in Linux and Windows. If you want to know more about the differences among Linux and Windows Java codes, so you can search for its explanation in other website. There are many sites which explain the material about the differences among Linux and Windows Java codes.