7

Are there any good tutorials / starting points you can suggest for me to develop my own Java libraries?

(I'm thinking about developing a small graphics library at the moment.)

aioobe
  • 413,195
  • 112
  • 811
  • 826
bremmS
  • 277
  • 1
  • 6
  • 13

3 Answers3

18

How can I develop my own Java Library?

As you probably know a Java library is usually simply a jar-file containing some utility classes, aimed to solve problems at a higher level of abstraction than what the classes in the Java Platform API does. So, technically speaking you simply write the classes you would find useful to have in your library, compile them, jar them up and write some good documentation.

Are there any good tutorials / starting points you can suggest for me to develop my own Java libraries?

Writing useful libraries is a tricky business though. Rather than thinking in terms of what would be a nice design internally, you should think about what would be a nice design for the client to use.

I suggest you google for java api design. Here are a few useful hits:

aioobe
  • 413,195
  • 112
  • 811
  • 826
4

This is a very general question. What exactly do you want to know? Developing a library is not much different from developing any other application.

Libraries are normally packaged in JAR files. You package class files into a JAR file using the jar tool (if you use an IDE, it might have a way to do this from the IDE).

See Oracle's very good Java Tutorials to learn about many different Java programming topics. Java already has a comprehensive graphics API, which you can learn more about in the 2D Graphics tutorial.

Jesper
  • 202,709
  • 46
  • 318
  • 350
2

There is a good guide here on how to create your own API.

The hardest part of any API design is designing for as many use-cases as possible and to provide interfaces so that users of the library can override standard implementations (where applicable).

Chris
  • 4,450
  • 3
  • 38
  • 49