search
HomeJavaJavagetting StartedWhat should I do if java prompts that the main class cannot be found or cannot be loaded?

Solution to the java prompt that the main class cannot be found or cannot be loaded: 1. Open the advanced system settings and enter the environment variable settings; 2. Create a new JAVA_HOME variable and set the jdk installation path; 3. Edit the PATH variable and add Bin directory path, click [OK].

What should I do if java prompts that the main class cannot be found or cannot be loaded?

#Solution:

Just set the environment variables.

(Recommended tutorial: java course)

Specific method:

Right-click the "Properties" option of "This Computer" on the computer desktop

Select the "Advanced System Settings" option

Click the "Environment Variables" option below

The next step is the specific configuration process:

Click "System Variables" In the "New" option below

fill in "Java_Home"

"Variable value" in the "Variable name" is the JDK installation path. The author's path is "D:\Program Files\Java \jdk1.8.0_91"

Click "OK" option

Find "Path" in "System Variables"

Select "Path" and click "Edit" option

Select "Edit Text" on the right, copy everything in the quotation marks "%Java_Home%\bin;%Java_Home%\jre\bin;" to the front of the "Variable Value" column, and "OK"

In the "System Variables" column, "New", the "Variable Name" is "CLASSPATH", and the "Variable Value" is ".;%Java_Home%\bin;%Java_Home%\lib\dt.jar;%Java_Home %\lib\tools.jar", "OK"

Click the "OK" option at the bottom of "Environment Variables".

Related recommendations:Getting started with java

The above is the detailed content of What should I do if java prompts that the main class cannot be found or cannot be loaded?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment