Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Equivalent of C++ .dll?

Tags:

java

c++

dll

So, I've been programming for a while now, but since I haven't worked on many larger, modular projects, I haven't come across this issue before.

I know what a .dll is in C++, and how they are used. But every time I've seen similar things in Java, they've always been packaged with source code. For instance, what would I do if I wanted to give a Java library to someone else, but not expose the source code? Instead of the source, I would just give a library as well as a Javadoc, or something along those lines, with the public methods/functions, to another programmer who could then implement them in their own Java code.

For instance, if I wanted to create a SAX parser that could be "borrowed" by another programmer, but (for some reason--can't think of one in this specific example lol) I don't want to expose my source. Maybe there's a login involved that I don't want exploited--I don't know.

But what would be the Java way of doing this? With C++, .dll files make it much easier, but I have never run into a Java equivalent so far. (I'm pretty new to Java, and a pretty new "real-world" programmer, in general as well)

like image 580
Matt D Avatar asked May 13 '10 22:05

Matt D


4 Answers

Java .jar library is the Java equivalent of .dll, and it also has "Jar hell", which is the Java version of "dll hell"

http://en.wikipedia.org/wiki/JAR_(file_format)

like image 177
Ming-Tang Avatar answered Oct 01 '22 02:10

Ming-Tang


Google JAR files.

Edit: Wikipedia sums it up nicely: http://en.wikipedia.org/wiki/JAR_%28file_format%29

Software developers generally use .jar files to distribute Java applications or libraries...

like image 27
TreDubZedd Avatar answered Oct 01 '22 02:10

TreDubZedd


A jar is just a uncompressed zip of your classes. All classes can be easily decompiled and viewed. If you really don't want to share your code, you might want to look at obfuscating your code.

like image 21
wsxedc Avatar answered Oct 01 '22 01:10

wsxedc


The Java analog to a DLL is the .jar file, which is a zip file containing a bunch of Java .class files and (perhaps) other resources. See Sun's, er, Oracle's documentation.

like image 43
Jim Ferrans Avatar answered Oct 01 '22 01:10

Jim Ferrans