在Ubuntu 18.04上运行Eclipse-CDT会导致java.lang.ClassNotFoundException [英] Running Eclipse-CDT on Ubuntu 18.04 causes java.lang.ClassNotFoundException

查看:231
本文介绍了在Ubuntu 18.04上运行Eclipse-CDT会导致java.lang.ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Oracle VirtualBox运行Ubuntu 18.04的虚拟机。
对于一个c ++项目,我需要Eclipse(包括cdt)。因此,我在控制台上运行了以下语句:

I am running a Virtual Machine of Ubuntu 18.04 via Oracle VirtualBox. I need Eclipse (including cdt) for a c++ project. So I ran the following statement on the console:

sudo apt-get install eclipse eclipse-cdt g++

然后我等到安装完成。之后,我尝试运行Eclipse,这导致了以下错误:

Then I waited until it finished installing. Afterwards, I tried to run Eclipse, which caused the following error:


发生了错误。请参阅日志文件
/home/matthias/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1540208856928.log

An error has occurred. See the log file /home/matthias/.eclipse/org.eclipse.platform_3.8_155965261/configuration/1540208856928.log

所以,我检查了日志文件。它说以下内容:

So, I checked the log file. It says the following:


!SESSION 2018年10月22日星期一CEST
------- ----------------------------------!ENTRY org.eclipse.equinox.launcher 4 0 2018-10-22 13:38:43.262!MESSAGE
启动Eclipse平台时发生异常:!STACK
java.lang.ClassNotFoundException:
org.eclipse.core.runtime.adaptor.EclipseStarter at
java .base / java.net.URLClassLoader.findClass(URLClassLoader.java:466)
在java.base / java.lang.ClassLoader.loadClass(ClassLoader.java:566)
在java.base / java .lang.ClassLoader.loadClass(ClassLoader.java:499)
在org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626)
在org.eclipse.equinox.launcher.Main .basicRun(Main.java:584)在
org.eclipse.equinox.launcher.Main.run(Main.java:1438)在
org.eclipse.equinox.launcher.Main.main(Main .java:1414)

!SESSION Mon Oct 22 13:38:43 CEST 2018 ----------------------------------------- !ENTRY org.eclipse.equinox.launcher 4 0 2018-10-22 13:38:43.262 !MESSAGE Exception launching the Eclipse Platform: !STACK java.lang.ClassNotFoundException: org.eclipse.core.runtime.adaptor.EclipseStarter at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:566) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:626) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584) at org.eclipse.equinox.launcher.Main.run(Main.java:1438) at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

不幸的是,我绝对是Ubuntu和c ++的初学者。我不知道什么会导致这个问题。有人可以帮我吗?

Unfortunately, I am an absolute beginner with Ubuntu, as well as c++. I have no idea what could cause this problem. Can anybody help me?

推荐答案

我发现在Ubuntu18.04上这是由于包装问题(在有才华的同事的帮助下进行调试)。解决方法是手动安装旧版libequinox-osgi-java_3.8.1-8 软件包中的文件,以保持打包愉快。

I found that on Ubuntu18.04 this is due to a packaging problem (debugged with the help of a talented coworker). The fix was to manually install files from the older libequinox-osgi-java_3.8.1-8 package, to keep packaging happy.


  1. 找到并获取.deb文件

  2. 检查软件包内容与系统内容是否重叠

  3. 手动将deb提取到'/ '

命令:

$ cd /tmp
$ wget http://archive.ubuntu.com/ubuntu/pool/universe/e/eclipse/libequinox-osgi-java_3.8.1-8_all.deb

$ dpkg -c /tmp/libequinox-osgi-java_3.8.1-8_all.deb
$ dpkg -L libequinox-osgi-java

$ cd /
$ sudo dpkg -x /tmp/libequinox-osgi-java_3.8.1-8_all.deb

注意:

在这里我们看到显示eclipse的命令取决于eclipse-rcp,而eclipse-rcp取决于libequinox-osgi-java(> = 3.9。 1),它们都已安装:

Here we see commands to show eclipse depends on eclipse-rcp, which depends on libequinox-osgi-java (>= 3.9.1), which are all installed:

$ lsb_release -rc
Release:        18.04
Codename:       bionic

$ apt-rdepends eclipse 2>&1 | egrep '^eclipse-rcp|libequinox-osgi-java'
eclipse-rcp
  Depends: libequinox-osgi-java (>= 3.9.1)
libequinox-osgi-java

$ dpkg-query -W eclipse eclipse-rcp libequinox-osgi-java
eclipse 3.8.1-11
eclipse-rcp     3.8.1-11
libequinox-osgi-java    3.9.1-1

这些命令表明,现成的日食固执地坚持加载旧版osgi_3.8.1.dist.jar却无法对其进行统计或打开:

These commands show that the out-of-the box eclipse stubbornly insists on loading the older osgi_3.8.1.dist.jar despite not being able to stat it or open it:

$ strace -f -e trace=file /usr/lib/eclipse/eclipse -debug -clean -initialize 2>&1 |
    egrep '^Framework.located|file:.*osgi_3.*jar|stat.*osgi_3.*jar'
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca95540) = -1 ENOENT (No such file or directory)
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca954c0) = -1 ENOENT (No such file or directory)
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca95550) = -1 ENOENT (No such file or directory)
[pid 117096] stat("/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar", 0x7f4f0ca954d0) = -1 ENOENT (No such file or directory)
Framework located:
    file:/usr/lib/eclipse/plugins/org.eclipse.osgi_3.8.1.dist.jar
...

较旧的软件包恰好与Ubuntu16.04 eclipse软件包中使用的软件包相同。我们尝试了几种不同的方法来强制安装较旧和较新的软件包等,但这使包装不满意,并且手动提取了Just Worked(tm)。

The older package just happens to be the same package used in the Ubuntu16.04 eclipse packages. We tried a few different ways to force install both older and newer packages, etc. but this made packaging unhappy and the manual extract Just Worked(tm).

这篇关于在Ubuntu 18.04上运行Eclipse-CDT会导致java.lang.ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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