Home > Back-end >  The novice consult: error: can't find or unable to load the main class how to solve
The novice consult: error: can't find or unable to load the main class how to solve

Time:10-19

Say the first computer configuration environment
Installation of jdk1.8.0 _221
Program is to use the NetBeans IDE 8.2
Also by browsing to post their configuration of the environment variable, but in the CMD command line running always quote could not find the mistake or unable to load the main class


Program is installed in the default directory



Configuration of environment variables also posted
Create the JAVA_HOME

This is the path variable configuration inside

Created a system variable CLASSPATH



Environment variables can be configured after the show version of


Source files in D disk folder, but through the CMD command line would be an error


But if it is running under the NetBeans IDE 8.2, will show success



Also read many posts online, some said without package field, some said environment variable configuration has a problem, I have tried and still no solution, turn to the great god see me is where configuration has a problem,

CodePudding user response:


Run a specified directory of the Java program with cp (classpath) parameter specifies the class file directory

CodePudding user response:

reference 1st floor also night reply:

Run a specified directory of the Java program with cp (classpath) parameter specifies the class file directory


Can you write in detail your command, I run the success or not

CodePudding user response:

refer to the second floor the teacher can't reply:
Quote: refer to 1st floor also night reply:


Run a specified directory of the Java program with cp (classpath) parameter specifies the class file directory


Can you write in detail your command, I run the success or not



Input the complete path, or add the path of the Java code path,
Java D: \ HelloWorldApp \ HelloWorldApp

CodePudding user response:

refer to the second floor the teacher can't reply:
Quote: refer to 1st floor also night reply:


Run a specified directory of the Java program with cp (classpath) parameter specifies the class file directory


Can you write in detail your command, I run the success or not

what do you want to take your project path, the test program because I wrote just below the D disk, D: \ \ path space class name

CodePudding user response:

references 4 floor also night reply:
Quote: refer to the second floor the teacher can't reply:

Quote: refer to 1st floor also night reply:


Run a specified directory of the Java program with cp (classpath) parameter specifies the class file directory


Can you write in detail your command, I run the success or not

what do you want to take your project path, the test program because I wrote just below the D disk, the path D: \ \ Spaces class name


That's what I post input, but still won't do!
The path of the Java write how to add to the path

CodePudding user response:

refer to 6th floor the teacher can't reply:
I post is so of the input, but still won't do!
Java write what path to path


Your package name all lowercase, case should pay attention to, to make clear his real name of the folder, the folder name=package name, don't write myself,

Java - cp D: \ helloworldapp helloworldapp
Or without cp directly
D: \ helloworldapp \ helloworldapp

Carefully when the command line, enter

Below point, new to join you the path of the Java program can
  • Related