java - Create an executable jar for Swing app -


i have created java application called app.java. uses gson. hence created jar gson.jar , created manifest file (manifest.mf) following content.

manifest-version: 1.0 class-path: test.jar gson.jar main-class: app 

i created test.jar using following command:

jar cfm test.jar manifest.mf * 

edit: jar cfm test.jar manifest.mf * is producing jar seen on disk.

and run using

java -jar test.jar 

the application throws classnotfoundexception exitlistener. when code uses exitlistner removed, runs normal run using java app. missing?

either add jar has exitlistener class in in class-path

class-path: test.jar gson.jar <exitlistenerjar> 

or write own exitlistener , use in app.

edit

on other thought can use code , add application

import java.awt.event.windowadapter; import java.awt.event.windowevent;  public class exitlistener extends windowadapter {     public void windowclosing(windowevent event) {         system.exit(0);     } } 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -