[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
时间: 2023-11-04 16:55:31 浏览: 43
这个错误信息是因为在你的环境中没有提供编译器。这可能是因为你正在使用JRE而不是JDK。JRE(Java Runtime Environment)只能运行Java程序,而JDK(Java Development Kit)除了可以运行Java程序外,还包含了编译器,可以将Java源代码编译成可执行的字节码。所以要解决这个问题,你需要安装和配置JDK。
如果你正在使用Eclipse,你可以按照这个链接中的步骤来解决这个问题:http://www.kriblog.com/ide/sts/error-no-compiler-is-provided-in-this-environment.-perhaps-you-are-running-on-a-jre-rather-than-a-jdk.html
如果你正在使用IntelliJ IDEA,你可以参考这两篇文章来选择IDE运行的JDK版本:
- http://www.yscyber.com/776.html
- https://blog.fandean.com/intellij-idea-selecting-the-jdk-version-the-ide-will-run-under/
另外,如果你对使用Go语言编写编译器感兴趣,可以参考这本书:《Writing A Compiler In Go》。这本书是《Writing An Interpreter In Go》的续篇,从上一本书结束的地方开始,讲述如何编写一个完整的、经过测试的Monkey编译器。
相关问题
Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
Compilation failure [ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 这个错误通常出现在使用Maven编译项目时,环境缺少编译器。这可能是由于您正在使用JRE而不是JDK所致。JRE(Java Runtime Environment)只提供了Java程序运行的环境,而JDK(Java Development Kit)不仅包含JRE,还包含了用于开发和编译Java程序的工具。确保正确安装并配置了JDK,并且在您的环境变量中正确设置了JAVA_HOME路径。
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
As an AI language model, I don't have the context to provide a specific solution. However, the error message suggests that you need to install a JDK (Java Development Kit) instead of a JRE (Java Runtime Environment) in order to compile your code. The JDK includes the compiler, while the JRE only includes the runtime environment. You can check your Java installation and make sure that you have the JDK installed. Alternatively, you can try using an online compiler or IDE that provides the necessary environment for compiling your code.