我在网上看了很多资料,也看了这里的一些问题,但无法解决我的问题,所以我发布了这个问题。我有一个使用 SWING
的相当简单的项目,它在 Eclipse 下编译和运行,但是当我尝试使用标准的 Export->Java->Runnable Jar
时,将默认属性保留在我有一个文件,当我双击时我得到这个: Could not find the main class: TableFilterDemo.程序将退出
。
这是我的项目结构:
这是我用来创建 Runnable Jar
的配置:
因为据我所知,定位 main
方法存在一些问题,所以我只留下了 TableFilterDremo.java
main
> 里面的方法:
public class TableFilterDemo{
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
CreateGUI.createAndShowGUI();
}
});
}
}
到目前为止还没有成功。
最佳答案
如果您浏览 Eclipse 提供的完整向导,您会看到有一个屏幕提示您选择主类。
关于java - 从 Eclipse IDE 创建可运行的 JAR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13199096/