javac无法运行,而且似乎没有安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18217853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 23:24:11  来源:igfitidea点击:

javac cannot be run, and furthermore does not seem installed

javajavac

提问by Irina Matveeva

I have a problem involving setting up Java.

我有一个涉及设置 Java 的问题。

I have installed the JRE, added its path to PATH, and set JAVA_HOMEand CLASSPATH. Now, javaand javacplwork fine, but running javacgenerates a command-not-found error. Furthermore, javac.exedoes not even seem to exist in the JRE's binfolder.

我已经安装了 JRE,将其路径添加到PATH, 并设置JAVA_HOMECLASSPATH. 现在,javajavacpl做工精细,但运行javac生成命令未找到错误。此外,javac.exe甚至在 JRE 的bin文件夹中似乎都不存在。

How do I run javac?

我怎么跑javac

回答by Ken Liu

The JRE is merely the Java Runtime Environment, which includes only the infrastructure needed to run Java programs that are already compiled.

JRE 仅仅是Java 运行时环境,它仅包括运行已编译的 Java 程序所需的基础结构。

To compile Java source code using javac, you need the Java Development Kit(JDK).

要使用 编译 Java 源代码javac,您需要Java 开发工具包(JDK)。

On Oracle's Java download page, choose the package labelled "JDK".

在 Oracle 的Java 下载页面 上,选择标有“JDK”的包。

回答by Chris Mantle

The JRE doesn't have javac - you need to download the JDK (Java Development Kit).

JRE 没有 javac - 您需要下载 JDK(Java 开发工具包)。

回答by darxtrix

First, you need to install the jdk, then add the path of bin folder of jdk in the path vaiable.

首先需要安装jdk,然后在路径vaiable中添加jdk的bin文件夹的路径。

you can refer to this link

你可以参考这个链接

回答by TechDog

In order to use javac in cmd , JDK must be installed in your system...

为了在 cmd 中使用 javac ,必须在您的系统中安装 JDK ...

javac will not work if you are pointing "bin" folder inside JRE (C:\Program Files\Java**jre7**\bin)

如果您指向 JRE (C:\Program Files\Java**jre7**\bin) 中的“bin”文件夹,javac 将不起作用

Please check for javac.exe inside your bin folder(C:\Program Files\Java**jdk1.7.0_45**\bin)

请检查您的 bin 文件夹中的 javac.exe (C:\Program Files\Java**jdk1.7.0_45**\bin)

javac.exe must be inside JDK(C:\Program Files\Java\jdk1.7.0_45\bin) not inside JRE(C:\Program Files (x86)\Java\jre7\bin) "JRE doesn't come with a compiler. It is simply a java runtime environment. What you need is the developmental kit."in order to use compiler javac

javac.exe 必须在JDK(C:\Program Files\Java\jdk1.7.0_45\bin) 内,而不是在JRE(C:\Program Files (x86)\Java\jre7\bin) 内 “JRE 没有附带编译器。它只是一个java运行时环境。你需要的是开发工具包。” 为了使用编译器 javac

For javac path(Points to remember while setting system env variable)

对于 javac 路径(设置系统环境变量时要记住的要点)

path = C:\Program Files (x86)\Java\jre7\binthis is wrong

path = C:\Program Files (x86)\Java\jre7\bin这是错误的

path = C:\Program Files\Java\jdk1.7.0_45\binthis is correct

path = C:\Program Files\Java\jdk1.7.0_45\bin这是正确的

Make sure "javac.exe" must be inside your "C:\Program Files\Java\jdk1.7.0_45\bin"

确保“javac.exe”必须在你的“C:\Program Files\Java\jdk1.7.0_45\bin”中

Dont confuse with JRE and JDK both are totally different

不要混淆 JRE 和 JDK 两者完全不同

if you dont have JDK pls download from this link http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

如果您没有 JDK 请从此链接下载http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

reference thread for JDK VS JRE What is the difference between JDK and JRE?

JDK VS JRE 的参考线程 JDK 和 JRE 有什么区别?

Procedure:-

程序:-

  1. Install JDK

  2. open cmd prompt

  3. type "cd C:\Program Files\Java\jdk1.7.0_45\bin "press enter(path may change based on jdk version and 32bit and 64bit os version)

  4. type "javac"press enter

  1. 安装JDK

  2. 打开cmd提示

  3. 输入“cd C:\Program Files\Java\jdk1.7.0_45\bin”回车(路径可能会根据jdk版本和32位和64位操作系统版本而变化)

  4. 输入“javac”按回车

its done

完成

Now go and change your system environment variable path = C:\Program Files\Java\jdk1.7.0_45\bin

现在去改变你的系统环境变量 path = C:\Program Files\Java\jdk1.7.0_45\bin

this will set the path permanently

这将永久设置路径