Java beginners install jdk some problems

czuf_zq 注册会员
2023-02-27 14:13

Please refer to my article to configure the JDK environment, any problem message:

1. If you want to develop Java, you need to install and configure JDK, including JRE(Java Running environment)
2. If you only use java server or application as running environment, you can install and configure JRE.

Also: Most JRE environments that Java open source frameworks rely on are indexed from JAVA_HOME, and many typical Java service frameworks are indexed directly from JRE_HOME.
If you make your own standard Java application(for example, a jar file that includes the java main method using only the standard java library), you can customize the dependency on HRE_HOME. Example: Java Server

with standard RMI fixed word
hainancyp 注册会员
2023-02-27 14:13

This answer quotes ChatGPT

Yes, the JDK includes JRE, so after installing the JDK, you do not need to install an additional JRE.

When configuring environment variables, you need to be sure to add the JDK's "bin" folder Path to the "path" variable. Also, in order for the JDK to work, you need to add the JAVA_HOME system variable.

JAVA_HOME is a system variable that points to the JDK installation directory, for example, C:\Program Files\Java\jdk1.8.0_281. It is used to tell the system where to install the JDK. If you do not set JAVA_HOME in your environment variables, your Java application may not be able to find the JDK, resulting in a runtime error.

Adding %JAVA_HOME%\bin to the Path variable adds the JDK executable path to the system path. This will allow you to run commands such as the java compiler(javac.exe) and Java Virtual Machine(java.exe) from the command line without having to specify a full path.

Adding %JAVA_HOME%\jre\bin to the Path variable will allow you to run your Java application from the command line(for example, by using java commands) because it contains the Java runtime environment(JRE). This step is not necessary because the JDK already includes the JRE, but it can help ensure that the Java application has the correct runtime environment at runtime.

Therefore, the correct thing to do is to add JAVA_HOME to the system variable and %JAVA_HOME%\bin to the Path variable. If you want to run a Java application, you can also add %JAVA_HOME%\jre\bin to the Path variable.

qq328170374 注册会员
2023-02-27 14:13

1.JDK contains jre. You do not need to download jre.
2. Define the environment variable JAVA_HOME and add the first one to the system variable PATH.

evold0825 注册会员
2023-02-27 14:13

JDK = JRE + development tool(such as Javac compiler)
JRE = JVM + Java SE jre is included in the standard class library
If you only need to run java programs, just install the jre; However, to do development, you need to use the "development tool set", so you need to install the jdk.

Just learning java, you can check out the java video of Silicon Valley on Bilibili.

fyb3526642 注册会员
2023-02-27 14:13

the reference answer GPT ᴼ ᴾ ᴱ ᴺ ᴬ ᴵ < br / > after download the JDK, does not need additional download JRE, because the function of the JDK includes the JRE, So you just need to install the JDK.

For configuring environment variables, adding the system variable JAVA_HOME and adding %JAVA_HOME%\bin to the user variable Path are both required steps. Also, it is good practice to include %JAVA_HOME%\jre\bin in the Path variable to ensure that the system can find the Java runtime environment it needs.

If only the %JAVA_HOME%\bin path is added without the %JAVA_HOME%\jre\bin path, some problems may occur. For example, when executing some Java programs, you may fail to run properly because you cannot find the path to the JRE, or when developing a Java Web application, you may cause a Web server such as Tomcat to fail to start.

Therefore, you are advised to add %JAVA_HOME%\jre\bin to the Path variable to ensure that the Java runtime environment can be used properly.

djj125 注册会员
2023-02-27 14:13

It is recommended that you use idea directly, idea can choose the JDK version, and then for your problem, generally, add the system variable is OK, The following two configurations are usually the default configurations in the default configuration file that comes with you.

About the Author

Question Info

Publish Time
2023-02-27 14:13
Update Time
2023-02-27 14:13

Related Question

singleR安装报错 "use `force = TRUE` to re-install",如何解决?






CosmosDB SQL JavaSDK:选择不同的数据模型

在macbook M1上安装pecl install sqlsrv时出现问题