[csw-maintainers] Java packages

Roger Håkansson hson at opencsw.org
Sun Mar 14 05:32:35 CET 2010


On 2010-03-13 23:59, Maciej (Matchek) Blizinski wrote:
> For Java, you
> also need to put the files somewhere, but I'm sure there are some
> standard directories,

Not really.
Well, you could put your stuff in $JAVA_HOME/lib, but that is certainly 
not standard

> and ways to make the java compiler aware of the
> locations of libraries you intend to import.

You either set environment variable CLASSPATH or you add -classpath when 
running java.

> There's also the ant
> build system, and probably a lot of other Java specifics.

ant is just a make for java

> Do you have
> an example of a Java package that I might look at?
>
> The package I would like to build is the Java version of protobuf.
>

I had a quick look at it and basically you'll do like this:

1. Build the C++ stuff so that you have protoc built
2. Run:
src/protoc --java_out java/src/main/java -Isrc 
src/google/protobuf/descriptor.proto
3. cd java/src/main/java
4. javac com/google/protobuf/*.java
5. jar cf protobuf-java-2.3.0.jar com/google/protobuf/*.class (jar name 
derived from pom.xml)
6. cp protobuf-java-2.3.0.jar /whereever/you/want/your/jar


More information about the maintainers mailing list