Hey
I want to create a JAR library but not sure how to in MyEclipse. Im currently doing it manually using jar command but I cant seem to get it correctly
The library code is:
public class LibAdd
{
public static int addtwonumbers (int a,int b)
{
return a+b;
}
}
From this, I generate the .JAR (using what command in case Im doing it wrong). Named (for example) LibAdd.jar
Then in another project, in the build path, I include the LibAdd.jar and I want to do this:
public class AnotherClass
{
public static void main(String[] args)
{
LibAdd l=new LibAdd(); //Can I do this,having no main???
int x=l.addtwonumbers(2,3);
System.println.out(x);
//OR
System.println.out(l.addtwonumbers(8,5);
}
}
Thanks for the help :)