Minor problems with running Java programs under CMD

Source: Internet
Author: User

About JDK and JRE:

The JDK full name is Java Development Kit, the Java Language Software Development Toolkit, which contains the Java Runtime Environment and development tools.

The JRE full name is the Java Runtime Environment, which is the Java run environment. This means that the JRE is included in the JDK.

If you only have the JRE installed, you can only run the compiled bytecode file, the. class file. In the case of Java source files, you will need to install the JDK, compile the. java file into a. class bytecode file using the Javac in the JDK, and then use Java.exe to interpret the compiled. class file and the final output to get the run result.

CMD run Java program encountered some problems:

  

Here are two things that are different from what is expected, first of all picked up java_tool_options:-dfile.encoding=utf-8, which means to indicate that the environment variable is being loaded, actually this is not a mistake, just a hint, The reason for this is that the Java environment variable and other environment variables conflict, by the way this environment variable is to tell Java bytecode encoding is UTF8, and the Windows command line is GBK, so the existence of this environment variable is to prevent garbled. (Even so, I deleted this environment variable because I found that the environment variable should not be used for the time being ...)

Then just can't find the main class this problem, this problem for a long time, and later found that the environment variable configuration error. There is a doubt that since the environment variable is misconfigured, why didn't I get the problem when I wrote the Java program on eclipse? Because... Eclipse does not use the classpath you have configured, but rather uses the environment variables it sets itself. Classpath parameters should be preceded by.; (I just have fewer of these two characters before the problem, where.) represents the current directory ... Indicates returning to the previous level of directory

OK, when the environment variable is configured correctly, no problem.

  While I feel like writing in Notepad, running a Java program under CMD, it looks stupid, but it does make you understand something that's really rational.

Minor problems with running Java programs under CMD

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.