How to create my own java library(API)?

Create a JAR. Then include the JAR. Any classes in that JAR will be available. Just make sure you protect your code if you are giving out an API. Don’t expose any methods / properties to the end user that shouldn’t be used.

Edit: In response to your comment, make sure you don’t include the source when you package the JAR. Only include the class files. That’s the best you can really do.

Leave a Comment