aspose file tools*
The moose likes Beginning Java and the fly likes using command to run swing application ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using command to run swing application ?" Watch "using command to run swing application ?" New topic
Author

using command to run swing application ?

Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 438
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
Marshal

Joined: Mar 22, 2005
Posts: 41863
    
  63
Try this:

java -classpath c:\classes my.um.StartApplication


Ping & DNS - my free Android networking tools app
Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 438
i get this error with your try

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Nakata kokuyo
Ranch Hand

Joined: Apr 13, 2005
Posts: 438
it still give me error when i type as below :



what else i miss ?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

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

Joined: Apr 13, 2005
Posts: 438
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

Joined: Jul 08, 2003
Posts: 24184
    
  34

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

Joined: Apr 13, 2005
Posts: 438
thanks, Ernest Friedman-Hill for guiding
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using command to run swing application ?