Remember an eclipse question about JDK and JRE and talk about javac

Today, my colleague encountered a problem and found that the import package actually reported an error, but the package actually existed. Generally, if there is a problem with a class or a method in the class, a red line will always be displayed in the IDE. But this time there is no problem. I find the sub module of this class and use MVN install. I have encountered this error before. Update project alone is useless. Update project is mainly used for synchronization. For example, I add other third-party plug-in dependencies to the parent project. It is needed in some places. Sometimes, it has been imported, but I can't use it. In this case, just update project. Depending on the size of the whole project, the time required is different. If the project is too large, the time of update project may be too long.

Paste errors about MVN install:

No compile is provider in this environment Perhaps you are running on a JRE rather then a JDK

Translation means:

There are no compiler providers in this environment. Maybe you're running JRE instead of JDK

Many blogs only talk about how to solve it, not why.

Of course, small partners with many years of development experience can see it at a glance. Just know how to solve it.

Here I want to talk about the difference between JDK and JRE. Although this is also a clich é, this time I want to talk about something different in combination with this error.

JDK and JRE have the following differences:

Similarities:

Java programs can be run. JRE is included in JDK. JRE itself is the Java running environment.

difference:

The full name of JDK is "java development kit", and the full name of JRE is "Java running environment":

JRE is the abbreviation of Java runtime environment (Java runtime environment). The JVM alone cannot let the class file execute, because the JVM needs to call the class library lib required for class interpretation. You can find the JRE directory in the installation directory of JDK,

There are two folders, bin and lib. Here, it can be considered that the JVM is in bin, and the class library required by the JVM is in lib, and the combination of JVM and lib is called JRE. So when you finish writing a java program, it's time Java file, when it is compiled into Class file, you can put this Send the class file and JRE to your friends so that your friends can run the program you write (there is java.exe running. Class in JRE).

JDK: JDK is a java development kit (java development kit). Every java developer will first install a JDK on the machine. Let's take a look at the JDK installation directory. Under the directory, there are six folders, a SRC class library source code zip package, and several other declaration files. Among them, the following four folders really work when running Java: bin, include, lib, JRE. Now I We can see that the JDK contains JRE and JRE contains JVM.

A conclusion can be drawn from the comparison between JRE and JDK, that is, JDK can run without JRE, because it contains JRE, and JRE can run without JDK, because it can run Class java exe。 This is also one of the common questions of Java interview foundation.

For the principle of Java compilation, please refer to my blog: talk about javac

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>