1

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.

Is there a better way considered to be a best practice?

H2ONaCl
  • 10,644
  • 14
  • 70
  • 114
  • see http://stackoverflow.com/questions/502960/eclipse-how-to-build-an-executable-jar-with-external-jar . You can distribute your application as executable jar. – kingori Sep 15 '11 at 12:38

3 Answers3

3

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

Jonas
  • 121,568
  • 97
  • 310
  • 388
1

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.

Chris Aldrich
  • 1,904
  • 1
  • 22
  • 37
1

Class path entries can contain the basename wildcard character * since Java 6 Setting the class path

Jarek Przygódzki
  • 4,284
  • 2
  • 31
  • 41