Java致命错误:无法在类路径或bootclasspath中查找包java.lang [英] Java Fatal Error: Unable to find package java.lang in classpath or bootclasspath

查看:9191
本文介绍了Java致命错误:无法在类路径或bootclasspath中查找包java.lang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我尝试建立/编译任何项目时,我在IntelliJ上有错误:java:致命错误:无法在类路径或bootclasspath 中找到包java.lang。这里应该声明的是,NETBEANS,Eclipse甚至javac命令行可以编译并执行相同的项目没有错误,这就是为什么我说的问题是INTELLIJ,所有其他IDE工作良好。

Im having the Error:java: Fatal Error: Unable to find package java.lang in classpath or bootclasspath on my IntelliJ when i try to build/compile ANY project. Something that should be stated here is that NETBEANS, Eclipse and even the javac command line can compile build and execute the same project without errors, this is why i am saying that the problem is with INTELLIJ, all other IDE works well.

在IntelliJ中已经:

  • 重新启动重新安装
  • 无效缓存/重新启动
  • 在项目JDK中读取JDK
  • 在平台设置中删除/读取JDK
  • 重建/重新编译

    In IntelliJ i already:

  • Restarted Reinstalled
  • Invalidate Caches / Restarted
  • Deleted/Readded the JDK in Project JDK
  • Deleted/Readded the JDK in Platform Settings
  • Rebuild / Recompile


  • 删除/重新安装了java SDK
  • 删除/读取了系统变量上的JAVA_HOME,PATH和CLASSPATH
  • 尝试了上面的用户变量
  • 删除和重新安装IntelliJ IDEA

    In Windows i already:

  • Deleted / Reinstalled java SDK
  • Deleted / Readded the JAVA_HOME, PATH and CLASSPATH on System Variables
  • Tryed the above on User Variables
  • Deleted and Reinstalled IntelliJ IDEA

    在Internet已经为这样的问题已经预订了i MANY源,这里StackOverflow我发现:

    问题#1 | 问题#2 | 问题#3 | 问题#4 | 问题#5
    < br>和30多个网站,并尝试每一个答案...

    在这里,你可以看到我的IntelliJ项目上次我尝试构建/编译的结构



    当我得到这个错误,我使用Java 1.8,几个小时后,我安装了Java 1.7和项目工作正常。 。也许IntelliJ不支持Java 1.8?无论如何,如果有人知道一种方法使Java 1.8工作在IntelliJ上,问题仍然存在。

    In Internet already seached for issues like this i MANY sources, here on StackOverflow i found:
    Question #1 | Question #2 | Question #3 | Question #4 | Question #5
    And 30+ sites, and tried every answer...
    Here you can see my IntelliJ Project Structure on last time that i tried to build/compile

    I was using Java 1.8 when i get this error, after some hours i installed Java 1.7 and the project worked fine... maybe IntelliJ dont support Java 1.8? Anyway, if anyone knows one way to make the Java 1.8 work on IntelliJ the question still open.

    推荐答案

    问题来自IntelliJ bug(至少在版本14中存在)。
    当JDK目录位于用户配置文件目录下时,会发生这种情况。例如,JDK位于此目录中(对于Windows):

    The problem comes from IntelliJ bug (existing at least in version 14). It happens when your JDK directory is under the user profile directory. For example, JDK located in this directory (for Windows):

    C:\Users\myuser\jdk1.8.0_20

    C:\Users\myuser\jdk1.8.0_20

    将存储在IntelliJ内部配置(文件'jdk.table.xml')中:

    will be stored in IntelliJ internal configuration (file 'jdk.table.xml') as:

    $ USER_HOME $ \jdk1.8.0_20

    但您的%USER_PROFILE%在一些其他(非默认)位置。然后IntelliJ将查看错误的目录。

    But your %USER_PROFILE% environment variable could point at some other (non default) location. Then IntelliJ will look at the wrong directory.

    可能的修复:
    在不同的目录安装JDK, strong>喜欢:

    Possible fix: Install your JDK at different directory, which is outside your profile directory. Like:

    C:\Programs\jdk1.8.0_20

    然后注册此JDK以用于IntelliJ项目设置。

    Then register this JDK for use in your IntelliJ project settings.

    这篇关于Java致命错误:无法在类路径或bootclasspath中查找包java.lang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