Oracle applications - Surendranath Subramani: How to create JAR using JDeveloper 10g

Saturday, May 6, 2017

How to create JAR using JDeveloper 10g

Date: 05/07/2017

Purpose:

How to create JAR using JDeveloper 10.1.3 version.

In this article I will use simple java program (HelloWorld) and will package into JAR.


Step: 1

Create java program and compile it. Sample shown below.

 package createjarpj;  
 public class HelloWorld  
 {  
  public HelloWorld()  
  {  
  }  
  public static void main(String[] args)  
  {  
   HelloWorld helloWorld = new HelloWorld();  
   System.out.println(args[0]+" Hello World!!!");  
  }  
 }  


Step: 2
Click new and choose "JAR file" under "General", "Deployment Profile"  


Give a name to JAR. Click OK.


No need to do anything, simply click OK.
Note: Make sure class file is included. 


Step: 3

You may notice jar.deploy file created. Right click the file you will notice 'Deploy to JAR File'




Step: 4

In the log you will see that creating of Jar completed. 


under Deploy folder you will see JAR file created.



Step: 5

Now let us validate to see if the JAR works.
Copy the Jar to any folder. For testing i copied to c:\Temp folder.



Step: 6

Execute Java command and you can find the result.





C:\Users\ssubram3>echo %CLASSPATH%
%CLASSPATH%
C:\Users\ssubram3>java -cp C:\Temp\SurenJar.jar createjarpj.HelloWorld Training
Training Hello World!!!
C:\Users\ssubram3>

No comments:

Post a Comment