Should JAVA_HOME point to JDK or JRE?

前端 未结 8 2018
隐瞒了意图╮
隐瞒了意图╮ 2020-12-03 00:09

I pointed the JAVA_HOME to C:\\Program Files (x86)\\Java\\jre7. It works fine. Afterwards, I unzipped ant and set up the environment variables rela

相关标签:
8条回答
  • 2020-12-03 00:41

    You can use either the JDK or the JRE but:

    JAVA_HOME is used by the launcher for finding the JDK/JRE to use. (JDK is recommended as some tasks require the java tools.)
    . ANT_HOME setting

    0 讨论(0)
  • 2020-12-03 00:42

    For people late to the party and learning it now, it doesn't matter now since new JDK versions don't have separate JRE folder. So, we can point to JDK and be done with it.

    0 讨论(0)
  • 2020-12-03 00:50

    If you're doing any sort of development, or building with Maven or Ant, you need to point to the JDK (Java Development Kit) where utilities such as javac (the Java Compiler) reside. Otherwise, you can point to the JRE (Java Runtime Environment).

    The JDK contains everything the JRE has and more. If you're just executing Java programs, you can point to either the JRE or the JDK.

    0 讨论(0)
  • 2020-12-03 00:53

    Generally, it does not matter if you point it at JRE or JDK. It depends on the application which uses it. Ant documentation says you should point it at JDK to get all Ant's features.

    0 讨论(0)
  • 2020-12-03 01:01

    Let's keep it simple. Go to settings and search "Environment Variables". Once environment variables window pops up, simply create a new SYSTEM variable by clicking on NEW and then BROWSE DIRECTORY until you locate the install path of the JDK. The JDK should be installed in program files and you will see a JAVA folder and inside the folder is JDK and JRE... If you write code you must select JDK!!! Do not listen to anyone stating JRE will suffice... NO! It will NOT! The proper directory should look like this C:\Program Files\Java\jdk1.8.0_144 it's as simple as that!

    0 讨论(0)
  • 2020-12-03 01:05

    My JAVA_HOME points to the JDK. If it still doesn't work, check if you downloaded ant for Java 7 and not for Java 6.

    0 讨论(0)
提交回复
热议问题