best practice for invoking a Java Swing program
When not running the IDE (Eclipse for Java), I invoke my Swing app via a bash script on ubuntu. The script contains a lengthy classpath option.
开发者_JAVA百科Is there a better way considered to be a best practice?
You should create an executable jar-file with your classes. Then you can run your application with java -jar yourApp.jar
or by double clicking it.
In Eclipse you can create a jar-file by exporting your project. See also Lesson: Packaging Programs in JAR Files
There is also Java Web Start. You could deliver your application via the web (classpath set in the JNLP file) and then launch it via URL and/or a shortcut on your desktop. It can still run as a local application.
Class path entries can contain the basename wildcard character * since Java 6 Setting the class path
精彩评论