Java Developer's Toolset

This small article is a reminder for myself, for the case when I need to set my workspace up next time. A set of short and most essential points which I don't want to ever re-discover again. I start from the description about the development, build, and testing environment and accepted practices and continue with the description (or just mentioning) of important software packages or frameworks (IO, logging, persistence, XML, etc.) which can really boost a developer's performance and are a must for your code to be "pluggable" like the rest of Java code.

A Convention

A basic things about Java development environments is a convention, as basic as a rule to put #ifndef...#define...#endif macros in C/C++ header files. Each class should belong to a package. A package name is reversed order corporate Internet domain name followed by dot separated hierarchical package name in direct order (like net.bobah.examples.logging). The package statement should be the first statement in the file. The files should be located in the directory tree according to their packages names. The file HelloWorld from net.bobah.examples.logging package should be put to .../net/bobah/examples/logging/ Once the convention is met the source tree can be used by most Java development frameworks and build systems without any refactoring.


I like the Eclipse platform (the one for Java EE), A full featured development framework written in Java and for Java. Very convenient for code browsing, refactoring, debugging. And building, but I personally prefer Ant (see next section "Building"). It also provides an excellent real-time compiler errors reporting. The most essential thing to know about Eclipse is a terminology:
project — a project, a set of files not having much sense without each other (usually implementing a well determined piece of functionality)
workspace — a set of projects having something in common (interdependencies, logical or runtime connection, common protocols, etc.), kind of "working context", the workspaces can be "switched" from one to another perspective — a configuration of a GUI's widgets layout and a functionality available via menus. There are, for instance "Java code browse" and "Java debug" perspectives. Perspectives themselves are pluggable, so one can have, say Hibernate perspective with special tools for persistence layer development.
The refactoring tools and automatic code generators for constructors and getters/setters are available via context menu (and shortcuts). "SHIFT+CTRL+T" is a sortcut for a class search within the workspace.
I'd recommend downloading and installing the Eclipse IDE for Java EE Developers as it much more feature reach than the one for Java SE (JSP/JSF, Web-Services, EJB, XML, etc.).


The build is typically done either directly from Eclipse or using either Maven or Ant.

Eclipse The simplest push-button build variant, good for the build debug or a prototype small project. The CLASSPATH, input and output directories are configuration is done via project properties menu. The project specific settings are stored in .project and .classpath files in the project's root directory. The workspace specific settings (code style, compiler settings, etc.) are configured via Window->Preferences, I never had to find either of these setting in the file system.

Ant Very similar to makefile but configuration files are in XML format and there is a set of Java specific atomic tasks so there is no need to memorize all javac flags and automate a filesystem iteration for compiling a source tree. My preferred build system. Scalable, extensible, configurable, yet simple and very fast.

Maven Convention enforcing, strict framework written in plugin-based architecture. Plugins exist for most common use cases. When using Maven the Eclipse project can be generated with this command: "mvn -DdownloadSources=true -DdownloadJavadocs=true -DoutputDirectory=target/eclipse-classes eclipse:clean eclipse:eclipse".

Already written

Testing - JUnit a de facto standard for Java project unit testing.

Logging — SLF4J & Logback and The first is a logging abstraction layer, the letter is a feature rich, configurable, and reliable logger.

Persistence — Hibernate JPA certified persistence framework. Very powerful and extremely easy to set up and use once you understand the concepts. Offers and excellent reverse engineering (DB-to-Java or DB-to-DDL) functionality. There is a Hibernate plugin for Eclipse offering visual configuration files creation with development time connection to the DB.
A good complimentary tool, a DBMS client written in Java is a SquirrelSQL, it let's you test a DB connection settings, SQL queries in a JDBC dialect and many more. And it is using the same code and drivers which your application would use.

Web Services & Web GUI (JSP) — Apache Tomcat, Servlet, JAX-WS, SoapUI

Lot of other stuff

There are lots of projects in the Apache Software Foundation which can be combined, reused (as a whole or partially) or copy-pasted from.