Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package

 
kelly tyler
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
kelly
 
karl koch
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
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)
karl
 
khella smith
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks karl and is this command line that of ms dos?
it will help to know
i appreciate it
thanks
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
regards
maulin
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic