初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

时间:2022-06-10 17:10:12

I'm trying to install Java to use Eclipse (I followed all instructions to install Java and Eclipse) but my Eclipse is not starting due to some bad configuration I guess. I can't figure out why it's not working for me.

我正在尝试安装Java来使用Eclipse(我按照所有说明安装了Java和Eclipse)但是我的Eclipse由于一些错误的配置而无法启动。我无法弄清楚为什么它不适合我。

Eclipse Installation:

  1. Extracted Eclipse at C:\eclipse
  2. 在C:\ eclipse中提取Eclipse

  3. Created a shortcut to my desktop having target C:\eclipse\eclipse.exe
  4. 创建了具有目标C:\ eclipse \ eclipse.exe的桌面快捷方式

When I try to run Eclipse with this shortcut, I see following Eclipse splash screen for a second and it disappears. Eclipse does not start at all.

当我尝试使用此快捷方式运行Eclipse时,我会看到关注Eclipse启动画面一秒钟后它会消失。 Eclipse根本没有启动。

初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

JAVA Installation:

  1. Installed JDK at C:\Program Files\Java\jdk1.7.0_10
  2. 在C:\ Program Files \ Java \ jdk1.7.0_10安装了JDK

  3. Installed JRE at C:\Program Files\Java\jre7
  4. 在C:\ Program Files \ Java \ jre7安装了JRE

Environment Variables Configuration:

环境变量配置:

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_10
PATH = C:\Program Files\Java\jdk1.7.0_10\bin;

I tested my Java installation using the console and figured out this issue but I don't know how to fix it, and I guess this is causing Eclipse not to start.

我使用控制台测试了我的Java安装并找出了这个问题,但我不知道如何修复它,我想这会导致Eclipse无法启动。

Problem:

初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

10 个解决方案

#1


21  

Go to Eclipse folder, locate eclipse.ini file, add following entry (before -vmargs if present):

转到Eclipse文件夹,找到eclipse.ini文件,添加以下条目(如果存在,则在-vmargs之前):

-vm
C:\Program Files\Java\jdk1.7.0_10\bin\javaw.exe

Save file and execute eclipse.exe.

保存文件并执行eclipse.exe。

#2


7  

Check that downloaded eclipse/JDK/JRE is compatible with your processor/OS architecture that is are they 32bit or 64bit?

检查下载的eclipse / JDK / JRE是否与32位或64位的处理器/操作系统架构兼容?

#3


5  

please try to execute java from

请尝试从中执行java

C:\Program Files\Java\jdk1.7.0_10\bin

i.e from the location where java is installed.

即从安装java的位置。

If it is successful, it means that the error lies somewhere in the classpath.

如果成功,则表示错误位于类路径中的某处。

Also, this guy seems to have had the same problem as yours, check it out

此外,这家伙似乎遇到了与你相同的问题,请查看

#4


3  

