File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "package" Watch "package" New topic


kelly tyler

Joined: Dec 24, 2002
Posts: 1
helo all
after writing a programe and putting it in a package how do u get that programe from the pc u worked with and run it on another pc?
pls help me out
i am having problems with it
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
you can put all the classes in a jar file:
on the command line change to the base directory of your classes (but not in the package structure)
ant type:

this will add all files in the jar named NewJar.jar.
then copy this jar file to the other machine and start the app. On the command line:

where MainClass is the class with the main function. If you use packages then use the fully qualified name.
hope this helps (and hopefully the commands are correct. cant try them out here)
khella smith
Ranch Hand

Joined: May 06, 2002
Posts: 39
thanks karl and is this command line that of ms dos?
it will help to know
i appreciate it
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1873
hi khella
yes. karl gave command line in MS DOS format. you see that '%' and ';' signs specific to MS DOS Format?
if it were unix then it would have been,
java -cp $CLASSPATH:NewJar.jar MainClass
I agree. Here's the link:
subject: package
jQuery in Action, 3rd edition