Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using command to run swing application ?

 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, good day , i have done some swing application , but i forgot how to run the class file ?

say my folder in c:\classes\my\um

and my application mainClass is c:\classes\my\um
\StartApplication.class

when i want to run the start.class , what command i should use ?

i have try


it doesn't work and prompt me error "Exception in thread "main" java.lang.NoClassDefFoundError: StartApplication (wro
ng name: my/um/StartApplication)"


thank you for guidance
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:

java -classpath c:\classes my.um.StartApplication
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i get this error with your try

 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add the Apache Commons logging Jar file -- along with the Jar files for any other libraries you used -- to the class path as well.

Moving to Java in General (Beginner) for any followup.
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it still give me error when i type as below :



what else i miss ?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't put directories in which jar files appear onto the class path; you put the jar files themselves in. Furthermore, multiple entries are separated by a semicolon, not a comma.

java -classpath c:\classes;c:\classes\lib\commons-logging.jar;c:\wherever\whatever.jar Foo.java
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i have many third party jar file like commons-logging.jar and so on, is it the only way to add one by one in java -classpath ?

anyway to set all sum of jar file in once ?

thank you
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add them one at a time. Normally people write a batch file or shell script to contain the command to start a program.
 
Nakata kokuyo
Ranch Hand
Posts: 472
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, Ernest Friedman-Hill for guiding
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic