简体   繁体   English

Java 9 Eclipse 4.7便携式导出错误“找不到资源”,“无法从给定的启动配置中找到主要方法”。

[英]Java 9 Eclipse 4.7 Portable export error “resource not found”, “Could not find main method from given launch configuration.”

A few days ago I installed Oracle JDK 9. I tried to use Eclipse, but it didn't work. 几天前我安装了Oracle JDK 9.我尝试使用Eclipse,但它没有用。 I looked around and found this link. 我环顾四周,找到了这个链接。 So I updated my Eclipse with the link showed after 所以我用我之后显示的链接更新了我的Eclipse

To try out Java 9 support in Eclipse, you can follow any of these: 要在Eclipse中试用Java 9支持,您可以遵循以下任何一项:

by clicking on Help -> Install New Software... and then inserting the link. 单击帮助 - >安装新软件...然后插入链接。 This went fine and I already could started coding and I could also run it. 这很好,我已经可以开始编码,我也可以运行它。

But I didn't manage to do the second step, because dragging the Install button did nothing. 但是我没有设法做第二步,因为拖动“安装”按钮什么也没做。

(Second step:) (第二步:)

Update your Eclipse 4.7 build for committers using Eclipse Marketplace entry (currently, needs some additional steps): 使用Eclipse Marketplace条目为提交者更新Eclipse 4.7构建(目前,需要一些额外的步骤):

Then I realised that I didn't have the Eclipse Marketplace Client, so I installed it and then it went fine. 然后我意识到我没有Eclipse Marketplace客户端,所以我安装了它然后就没事了。

But here is the problem: When I try to Export it as a runnable jar file I get this error: "JAR creation failed. See details for additional information. No resources selected Jar export finished with problems. See details for additional information. Could not find main method from given launch configuration. " 但问题是:当我尝试将其导出为可运行的jar文件时,我收到此错误:“JAR创建失败。请参阅详细信息以获取其他信息。未选择资源Jar导出已完成问题。有关其他信息,请参阅详细信息。从给定的启动配置中找到主要方法。“

Eclipse中的错误消息

I already tried creating new Launch Configurations, Making a completly new empty project, and creating a new workspace. 我已经尝试创建新的启动配置,创建一个完全新的空项目,并创建一个新的工作区。 Nothing did work. 什么都没有奏效。

Has anyone an Idea why this doesn't work and what I can do to fix this? 有没有人知道为什么这不起作用,我可以做些什么来解决这个问题?

EDIT 编辑

My eclipse.ini: 我的eclipse.ini:

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
  plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.500.v20170921-1704
--launcher.defaultAction
openFile
--launcher.appendVmargs
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:/Program Files/Java/jdk-9/bin/javaw.exe   
-vmargs
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m

As also confirmed in the comments , the issue is filed as BUG#525711 in Eclipse. 正如评论中所证实的那样,该问题在Eclipse中以BUG#525711的形式提交。

Update :- It has been verified as fixed in M20171115-1700 , which primarily means that if one is using nightly or builds released after November 15, 2017 they should be able to create JAR using Eclipse. 更新 : - 它已在M20171115-1700中经过验证已得到修复,这主要意味着如果一个人在2017年11月15日之后使用夜间或构建版本,他们应该能够使用Eclipse创建JAR。

=> Though another point to note here shall be that this causes a subsequent BUG#527114 for failure in handling multiple modules while creating the JAR. =>虽然这里需要注意的另一点是,这会导致后续的BUG#527114在创建JAR时无法处理多个模块。

I would guess one shall mostly expect these updated in the Eclipse Photon build in future. 我猜想将来大多数人都期望在Eclipse Photon版本中更新这些内容。

I have Build id: 20171218-0600 and the problem is still (or again) in there. 我有Build id: 20171218-0600 ,问题仍在(或再次)在那里。

The original bug (525711) has been reopened as (526037): 原始错误(525711)已重新打开为(526037):

https://bugs.eclipse.org/bugs/show_bug.cgi?id=526037 https://bugs.eclipse.org/bugs/show_bug.cgi?id=526037

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM