views:

18182

answers:

140

I've never seen a good list of free Java libraries.

What are some of your can't-live-without Java libraries?

Note: to keep this poll as useful as possible, please remember:

  • Post only one library per answer
  • We don't want duplicate answers, so before posting check if the library has been mentioned already
  • When adding a new library, provide a short summary of what it does / why you think it's useful
+169  A: 

http://commons.apache.org/

Apache Commons. Nuff said.

Konrad
Commons are so useful. Commons-libraries are used by most of my projects.
Mnementh
I can't think of a single app that I currently work with that does not have at least one dependency to a commons project.
Konrad
I (heart) Apache Commons
Stu Thompson
It's actually really annoying to see code with custom utility methods/classes that try to do the same thing as commons classes but do it badly.
Michael Rutherfurd
I think commons logging is seriously annoying. It provides nothing useful over log4j. Neither are part of the JDK so they're equally portable. Commons logging just replaces one dependency with another. And it makes logging harder to configure.
Draemon
+1 I have just recently started using a couple of the different Apache commons libraries, they are really well made and well documented. Definitely some of the best around.
Mark Davidson
Take a look at the "Fast" collection classes in Commons-Collections. What a pile of utter, utter rubbish.
oxbow_lakes
Commons made Java life easier...
Ravi Wallau
Commons is 50% useful stuff and 50% utter crap.
foljs
@foljs luckily you can pick which 50% you use.
TM
That 50% is really awesome, the other crap is useful sometimes and those times becomes diamonds
victor hugo
Many of the apache-commons APIs have outdated concepts, the APIs are badly maintained. It's Sad.
ivan_ivanovich_ivanoff
@Draemon, we use the slf4j replacement for commons logging to get into slf4j-api. Very useful!
Thorbjørn Ravn Andersen
Please split this so I can downvote commons-collections and upvote commons-math and commons-csv
finnw
+29  A: 

SWT, though I haven't used it for a while. It yeilds pretty great user interfaces.

Bob King
IMHO it yields the best GUI's in the Java world without using non-java frameworks like GTK or Qt
Ubersoldat
Agreed and add jface on top of SWT and you've got some nice high-level UI Components like trees and tables also.
Alb
+63  A: 

iText for pdf creation. Couldn't live without it.

http://www.lowagie.com/iText/

cagcowboy
iText is a lov level API. You can also use JasperReports or BIRT
m_pGladiator
+21  A: 

Name: JDOM

Website: http://www.jdom.org/

Purpose: XML DOM manipulation

pkaeding
+4  A: 

JTS Topology Suite: If you work with geographic data it's very useful. It's so useful, also C++-programmerswant it, so it was ported to C++, a library named GEOS (Geometry Engine Open Source).

Mnementh
+101  A: 

Apache Log4j is a well-known logging-library.

Mnementh
only if not used in concurrent environment. otherwise, can cause deadlocks
Boris Pavlović
I don't believe this is true. I've used log4j in a *highly* concurrent environment, for many years, with no deadlocks.
Eddie
It may depend on what appenders you use, some web sites <cough>stackoverflow</cough> have been known to use database appenders. (Log4net as well). I have never had concurrency issues with log4j used in high volume sites.
David Waters
Log4j configuration is horrible though, but thankfully it mixes very nicely with slf4j.
Esko
Having had close contact with log4j code, I must say that it is rather horrible. And horribly synchronized.. basically sad we're stuck with it as a de facto standard.
Boris Terzic
Try Logback or Logback+SLF4j. It includes a log4j-over-slf4j library.
KitsuneYMG
I prefer logback + slf4j over log4j
peperg
+20  A: 

Actually not just the commons, but all of Apache Jakarta project has great Java libraries. From MS Office file access to collection utilities to byte code manipulation. The page also lists projects that have moved out of Jakarta (eg: maven).

Another place is http://delicious.com/tag/java+library - several of my colleagues use that combination of tags (language + library) to organize the things they run across (mortis, robdimarco).

Kyle Burton
+109  A: 

Joda Time is an absolute must if you're doing anything beyond the most trivial of date computations.

Note: JSR 310 aims to fix a lot of the problems with the standard Java Date and Time API.

Mike Deck
Couldn't agree more
SCdF
+1. Might not be needed?? Unless JSR 310 makes my coffee for me I am not changing!
WolfmanDragon
I haven't looked at it in depth, but I was under the impression that the proposed API would borrow heavily from the Joda Time project. I believe all of the value objects will be immutable and the primary domain concepts they are modeling look to be quite similar to those in Joda Time. Also, Stephen Colebourne, the project lead from Joda Time is one of the leads on the JSR 310 project as well. If/when this JSR is added to the public release the Joda Time project will likely die off or become radically transformed, and the new API will essentially be what Joda Time 2.0 would have been.
Mike Deck
JSR 310 has slipped Java 7. Let's hope it's in Java 8.There won't be a strong reason to change to it if you're already happy using Joda-Time. However, libraries would be able to use it, even using its types in their APIs, without foisting the Joda dependency on all their users.
Kevin Bourrillion
+5  A: 
  • JiBX for XML data-binding.
  • JFreeChart Swing graphs and charts.
  • H2 pure Java embedable database engine.
Dan Dyer
JFreeChart is a fantastic framework
tim_yates
Seperate posts please to enable fair voting...
mattburns
@mattburns This answer is 2 years old and somebody has changed the question into a poll since I answered. This is an answer to a different question.
Dan Dyer
Ah, sorry, my bad!
mattburns
Dan, you could still split these in separate posts (actually [JFreeChart](http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/135859#135859) and [JiBX](http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/354328#354328) have entries already, so just dedicate this to H2) now that the question *is* a poll. I mean, it's not like there's much value in preserving this CW answer in its original form when it could be made into something more useful.
Jonik
Oh, there's a separate one for [H2](http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/1216571#1216571) too already. Heh. Well, if nothing else, there's a great *opportunity* here for achieving a Disciplined badge. :-)
Jonik
+14  A: 

I'm quite partial to

JasperReports - report generation libraries

prefuse - visualization toolkit

Rui Vieira
I've used JasperReports extensively. The API could use more comments, but the combination of iReport and JasperReports is not to be missed.
Dave Jarvis
100% for Prefuse!
HH
Two separate posts please so that they can be voted on individually
mattburns
+90  A: 
korchev
Didn't came the xUnit-stuff from the smalltalk-community?
Mnementh
You are absolutely right! This wikipedia entry says it all:http://en.wikipedia.org/wiki/XUnit
korchev
I'd have put them in two separate answers so that they can be voted on separately
Joachim Sauer
+1 for hibernate. Can't live without it
Shervin
Hibernate is rather a framework
peperg
+2  A: 

PCJ, Primitive Collections for Java.

This is a the fastest implementation of a Collections framework around primitive datatypes, providing for example Maps with ints as keys or Lists for floats. Much faster and more memory efficient than Sun's classes (where you have to use Integer and Float as wrappers with substantial cost), and also faster than its "competitors" fastutil and trove. Unfortunately no generics and not being maintained anymore - is stable though.

the.duckman
+86  A: 

Spring, used for MVC (Model-View-Controller) projects

MidnightGun
Spring is good for a LOT more than MVC projects.
John Meagher
I'll second that. It is easy to pick and choose what you want to use in Spring.
Stu Thompson
That's what I used it for... anyone with more knowledge is free to edit it for greater clarity.
MidnightGun
That's more of a framework than a development library...
Zombies
Spring IOP, AOP, etc. Spring is just beautiful.
Richard Clayton
@Zombies What's the difference
Nachiket
Actually, this really should be split apart -- saying Spring is almost likey saying "Apache Jakarta" or "stuff from googlecode", too generic to help. I liked Spring DI, for example, and found Spring MVC not very impressing. Others have other faves.
StaxMan
-1 I can live without.
mrrtnn
+2  A: 

JDOM, for java XML parsing
http://www.servlets.com/cos/ -- servlet utils including download/upload, etc
bindings to curl for http download/upload
code from the squirrel SQL client for accessing DBs
the original JDBC driver for accessing MySQL.

it takes a while to think about all the stuff that's been useful to you over the years.

anjanb
+13  A: 

JAI - Java Advanced Imaging API it's very useful to do powerful image manipulation. Here comes Sun's description of it:

The Java Advanced Imaging API (JAI) provides a set of object-oriented interfaces that supports a simple, high-level programming model which allows images to be manipulated easily in Java applications and applets. JAI goes beyond the functionality of traditional imaging APIs to provide a high-performance, platform-independent, extensible image processing framework.

I would also recommend JAI-Image-IO Tools.

Clue Less
JAI is the best solution for what it does, however it's one of the less programmer-friendly APIs I've used. :(
Domchi
Unfortunately I have to agree with Domchi. I wonder why Java just have to over engineer everything.
nimcap
+3  A: 

Dozer mapping library, very usefule going from JPA generated classes to domain classes

bmw0128
+9  A: 

It is exceedingly useful to dynamically generate files from templates:

  • Velocity -- Generate text from templates (SQL queries, email, HTML, etc..)
  • jXLS -- Generate XLS files from templates
thoroughly
+39  A: 

Name: Guice

Website: http://code.google.com/p/google-guice/

Purpose: Dependency Injection, ease of testing

Pyrolistical
I've been using this for 6 months now and I'm so happy I gave it a try! It's awesome!
Mark Renouf
Guice is much less flexible and more invasive than Spring. I've used it for some time, struggling with its limitations, before switching to Spring.
Shooshpanchick
+48  A: 

Name: XStream

Website: http://xstream.codehaus.org/

Purpose: Out of the box POJO serialization to XML and back again

Pyrolistical
+14  A: 

Name: Glazed list

Website: http://publicobject.com/glazedlists/

Purpose: Data flow, instead of logic flow. Data centric. Works well with Swing

Pyrolistical
this description doesn't quite do GlazedLists justice - the basic idea is to add event handling to the java.util.List interface. This allows for some amazingly elegant software design if you are doing anything that is list based.
Kevin Day
The screencast was very informative - http://publicobject.com/glazedlists/media/Glazed_Lists_in_25_lines_of_code.mov . I can't wait to use this project. I've tried to do this sort of sorting before manually and it was a pain. Great idea for a library
I82Much
+24  A: 

Name: SwingLabs

Website: https://swingx.dev.java.net/

Purpose: Extensions to Swing

Pyrolistical
SwingLabs actually has several libraries other than swingx. JXLayer and swing-ws come to mind
KitsuneYMG
A: 

Name: Lipermi

Website: http://lipermi.sourceforge.net/ WARNING: Use the CVS version for now, it fixes two major bugs.

Purpose: RMI alternative that uses only TCP. No more codebase urls!

Pyrolistical
+30  A: 

Name: Miglayout

Website: http://www.miglayout.com/

Purpose: A powerful layout manager that just works

Pyrolistical
Kinda of like GridBagLayout except that Miglayout you need to memorise all the strings 'commands' as the IDE wont remind you?
willcodejavaforfood
MigLayout can do much more in higher precision. You can use the API too, not just Strings, and the ease of use of the API puts the ugly GridBagLayout API to shame.
haffax
@willcodejavaforfood: not like the GridBagLayout. Although you are totally dependent on the docs -- your IDE won't autocomplete the strings -- for 90% of uses MigLayout is easier than GridBagLayout.
Yar
Never really thought GridBagLayout is hard to be honest. You kids just need to be spoon fed! :P
willcodejavaforfood
FWIW, the problem with GridBagLayout for me was always that it tended to degrade poorly when it couldn't size things how it wanted. This became an issue for me when I demoed an application that naturally wanted a 1024×768 screen across a bunch of machines with 800×600 displays… I don't do GUI programs in Java any more (I tell someone else to do it for me).
Donal Fellows
+2  A: 

It is a bit subjective, something you can't live without might be useless for me... :-)

Anyway, here are some I bookmarked (I haven't used all of them!):

  • Batik -- SVG parser/viewer.
  • etlFTPj -- A FTP library.
  • TagSoup -- An HTML parser, able to handle the bad HTML we see in real world.
  • StringTemplate -- A (generic) template engine enforcing strict principles (no Turing-complete).
  • FreeMarker -- Another template engine, more procedural, still strict on document/view separation.

There is lot more, that's one of the strong points of Java...

PhiLho
+1 for TagSoup and StringTemplate :-)
Peter Štibraný
Any chance you split this to separate posts so that the libs can be voted on individually?
Jonik
+78  A: 

Lucene for full text searches without a database.

CR
Lucene is actually a database engine specialized for tokenized text searches :)
Esko
We used lucene as a client side Object store. we didn't need any of the tokenized searching it provides but just found it the most efficient way to persist and retrieve large amount of java objects. It even proved quicker than a HSQL implementation we tried.
Alb
A: 

JAXB is nice.

jFreeChart is great for charts.

Spring is also very nice.

Ryan Thames
All of these are mentioned in separate posts
mattburns
+36  A: 

easymock for mock objects in unit tests.

Cristiano Sanchez
Why not just use anonymous classes and assert parameters and return appropriate values.
mP
+5  A: 

OpenSymphony has a really nice set of various open source java projects. The ones I used and enjoyed:

  • Quartz - a full-featured job scheduling system
  • OSCache - a caching solution that includes a JSP tag library and set of classes to perform fine grained dynamic caching of JSP content, servlet responses or arbitrary objects.
  • OSCore - a set of utility-classes (manipulations with strings, dates, xml, etc)

Both Quartz and OSCache are well integrated with Spring.

serg
+22  A: 

These two are excellent:

Apache MINA - Well-designed, high-performance, network application framework using Java NIO

Jetty - Easy-to-use, full-featured, embeddable web server and webapp container

David Crow
I use Jetty all the time.
Mnementh
Jetty +1Mina ?
crowne
+2  A: 

Name: JFugue

Website: http://www.jfugue.org

Purpose: Playing music in one line of Java code

(Not the most business-minded library, but definitely great for being creative and programming for fun!)

David
+18  A: 

Guess you all missed POI for interaction with MS Excel !

Nrj
+1  A: 

Java Uuid Generator (JUG) for creating unique values..

http://jug.safehaus.org.

tropikalista
If you're using Java 1.5 or later you can simply use java.util.UUID.randomUUID()
Johan Pelgrim
Yes, and that's a good method. But I have noticed some people prefer time+location based method (there are 3 methods, last one is name-hash based) over random one. Mostly because it intuitively seems to have stronger guarantee of uniqueness (which is not really true, IMO, but intuition sometimes leads one astray :) )
StaxMan
+13  A: 

Saxon, for XSLT 2.0 processing (and other handy XML stuff)

Bill Michell
That's Saxon, not xalan. Although the link is good :)
deathy
+115  A: 

Let's not forget the excellent Google Collections library. (Edit: Google Collections was expanded and renamed to Guava. You should not use the library titled "Google Collections" anymore.)

Javalobby's interview with its main developers is a good introduction: What is the Google Collections Library?

Comments by Steve McLeod:
It's gradually altering my whole coding style. Preconditions, Functions, Transformers are stupendous once you get the hang of them.

bernardn
+1. Google Collections seems like the best possible extension to the Java Collections framework one could imagine. The API and its documentation are of high-quality; the library is built to fully utilise Java 5 features (generics, enums, etc); it's been designed by really smart people who've had the possibility to turn to people like Joshua Bloch and Doug Lea for consultation. Read the Javalobby article if you haven't yet!
Jonik
In addition to the Javalobby interview, a good resource for getting to know Google Collections is Kevin Bourrillion's presentation, available on Youtube: part 1: http://www.youtube.com/watch?v=ZeO_J2OcHYM; part 2: http://www.youtube.com/watch?v=9ni_KEkHfto. It's a tour of the library and its main APIs on a quite technical level. The guy expresses himself very clearly!
Jonik
I understand why they use static 'create' methods instead of ctors. I just don't like it.
KitsuneYMG
@Jonik, thanks for this, particularly the link which leads to the other link http://publicobject.com/2007/09/series-recap-coding-in-small-with.html... great stuff.
Yar
Google Collections has been rolled in to [Guava Libraries](http://code.google.com/p/guava-libraries/), which has support for primitivies, IO and concurrency among other things (though some parts are Beta and subject to change). Just makes a good thing even better.
ColinD
Guava libraries (r06 now) can replace some apache commons - collections, io etc.
peperg
+1  A: 

Some of the stuff we used:

mitchnull
We've also used jCIFS... Any chance you split this to separate posts so that the libs can be voted on individually?
Jonik
A: 

MessAdmin, a fantastic HttpSession administration tool, and giving detailed statistics and informations on any Web application. It installs as a plug-in to any Java EE WebApp, and requires zero-code modification.

+12  A: 

The JGoodies Forms framework, featuring the excellent (and most importantly, sane) FormLayout layout manager for Swing.

insin
+45  A: 

Mockito for easy testing. Allows mocking concrete classes (besides interfaces, of course) as well.

I've written unit tests for years, but Mockito and Easymock impressed me immediately.

+1 for Mockito! Unlike Easymock, it was quick for me to "grok", and it actually made tests simpler and easier to understand
Jonik
+39  A: 
  • JUnit for unit testing
  • Tomcat or Jetty as servlet container
  • Spring for configuration and glueing code together
  • Hibernate for object persistence
  • C3P0 for database connection pooling
  • Lucene for fulltext search
  • Log4J for logging
  • Apache Commons for a whole bunch of stuff: language utilities (see StringUtils), special collections, IO, file uploads, validation, etc.
  • POI for reading/writing MS Office file formats
  • PDFBox for manipulating PDFs
  • Velocity for templating

These are all libraries I use or have used and can definitely recommend.

Tom De Leu
If you create a separate post for each suggestion they can be rated individually:-)
johnstok
Yeah, now it's impossible to tell which of the 26 votes are meant e.g. for Hibernate and which for Velocity. I think this should be split into separate answers (well, those libs that don't have a separate post yet), or failing that, voted down.
Jonik
-1 split them. That's part of the question.
mrrtnn
+61  A: 