Not able to run Appium {“message”:”A new session could not be created. (Original error: ‘java -version’ failed

无法运行Appium {“message”:“无法创建新会话。 (原始错误:'java -version'失败

I used Jdk 1.8 and JRE 1.8, Classpath is also set properly but I observed that Java command gives Error to initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)

我使用了Jdk 1.8和JRE 1.8,Classpath也设置正确,但我观察到Java命令为VM的初始化提供了错误(java / lang / NoClassDefFoundError:java / lang / Object)

Solution:
Uninstalled JRE and JDK completely 
Installed JRE 1.8 then
Installed JDK 1.8 
Set Classpath
check Java command works or not and its working 
also able to execute the Appium program thru Eclipse Kepler Service Release 2 with JDK1.8 support

#5


1  

Try placing the desired java directory in PATH before not needed java directories in your PATH.

尝试在PATH中不需要java目录之前将所需的java目录放在PATH中。

#6


1  

I had the same error in my case was when I needed to update jdk 7 to jdk 8, and my bad was just I installed jdk8 and I never installed jre8, only that, the error was solved immediately when I installed jre8.

在我的情况下,当我需要将jdk 7更新为jdk 8时,我遇到了同样的错误,而我的错误只是我安装了jdk8并且我从未安装过jre8,只有这样,当我安装jre8时,错误立即解决了。

#7


1  

I had the same issue on Windows 7 and I had to install both JDK and JRE and it's a success.

我在Windows 7上遇到了同样的问题,我不得不同时安装JDK和JRE,这是成功的。

#8


0  

I faced the same problem,Eclipse splash screen for a second and it disappears.Then i noticed due to auto update of java there are two java version installed in my system. when i uninstalled one eclipse started working.

我遇到了同样的问题,Eclipse启动画面一秒钟就消失了。然后我注意到由于java的自动更新,我的系统中安装了两个java版本。当我卸载一个eclipse开始工作。

Thanks you..

#9


0  

I just spent about 1 hour to figure out possible solution for the same error.

我花了大约1个小时来找出同样错误的可能解决方案。

So what I did under MS WIndows 7 is following

所以我在MS WIndows 7下所做的就是关注

  1. Uninstall all Java packages of all versions.

    卸载所有版本的所有Java包。

  2. Download last packages Java SE or JRE for your 32 or 64 Windows and install it.

    下载适用于32或64 Windows的最新软件包Java SE或JRE并进行安装。

  3. First install JRE and second is Java SE.

    首先安装JRE,其次是Java SE。

初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

  1. Open text editor and paste this code.

    打开文本编辑器并粘贴此代码。

    public class Hello {

    公共类Hello {

      public static void main(String[] args) {
    
         System.out.println("test");
    
      }
    
    } 
    
  2. Save it like Hello.java

    像Hello.java一样保存它

  3. Go to Console and compile it like

    转到控制台并编译它

javac Hello.java

  1. Execute the code like
  2. 像执行代码一样

java Hello

初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

Should be no error.

应该没有错误。

#10


0  

sometime you missed some file like I missed my one file rt.java so better to check yours .........

有时你错过了一些文件,比如我错过了我的一个文件rt.java,所以最好检查你的.........

C:\Program Files\Java\jdk1.8.0_112\jre\lib

#1


21  

Go to Eclipse folder, locate eclipse.ini file, add following entry (before -vmargs if present):

转到Eclipse文件夹,找到eclipse.ini文件,添加以下条目(如果存在,则在-vmargs之前):

-vm
C:\Program Files\Java\jdk1.7.0_10\bin\javaw.exe

Save file and execute eclipse.exe.

保存文件并执行eclipse.exe。

#2


7  

Check that downloaded eclipse/JDK/JRE is compatible with your processor/OS architecture that is are they 32bit or 64bit?

检查下载的eclipse / JDK / JRE是否与32位或64位的处理器/操作系统架构兼容?

#3


5  

please try to execute java from

请尝试从中执行java

C:\Program Files\Java\jdk1.7.0_10\bin

i.e from the location where java is installed.

即从安装java的位置。

If it is successful, it means that the error lies somewhere in the classpath.

如果成功,则表示错误位于类路径中的某处。

Also, this guy seems to have had the same problem as yours, check it out

此外,这家伙似乎遇到了与你相同的问题,请查看

#4


3  

Not able to run Appium {“message”:”A new session could not be created. (Original error: ‘java -version’ failed

无法运行Appium {“message”:“无法创建新会话。 (原始错误:'java -version'失败

I used Jdk 1.8 and JRE 1.8, Classpath is also set properly but I observed that Java command gives Error to initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)

我使用了Jdk 1.8和JRE 1.8,Classpath也设置正确,但我观察到Java命令为VM的初始化提供了错误(java / lang / NoClassDefFoundError:java / lang / Object)

Solution:
Uninstalled JRE and JDK completely 
Installed JRE 1.8 then
Installed JDK 1.8 
Set Classpath
check Java command works or not and its working 
also able to execute the Appium program thru Eclipse Kepler Service Release 2 with JDK1.8 support

#5


1  

Try placing the desired java directory in PATH before not needed java directories in your PATH.

尝试在PATH中不需要java目录之前将所需的java目录放在PATH中。

#6


1  

I had the same error in my case was when I needed to update jdk 7 to jdk 8, and my bad was just I installed jdk8 and I never installed jre8, only that, the error was solved immediately when I installed jre8.

在我的情况下,当我需要将jdk 7更新为jdk 8时,我遇到了同样的错误,而我的错误只是我安装了jdk8并且我从未安装过jre8,只有这样,当我安装jre8时,错误立即解决了。

#7


1  

I had the same issue on Windows 7 and I had to install both JDK and JRE and it's a success.

我在Windows 7上遇到了同样的问题,我不得不同时安装JDK和JRE,这是成功的。

#8


0  

I faced the same problem,Eclipse splash screen for a second and it disappears.Then i noticed due to auto update of java there are two java version installed in my system. when i uninstalled one eclipse started working.

我遇到了同样的问题,Eclipse启动画面一秒钟就消失了。然后我注意到由于java的自动更新,我的系统中安装了两个java版本。当我卸载一个eclipse开始工作。

Thanks you..

#9


0  

I just spent about 1 hour to figure out possible solution for the same error.

我花了大约1个小时来找出同样错误的可能解决方案。

So what I did under MS WIndows 7 is following

所以我在MS WIndows 7下所做的就是关注

  1. Uninstall all Java packages of all versions.

    卸载所有版本的所有Java包。

  2. Download last packages Java SE or JRE for your 32 or 64 Windows and install it.

    下载适用于32或64 Windows的最新软件包Java SE或JRE并进行安装。

  3. First install JRE and second is Java SE.

    首先安装JRE,其次是Java SE。

初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

  1. Open text editor and paste this code.

    打开文本编辑器并粘贴此代码。

    public class Hello {

    公共类Hello {

      public static void main(String[] args) {
    
         System.out.println("test");
    
      }
    
    } 
    
  2. Save it like Hello.java

    像Hello.java一样保存它

  3. Go to Console and compile it like

    转到控制台并编译它

javac Hello.java

  1. Execute the code like
  2. 像执行代码一样

java Hello

初始化VM时出错(java / lang / NoClassDefFoundError:java / lang / Object)

Should be no error.

应该没有错误。

#10


0  

sometime you missed some file like I missed my one file rt.java so better to check yours .........

有时你错过了一些文件,比如我错过了我的一个文件rt.java,所以最好检查你的.........

C:\Program Files\Java\jdk1.8.0_112\jre\lib