Create a Jar file Library How to Build Your Own Java library?

 Hi there , to day we make  our Own Libraries in java 

2.  Fast Go to NetBeans Create New Project . Name it "ezcod"


3.  Create package  Name it  " Tech_inbox " 

4. Create Java class " founder "

5.  This is your Class


6.  Create a Method Whatever you like it. I create   " FoundersOfGoogle "

    I use String return type Data.

   Larry Page, Sergey Brin "


Code Here :


package Tech_inbox;
/**
*
* @author coolsasindu@gmail.com
* @author https://ezcod.blogspot.com/
* @author https://www.youtube.com/channel/UCIDeTJ1PXVcRbFrmyDKQKkg
*/
public class Founder {
//google
public static String FoundersOfGoogle() {
return "Larry Page, Sergey Brin";
}
//facebook
public static String FoundersOfFacebook() {
return "Mark Zuckerberg, Eduardo Saverin, Andrew McCollum, Dustin Moskovitz, Chris Hughes";
}
//github
public static String FoundersOfGitHub() {
return "Tom Preston-Werner, Chris Wanstrath, Scott Chacon, P. J. Hyett";
}
//twitter
public static String FoundersOfTwitter() {
return " Jack Dorsey, Evan Williams, Biz Stone, Noah Glass";
}
}
view raw Founder.java hosted with ❤ by GitHub
 

7. Clean and Build Project (Shift +F11) NetBeans short cut


8. Copy JAR File 

9. Create new  Project  and  Import   ezcod jar file in to Libraries 






10. Open New project main class file

    

11 Type this  line Founder.FoundersOfGoogle()  like this

         System.out.println( Founder.FoundersOfGoogle()  );
    
And import  Tech_inbox from ezcod libraries

        import Tech_inbox.Founder;

12 Run it like this.




13. Code here :

package mylib_test;
import Tech_inbox.Founder;
public class Mylib_test {
/**
* @author coolsasindu@gmail.com
* @author https://ezcod.blogspot.com/
* @author https://www.youtube.com/channel/UCIDeTJ1PXVcRbFrmyDKQKkg
*/
public static void main(String[] args) {
System.out.println(Founder.FoundersOfGoogle() ); // google
System.out.println(Founder.FoundersOfFacebook() ); //facebook
}
}
view raw Mylib_test.java hosted with ❤ by GitHub



14. Output 




Post a Comment

Previous Post Next Post

Featured Post