Sparkles

that were shone when I got tempered!

Executing a class in a jar file using bash commands

with one comment

Create a .sh file

type the command in .sh to excute the java class:

1. Considering the jar file is an excutable one.

java -jar <jar-file*>

*jar-file – But here the Main-Class attribute must be mentioned in the Manifest file.

2. Not considering the jar file is an excutable one.

java -cp <related jar files*> package.ClassName

*related jar files
– Jar files must be seperated by semi-colon in windows and a colon in Linux.

eg :

java -Dlog4j.configuration="file:log4j.xml" -cp /mysystem/jboss-4.0.3SP1/server/default/deploy/jbossweb-tomcat55.sar/my-libs/xmlParserAPIs.jar:/mysystem/jboss-4.0.3SP1/server/default/deploy/jbossweb-tomcat55.sar/my-libs/updater.jar common.currency.exchange.server.XRatesUpdater

Excute the sh file in terminal using bash command.
eg : bash fileName.sh

Advertisements

Written by Namal Fernando

January 23, 2014 at 8:15 am

Posted in Linux

Tagged with ,

One Response

Subscribe to comments with RSS.

  1. Got it . Excellent work !!!!

    Dharashan Sithamparam

    March 4, 2014 at 9:14 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Ruth's Reflections

Contemplations from quakey quirky Christchurch

TED Blog

The TED Blog shares interesting news about TED, TED Talks video, the TED Prize and more.

Ziplok

Learn and discover simple things

Meihta Dwiguna Saputra's Knowledge Base

~In learning you will teach and in teaching you will (re)learn~

The Java Blog

Thoughts, tips and tricks about the Java programming language

Sparkles

that were shone when I got tempered!

%d bloggers like this: