gpt4 book ai didi

eclipse - 安装eclipse + svn

转载 作者:行者123 更新时间:2023-12-04 18:37:04 25 4
gpt4 key购买 nike

我有一个由 svn 版本化的 Java 项目,并尝试为 linux 配置构建。在我的工作计算机上一切正常,我提交了更改。但是,对于我的两台家用计算机,我都会收到此错误,这似乎是一些微不足道的设置问题:

Exception in thread "main" java.lang.NoClassDefFoundError: adventure/Adventure
Caused by: java.lang.ClassNotFoundException: adventure.Adventure
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: adventure.Adventure. Program will exit.

我是否忘记将 src 添加到某个路径?它在 ubuntu 中的外观如下:

enter image description here

它是用 Java 7 提交的,但在 ubuntu 上我只有 Java 6。它还能工作还是我需要完全协调 Java 版本?

更新

我清理了构建路径并再次设置 JAR,我将添加 Java 6 JRE,因为我不使用任何 Java 7 特定功能,因此如果我只设置 JRE,它应该可以工作。但我不知道如何在 linux 中添加我的 JRE?我也可以尝试使用 windows,然后也许我可以添加一个合适的 JRE。现在有一个构建问题:

谢谢,但现在我没有 JDK,这看起来像是主要问题,只是一个构建问题:
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
String cannot be resolved to a type

at adventure.Adventure.main(Adventure.java:74)

我的 Java 版本看起来不错:
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

安装的 JRE 是应该可以工作的 OpenJDK 6:

enter image description here

我的类路径变量看起来像这样

enter image description here

最佳答案

通常 Java 项目应该在没有 bin 文件夹的情况下提交(将其设置为忽略)。

看起来您的项目已 checkin ,包括从 Java 7 编译的类文件,当然 Java 6 无法加载。

您应该按以下步骤进行:

打开终端并切换到您的项目目录

  • 执行svn delete bin
  • 执行svn propset svn:ignore bin .

  • 有人如何从 Eclipse 中做到这一点吗?

    切换回 Eclipse 并在项目上执行“清理”命令,以便 Eclipse 使用您的 Java 版本重新构建它。

    关于eclipse - 安装eclipse + svn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11264967/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com