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