JfreeChart is the best freely available charting thing available on any platform.

djsadinoff
A lightweight "cloud computing" alternative to jfreechart is charts4j (http://charts4j.googlecode.com).
Julien Chastang
The JFreeChart API could be much cleaner (my colleagues tell me), and they have managed to break backwards compatibility from time to time. But indeed, you can do nice charts with it - no other free Java library comes close, as far as I know.
Jonik
+21  A: 

TestNG: http://testng.org/

It was mightily useful in creating a database driven web testing framework some years ago. JUnit was too rigid at the time to do what I needed.

Mike Cornell
TestNG is still slightly better than Junit 4. More granular test plan strategies.
Spencer K
+1  A: 

Name: Uncommons Maths

Website: https://uncommons-maths.dev.java.net/

Purpose: Generics enabled CombinationGenerator! A Random seed generator

Pyrolistical
+48  A: 

Name: The Legion of the Bouncy Castle

Website: http://www.bouncycastle.org/java.html

Purpose: Security/Cryptography

Greg Mattes
Do people really trust a product named "Bouncy Castle" for important security-related things?
Adrian Petrescu
Google does. BC is the default on Android, I believe.
InverseFalcon
+12  A: 

What are some of your can't-live-without Java libraries?

**java.util**

It is java, it is free, it is good, and I can't live without it.

Don't make it less for live in the core :)

OscarRyz
These are NOT third-party libraries.
Stephen C
When I first posted this answer, the question was "What is the most useful free libraries" It didn't say anything about 3rd party, back then.
OscarRyz
+3  A: 

The Java Spell Checker JOrtho can be use very easy with any GUI application.

Website: http://www.inetsoftware.de/products/tools/JOrtho/

Horcrux7
A: 

Apache-commons if you need a lot of utilities that the Java standard library left out (e.g., collections, XML, etc.)

JMS (can also get as part of J2EE) if you need to reliable send messages from one machine to another and don't want to deal with the hassle of maintaining your own queues.

I'm also a fan of SWT for GUIs (mostly used as part of the Eclipse project)

Uri
+6  A: 

Most of my faves have been mentioned (like Apache Commons, Hibernate, and Spring), but I'd like to add:

Andrew Swan
+8  A: 

Rhino -- http://www.mozilla.org/rhino/

a javascript compiler/interpreter, allowing the execution of javascript within your java app.

Nathan Feger
It's a Javascript compiler/interpreter -- would help to add this to your description.
Jason S
+1  A: 

A port of apache collections with parameterization: http://larvalabs.com/collections/

I feel like there is another one of these too, but I can't think of it.

Nathan Feger
+8  A: 

Note: This is a duplicate of another answer to this question (and that other answer has more votes as I write this, so vote up the other answer!). Notes from this answer have been merged there.


Google Collections

It's gradually altering my whole coding style. Preconditions, Functions, Transformers are stupendous once you get the hang of them.

Steve McLeod
A: 

Castor for Java-XML binding

Vihung
+8  A: 

FreeMarker for templates.

Jeroen van Bergen
+3  A: 

Another vote for SWT. GridLayout is so much better than Swing's GridBagLayout (of which I have nightmares about). Although, SWT has some glitches, If I have the choice, I'd always prefer SWT to Swing.

Jan Gressmann
+4  A: 

Substance A nice Swing LaF.

(SLF4J removed from this answer; upvote this one instead.)

welterde
Saw SLF4J (+12) on page 1 by StaxMan
crowne
+2  A: 
rayyildiz
Could you split this to separate answers for each lib? Now it's impossible to tell which upvotes are meant for which libraries (-1, for now, because of this).
Jonik
+8  A: 

Log5j is a wrapper around Log4j that uses Java 5's var-args for an automatic String.format in log messages:

log.debug("IOException while reading %s", exception, file.getName());

Ed Brannin
Yes, truly great. it's now almost 2010 and yet none of the popular logging engines allows printf style logging.
Lars Tackmann
slf4j allows {} placeholders. I believe Ceki has timed it to be the fastest approach.
Thorbjørn Ravn Andersen
I'd put up with slf4j's {} placeholders (and their not having room for String.format options like "%,d") if it had varargs-style methods. As-is, you can only pass up to two parameters per message; I regularly do more than that. Unless it's changed since the last time I looked?
Ed Brannin
+13  A: 

AspectJ - a seamless aspect-oriented extension to the Javatm programming language.

Very useful for logging, debugging, testing and more.

AspectJ is just awesome. Specially the Load-Time-Weaving feature, that allows embedding aspects without recompiling your application
Camilo Díaz
I wish I could vote this up more than once. People really, really, really have to stop littering code with logging statements.
Dave Jarvis
+2  A: 

Jena Semantic Web Framework for work with RDF and OWL models

Vinze
A: 

Pingel Math library

http://www.pingel.org/

ANTLR for parsing http://www.antlr.org/

Any chance you split this to separate posts so that the libs can be voted on individually?
Jonik
+6  A: 

JMonkeyEngine - 3D scene engine Have a look to the demos.

Gilles
+13  A: 

Apache Wicket, POJO-based web application framework. That description is short but it's beyond powerful, check the examples from the site and you should understand why.

P Arrayah
I'm currently building my first Wicket app, and the only thing I can say is that this framework is awesome! Like P Arrayah said, just check the examples...
Séb
+2  A: 

Stripes framework

It's a lightweight annotation-driven presentation framework.

Freemarker

A superb templating engine.

Jonathan
Any chance you split this to separate posts so that the libs can be voted on individually?
Jonik
+4  A: 

json-lib provides convenient functionality for parsing JSON strings into/out of Java objects. This is quite helpful if you work on Ajax web apps.

Chinnery
+1  A: 

JiBX, a seriously underused XML mapping lib

Karl
A: 

I even work with:

  • Ant for building and deploy of software.

  • Struts for developing web application.

alepuzio
Two items in one answer, Ant is not a library and Struts is a duplicate
finnw
+6  A: 

XOM

XOM™ is a new XML object model. It is an open source (LGPL), tree-based API for processing XML with Java that strives for correctness, simplicity, and performance, in that order.

Peter Štibraný
A: 

Piccolo2D (formerly Piccolo)

Toolkit for development of 2D structured graphics programs, in general, and Zoomable User Interfaces (ZUIs), in particular. Good for highly interactive user interfaces.

Source code for 1.2.1 does not build out of the box.
Dave Jarvis
+5  A: 

The Apache JXPath is a great little library, yet remarkably unknown. It allows you to access Java object methods using XPath-like syntax. For example, rather than writing:

for (Person p : getCompany().getDepartment().getPeople()) {
   if(p.getName().equals("Brian") {
      ...

You can write:

  JXPath.newContext(getCompany()).getValue("/Department/People[@name='Brian']");

(A trivial example. XPath can do so much more)

It doesn't make so much sense hardcoding this, but it's very useful for configs etc.

Brian Agnew
Looks useful - I've been learning XPath and the syntax is very nice
I82Much
+4  A: 

DWR (Direct Web Remoting) - Makes it quite easy to do Ajax calls to server-side Java code from JavaScript running in the browser.

Jonik
+5  A: 

Dom4J - Library for XML / XPath / XSLT handling

Jonik
For my quest to find a better Java XML library to replace dom4j, see http://stackoverflow.com/questions/831865/what-java-xml-library-do-you-recommend-to-replace-dom4j
Jonik
+14  A: 

Selenium - automated UI testing (or acceptance testing) framework for web applications. Getting up to speed and making your tests stable enough for fully automated continuous integration probably won't be easy, but once you do, it's quite cool what you can do with Selenium.

In case you're totally new to this, here's a summary: You can write test cases in pure Java, JUnit-style, and when you run them, Selenium launches e.g. Firefox and does all kinds of stuff (clicks on links, types into forms, does assertions about page content, etc.) against your webapp. (This is just one way of using Selenium - you can also record tests with Selenium IDE, or use other languages such as Python or C# to write them.)

Jonik
+10  A: 

LogBack for logging. After using logback, log4j seems antiquated.

Elijah
A major drawback of using LogBack is that it does not provide an asynchronous appender. There are a couple contribs in their JIRA, but you have to build them yourself. This makes using LogBack in production a no-go for a lot of folks.
Paul Morie
+1  A: 

I find this to be a good list of free Java libraries http://java-sources.org/

Peter Lawrey
A: 

Here are my choices.

  1. JUnit
  2. Log4J
  3. Apache Commons Configuration
  4. FindBugs (it is a tool rather than a library)
grayger
-1, for now, because 1) some are duplicates 2) many libraries in one post
Jonik
lol one negative vote should be enough I guess :(
Alfred
A: 

I use jcharts quite a bit. Great for creating a variety of graphics.

+11  A: 

GWT - If your Javascript skills are not adequate enough for stunning AJAX applications

sarav
Wow only 6 votes for Google Web Toolkit ?. it's one of the best Java frameworks and should surely be able to beat old-timers like log4j (which is not even that nice compared to say slf4j)
Lars Tackmann
+9  A: 

Can't believe we missed Java Service Wrapper

Pyrolistical
+9  A: 

Terracotta

With it you can, for example, make a server-side application support clustering without having to litter your code with clustering infrastructure. You basically define "shared roots", globally distributed methods, instrumented classes (whose instances will be passed between JVMs), etc, in a configuration file, and in Java code just make sure access to those is correctly synchronized.

(Terracotta can be used in other scenarios too, but clustering is what I'm most familiar with.)

It's open source and free (for most uses at least), but commercial licensing options and support are also available.

Jonik
+7  A: 

XMLBeans - XMLBeans is a technology for accessing XML by binding it to Java types. Why work with XML when you can work with classes/objects?

zzztimbo
Not that I have anything against XMLBeans, but my impression has been that it has been mostly superseded by JAXB... (it still should get lots of credit for paving the way tho, JAXB v2 wouldn't be as good as it is without XMLBeans).
StaxMan
+1  A: 

RichFaces is an open source framework that adds Ajax capability into existing JSF applications without resorting to JavaScript, with a huge library of rich components and skinnability support.

Skubs
How, precisely, does one add AJAX (Asynchronous **Javascript** And XML) without resorting to Javascript?
JUST MY correct OPINION
+30  A: 

SLF4J

Surprisingly, this good facade lib for logging (better than commons logging) was still missing.

StaxMan
If you added these in separate answers, they could be voted on individually... By the way, JAXB was mentioned already.
Jonik
True, sorry about JAXB, only noticed it after adding (I'll edit it away). Thanks for suggestion!
StaxMan
I've voted up Logback, I'll vote this too (simply because people won't know they're the same thing)
Stephen
SLF4J is a facade, Logback is a native implementation of it.
Ivan Dubrov
+4  A: 

Also, for JSON processing, a full-featured package that does streaming read/write, tree model and full data binding (lists, maps, primitives and beans, without custom code):

StaxMan
+4  A: 

JUNG - Java Universal Network/Graph Framework

Comes with many standard graphing algorithms. Provides some sane algorithms to lay out vertices in visualizations.

Adam Paynter
+2  A: 
zvikico
+4  A: 
  • Name: GNU Trove
  • What: primitive collections (avoids autoboxing/unboxing of primitives to objects)
  • Competition: pcj, but Trove is more stable and recently maintained. May be faster too.
  • Why: faster and lighter on RAM than object-based collections.

Suggested Uses: ANY time you're storing a lot of ints, chars, or longs in memory and running out of memory. Doubly useful if collections are having items added/removed/modified a lot, because these operations are much faster on primitive objects.

Also useful in cases where very predictable performance is needed and garbage collection pauses cause problems.

ANYTHING that does work with graph-style relationships between RAM-expensive objects will benefit, because you don't need to store the objects in memory, just an int or long unique identifier for each. Persist the objects to disk, and let TIntIntHashMaps store relationships. You can store 8x as many relationships in memory for the same RAM use as a vanilla HashMap.

BobMcGee
we've found fastutil to be as good or better, and has more features.
Kevin Bourrillion
I don't think fastutil was out when I first looked for this. It does seem more full-featured, but isn't it kind of a large library, with all the different collection variants?
BobMcGee
+3  A: 

StringTemplate as a general purpose templating engine. It's simple yet ingenious...

Roland Tepp
+1  A: 

Name: Functional Java

Website: http://code.google.com/p/functionaljava

Purpose: Provides first-class functions, generic compound types, immutable (persistent) data structures, lazy (infinite) lists, parser combinators, actor concurrency, specification-based testing, flexible replacements for toString(), equals(), and hashCode(), and more.

Apocalisp
A: 

I've found AjaxTags very useful for DisplayTag updates without page refreshes and building servlet based autocompletes. It's one of several libraries for ajax development with minimal javascript coding. The site also has some great demo to try out.

AjaxTags

+5  A: 

I recommend the Simple XML library for XML serialization. It can do virtually anything you need. Add a few annotations and you're done or you can customize everything to make it deserialize a 3rd party XML format into your classes. And, as the name suggests, it is really simple. Great documentation, under active development, top notch stuff.

TomA
How does it compare to JAXB (v2, Sun ref impl)? Or, rather, how is it better (sounds like it does much/most of what JAXB does)?
StaxMan
Sorry, I don't know JAXB. Simple XML works like this: you take a class you want to serialize, add a @Root annotation to it and then you add @Element, @ElementList and @Attribute annotations to its fields. That's it, next step is a single line read or write to a XML file. There are many options for customizing everything, so its possible to match an existing schema, have optional fields, add callbacks etc.
TomA
+3  A: 

I'm surprised no one has mentioned iBatis (ORM/Persistence for people who like to use actual SQL code) or JMock (mock objects).

It would be better to put one library per answer so they can be voted on separately. Could you dedicate this post to just JMock (since Ibatis is mentioned separately here: http://stackoverflow.com/questions/130095/most-useful-free-java-libraries/854001#854001)?
Jonik
+1 for iBatis, it's wonderful!
Jim Ferrans
+1  A: 

JGAP - It's a package for doing genetic programming quickly and easily. I was able to use it the first time and had an answer to a question in four hours that humans had previously spent days on and not gotten nearly as good an answer.

If you need to answer questions about efficiency (fastest, cheapest, least distance, etc.) or even if there is any solution at all with a given set of constraints within a complicated system involving lots of variables then JGAP is your best friend in the world. Don't automatically assume it's just for academic wonks, it's every bit as applicable in real world circumstances.

John Munsch
Well if Ceiling Cat says it's good, I'm convinced!
Andrew Swan
I've used JGAP. It was a little awkward. If I had it to do again, I'd try http://watchmaker.uncommons.org/
dfrankow
A: 

Apache Xalan.

It's buggy and shabby, but we absolutely can't live without it.

alamar
Not that I dislike Xalan, but isn't Saxon better in many ways?
StaxMan
Maybe it is, I didn't try it. Why not nominate it?
alamar
+10  A: 

Ibatis for ORM.

http://ibatis.apache.org/
Chadwick
+7  A: 

ASM, the Java bytecode manipulation framework and CGLIB, the code generation library. A lot of the frameworks (viz. Hibernate) here rely on ASM and CGLIB (which itself relies on ASM) to do their magic.

Paul Morie
Wrong way round - CGLIB uses ASM, AFAIK. Check out http://asm.ow2.org/users.htmlWithout these gems a lot of the cool tools listed here wouldn't exist.
CurtainDog
I believe that you're correct -- I was mislead by the ambiguity of the relationship expressed on the CGLIB site: http://cglib.sourceforge.net/
Paul Morie
+3  A: 

JLine

A great substitute for ReadLine, written in pure Java, portable between platforms (specifically Linux and Windows).

Here is example use.

A: 

I've used JHotDraw for a few projects. It's a great 2D graphics framework for structured drawing editors.

thedude19
+3  A: 

While not Java specific, Axis and preferably Axis 2: http://ws.apache.org/axis2/

Makes creating web services very easy and it works with a few different serialization libraries to allow objects to be sent from clients to servers without having to do any serialization on your side.

Axis 2 has a completely different set up than the original axis, but the changes are worth it.

That is if you are creating web services

bogertron
Prefer CXF actually, but whatever works for you..
Tim
A: 

JavaBuilders -- lets you specify creation/parameters/bindings of a GUI layout in a succinct format; flavors exist for Swing, SWT, and GTK+.

Jason S
+1  A: 

LWJGL for OpenGL and OpenAL wrappers and polling input devices.

TomA
+1  A: 

Surprised to see not much of JBoss stuff here apart from Hibernate.

Anyways, one of my favorite tools is Drools/JboosRules engine.

Not sure how many use Antlr, but I require it lot of time.

sbidwai
ANTLR is mentioned elsewhere; could you dedicate this answer to Drools only?
Jonik
+2  A: 

jawr - "Minifies" and compresses Javascript (and CSS) on the fly. It even has development flags you can set to disable compression and minification to allow you to debug readable Javascript. Also integrates with DWR!

qbn
+6  A: 

I think JNA (Java Native Access) should be on the list for easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required (from the website)

We're using it for direct calls to Windows software and DLLs; it works really well and can be a huge time saver.

Greetz, GHad

GHad
+1  A: 

Name: ACM Java Task Force Library

Website: ACM Java Task Force Library

Purpose: To review the Java language, APIs, and tools from the perspective of introductory computing education and to develop a stable collection of pedagogical resources that will make it easier to teach Java to first-year computing students without having those students overwhelmed by its complexity.

Strengths:

  • A simple object-oriented model for programs.

    The Program class defined in the acm.program package offers an easy-to-use model for writing simple programs. In addition to hiding the static main method, the Program class and its standard subclasses provide a highly intuitive example of object-oriented class hierarchies.

  • A model for input and output that treats traditional console I/O and dialog I/O symmetrically.

    The acm.io package defines the classes IOConsole and IODialog that share a common interface for all input-output operations. This design addresses the lack of a simple input mechanism in a way that emphasizes the value of interface-based design.

  • An extensive library of graphical objects.

    The acm.graphics package implements a simple but extremely powerful model for creating graphical pictures based on the metaphor of a felt board in which students construct graphical objects of various types and place them on a canvas. This design emphasizes the use of objects and frees the student from having to respond explicitly to repaint requests.

  • A minimal set of new classes to support development of graphical user interfaces.

    The acm.gui package includes a small set of classes to bring Java’s extensive GUI-development resources within reach of novice programmers.

  • Backward compatibility for applets.

    Unlike most Java code today, programs developed using the JTF packages can typically be executed as applets even on older web browsers. This flexibility makes them ideal for web-based teaching tools and lecture demonstrations.

Ibn Saeed
+1  A: 

trueZIP for providing java.io.File interface to archives.

ykaganovich
+7  A: 

Jython. Yes it's still alive people, and they've just released 2.5 recently. It's quite useful to call Java libraries using less verbose Python syntax in a day-to-day administrative tasks.

jpartogi
Good call, +1. We use it (to implement a scripting API inside our Java app). Its development could be more active, etc, but still: for bringing Python and Java together, Jython is the way to go.
Jonik
A: 

PMD. For helping finding those bad practices code. Really useful to make your code beautiful.

jpartogi
A: 

Java Interface for Go

API for Go-related applets and applications.

Dave Jarvis
+6  A: 

H2Database. Really useful during unit testing. Slightly faster than HSQL.

jpartogi
Depending on what you're doing, can be MUCH faster than HSQL, especially with complex queries. Has a lot more features too.
BobMcGee
+1  A: 

JOpt Simple

For parsing command line options, similar style to Unix commands. The API is simple, while offering an immense feature set.

Dave Jarvis
+1  A: 

Markdown-Doclet for including Markdown syntax in Javadocs rather than HTML.

Richard Nichols
+7  A: 

Processing is a pure, java based graphics and multimedia library, that has been used by even artists. I myself use it for it's simplicity and power of 3D drawing. There are many plugin libraries for it too. The speed of it's drawing and graphics manipulating capabilities are georgeous! There is a Javascript and Ruby port of it.

Ikon
+3  A: 

args4j, a most sensible way to parse command-line arguments.

dfrankow
I agree, very easy to use for my needs
I82Much
+1  A: 

Library: FlyingSaucer / XHTMLRenderer

Purpose: Render XHTML / CSS to PDF or a Swing component (and do so wonderfully well!)

It's the only way I write reports anymore.

Alexander Malfait
+1  A: 

WAX for writing XML documents with less code.

xrath
+1  A: 

JGraphX is a very useful library/framework for visualizing / editing networks/graphs. Perhaps less sophisticated for visualization than Prefuse, but very good for creating the graphs in the first place.

I82Much
A: 

Name: JXTA

Website: https://jxta.dev.java.net/

Purpose: Allows developing highly scalable P2P communication networks among applications without coding everything from scratch.

jaxvy
+2  A: 

http://www.unitils.org/summary.html

I had a need to perform deep equality checks within my test cases. The commons EqualsBuilder.reflectionEquals didn't go deep. The "assertReflectionEquals" feature provided by unitils was a life saver. I didn't have to write equals methods for all my classes and the generated error message when objects don't equal precisely identifies the attributes. This is the best deep equals utility I was able to find.

Steve Wall
+2  A: 
Navi
+2  A: 

SLF4 and Logback are the best for logging. I am surprised that people are still talking about commons-logging (awful) and log4j.

lenkite
A: 

Legion of the Bouncy Castle cryptography API for anything crypto related.

Kavon Farvardin
-1, Duplicate of http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/136985#136985
Rob Hruska
A: 

slick - simple,fast,documented library for 2d graphics

kusoksna
+1  A: 

jDBI for simple, safe, no-nonsense relational data access (esp. for simpler use cases than what Hibernate et al are good for). For some reason it is not very well known, but it is an absolute pearl.

StaxMan
+2  A: 

If you use JSF alot, then you cannot avoid JBoss Seam. It is awsome! Of course it is not only required when running JSF.

It is a very nice library for Java EE. It was Seam that led to Context and Dependency injection and alot of the features in Java EE 6.

Shervin
A: 

Jpcap - Using Jpcap, you can develop applications to capture packets from a network interface and visualize/analyze them in Java

rgksugan
+5  A: 

JAXB - JAXB allows Java developers to access and process XML data without having to know XML or XML processing, validate source data against an associated schema, JAXB allows access to data in non-sequential order, but it doesn't force an application to navigate through a tree to access the data etc. etc

Lalith
Having been doing quite a bit with it recently, my feeling is that JAXB is over-subtle and finicky. There are just too many cases where the path between greatness and crud is a very fine line.
Donal Fellows
A: 

Castor - Castor is an Open Source data binding framework for Java[tm]. It's the shortest path between Java objects, XML documents and relational tables. Castor provides Java-to-XML binding, Java-to-SQL persistence, and more

Lalith
-1, Duplicate of http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/166374#166374
Rob Hruska
@Lalith, consider upvoting (and commenting on) the other answer; having duplicates around isn't very useful
Jonik
A: 

Processing was quite useful for me. http://processing.org/

Nils
-1, Duplicate of http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/1282653#1282653
Rob Hruska
+1  A: 

I love me some JScience. Makes a number of scientific tasks (for me, it was unit conversion) very easy.

JasCav
+1  A: 

OSWorkflow is a very power full workflow engine

Arun P Johny
+5  A: 

Ehcache is an open source, standards-based cache used to boost performance, offload the database and simplify scalability.

Arun P Johny
+5  A: 

I can't think we missed Java Mail

Arun P Johny
Maybe it wasn't mentioned cos it strictly speaking isn't a "third party" lib, is it? :)
Jonik
+5  A: 

Jruby is a pure-Java Implementation of Ruby programming language

Arun P Johny
+6  A: 

Jep is a very good Java library for parsing and evaluating mathematical expressions.

Arun P Johny
+1  A: 

How could you miss Eclipse BIRT

Jason
A: 

Drools - A great BRMS API. Very useful to manage your ever changing business rules.

chedine
+4  A: 

Liquibase

For managing database updates.supports many databases and is extensible for custom requirements.

daedlus
+1  A: 

Restlet is an excellent framework for building and/or working with RESTful systems. I've been using it in many production systems for years and it's been a huge boon.

Avi Flax
A: 

Nekohtml - tidy up html into xml document for data processing (xpath/xslt)

http://nekohtml.sourceforge.net/

TagSoup - a SAX-compliant parser written in Java that, instead of parsing well-formed or valid XML, parses HTML as it is found in the wild

http://home.ccil.org/~cowan/XML/tagsoup/

jacklty
+4  A: 

Guava: Google Core Libraries for Java 1.5+

rich
+1. See [this post](http://stackoverflow.com/questions/130095/most-useful-free-third-party-java-libraries/132639#132639) for Google Collections specific comments, etc. (Google Collections is now part of Guava.)
Jonik
+1  A: 

Nobody mentioned Java image utilities??

A Java library for loading, editing, analyzing and saving pixel image files.

It supports various file formats.

Provides demo applications for the command line. It has AWT GUI toolkit too.

JavaGeek