How to create a jar file of Java source file?
I have one class called CreateJar
which has function Calculate which
calculate the addition of two integers. I called this function in
another class called UseFunction
, but I want to create a jar file of
CreateJar
class and want to import this in UseFunction
class. I Googled
for it but not get any solution.
Below are my classes:
CreateJar
package com.dir;
public class CreateJar {
public int Calculate(int x,int y)
{
int z =x+y;
return z;
}
}
UseFunction
package com.dir;
public class UseFunction {
CreateJar jar = new CreateJar();
public UseFunction()
{
System.out.println(jar.Calculate(5, 6));
}
public static void main(String args[])
{
new UseFunction();
}
}