• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

define the main class in a jar

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I created a swing application.
I want to create a jar (I know how to do that) that will activate the application meaning, if the user will push on X.jar the application will start running.

How can I define the main class?

Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like with all applications, you need a class with a main method to start the application. Then you need to add a manifest file to the jar which references the class with the main method; see JarFiles for more details.
 
Rob Spoor
Sheriff
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to create a manifest file and include the following line:

Then, when creating the JAR file, specify that you want to include a manifest file, and use the one you just created/
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I add all the necessaries directories (also properties and .classpath) to the jar.
When I am trying to run the jar I get the fallowing error:

Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name rcyProperties, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(Unknown Source)
at java.util.ResourceBundle.getBundleImpl(Unknown Source)
at java.util.ResourceBundle.getBundle(Unknown Source)
at utils.RcyUtils.getResourceBundle(RcyUtils.java:27)
at utils.RcyUtils.getImageIcon(RcyUtils.java:31)
at gui.BootScreen.<init>(BootScreen.java:67)
at main.StartRcy.main(StartRcy.java:12)

The properties directory is define in the .classpath file.
Should I need to add this directory also into the manifest.txt (and how)?


Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic