how to create a jar file using eclipse?

Post on 26-Jun-2015

4.454 Views

Category:

Education

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

This PPT explains how to create a jar file using eclipse and how it can be accessed from another project. It uses the export option of Eclipse for creating the Jar file.

TRANSCRIPT

How to create a JAR file using Eclipse

Haris NPharis@baabtra.comwww.facebook.com/haris.np9twitter.com/np_harisin.linkedin.com/in/harisnp

Create a Java project in Eclipse• The project has only class. The name of the class is Calculator. package com.baabtra.pack;public class Calculator {

public int func_add(int int_fn, int int_sn){

return int_fn+ int_sn;}public int func_sub(int int_fn, int int_sn){

return int_fn- int_sn;}public int func_mul(int int_fn, int int_sn){

return int_fn*int_sn;}

public int func_div(int int_fn, int int_sn){

//assumption = No zero passedreturn int_fn/int_sn;

}

}

1. Click on File Export

Export screen appears

Expand Java Click on JAR File

Click Next

Uncheck the two check boxes

• The jar file is stored to the workspace of Eclipse

How to import Jar?• In the example the package com.baabtra.pack

is imported.

• To add a jar– Right click on the project properties– Go to Java Build Path– Click on Libraries – Click on Add External Jars – Select the baabtraCal jar– Click Open– Click OK

• Now you can use your own classes in other java programs.

Contact Us

Emarald Mall (Big Bazar Building)Mavoor Road, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

NC Complex, Near Bus StandMukkam, Kozhikode,Kerala, India.Ph: + 91 – 495 40 25 550

Start up VillageEranakulam,Kerala, India.

Email: info@baabtra.com

top related