Monday, February 6, 2012

Compiling and Running a Java program in UNIX requiring many JAR files

Dear reader,
Here I am writing a command used to compile and run a Java Program in Unix environment without Creating a JAR file.
The compilation requires many SUPPORTED Jar files which are there in "lib" directory. Below is the directory structure:
-------------------------Directory Structure start--------------------------
[dmodi@iqaapp8 BillPayBusinessService]$ ls
lib  org
[dmodi@iqaapp8 BillPayBusinessService]$ ls lib
axis.jar  commons-discovery.jar  commons-logging-1.1.1.jar  javaee.jar  jaxrpc.jar  weblogic.jar  wsdl4j.jar
[dmodi@iqaapp8 BillPayBusinessService]$ ls org/tempuri/
holders             Service.java          ServiceSoapStub.java  PushDataTo_TMSResponsePushDataTo_TMSResult.java   
ServiceSoap.java    MySoapHeader.java     ServiceLocator.java   TestOne.java (This is the main program which will execute).
[dmodi@iqaapp8 BillPayBusinessService]$
-------------------------Directory Structure end--------------------------

-------------------------
Compilation command:
[dmodi@iqaapp8 BillPayBusinessService]$ javac -d  .  -cp .:lib/weblogic.jar:lib/axis.jar:lib/commons-discovery.jar:
lib/commons-logging-1.1.1.jar:lib/javaee.jar:lib/jaxrpc.jar:lib/wsdl4j.jar  org/tempuri/*.java

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
[dmodi@iqaapp8 BillPayBusinessService]$
-------------------------
Running command:
[dmodi@iqaapp8 BillPayBusinessService]$ java -cp .:lib/weblogic.jar:lib/axis.jar:lib/commons-discovery.jar:
lib/commons-logging-1.1.1.jar:lib/javaee.jar:lib/jaxrpc.jar:lib/wsdl4j.jar  org/tempuri/TestOne

//OUTPUT
-------------------------

No comments:

Post a Comment