Creating Runnable JAR from Eclipse IDE

拈花ヽ惹草 提交于 2019-12-07 18:40:11

问题


I look over a lot of info on the web also look at some of the questions here, but couldn't solve my problem so I post this question. I have fairly simple project using SWING which compiles and run under Eclipse, but when I try to use the standard Export->Java->Runnable Jar leaving the default properties at the end I have a file which when I dobule-click I get this: Could not find the main class: TableFilterDemo. Program will exit. Here is my project structure:

And this is the configuration I use for creating the Runnable Jar :

And because as far as I understand the error there is some problem with locating the main method I left TableFilterDremo.java with only the main method in it:

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();
            }
        });
    }
}

By far no success.


回答1:


If you go through the full wizard that Eclipse provides, you'll see there is a screen prompting you to select a main class.




回答2:


On the screen before the one you show in the screenshoot, you have to manually select the classes that will be included in the jar.

A good way to check they have been included is to unzip the generated jar file (for example with winzip or winrar) and check it contains all the files.



来源:https://stackoverflow.com/questions/13199096/creating-runnable-jar-from-eclipse-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!