Home  >  Article  >  Java  >  cmd running 'java -version' prompts that the main class cannot be found or cannot be loaded

cmd running 'java -version' prompts that the main class cannot be found or cannot be loaded

王林
王林Original
2020-02-05 16:17:265428browse

cmd running 'java -version' prompts that the main class cannot be found or cannot be loaded

Problem:

Input: java -version Error

Error: Main class-version cannot be found or cannot be loaded

(Related video tutorial sharing: java video tutorial)

Solution:

Under system variables, create a new CLASSPATH variable and add

.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

Note: Add ## at the beginning.; at the end #;Next time you run it, restart cmd and then run java -version.

Related tutorial sharing:

java introductory tutorial

The above is the detailed content of cmd running 'java -version' 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