Installing Compilers and Runtimes
Its recommended to use the latest official Oracle version (Java 8) if at all possible. OpenJDK is usually ok as well, but definitely avoid gcj.
Editors and IDEs
For Java we normally use the IDE.
Coding style conventions
We follow the standard coding style defined by SUN.
Latest version seems to be available .
We have standard code formatting settings for eclipse.
TODO: describe tabs-vs-spaces and indentation size.
TODO: add (a link to) our standard ruleset.
As a build system we normally use Gradle. This also determines the project layout, and has standard features for packaging code.
Testing
The standard unit testing framework in Java is JUnit. Try to use Junit 4 if at all possible.
Use following naming scheme to distinguish unit and integration tests:
- Unit tests: /Test*.java, /Test.java, and **/TestCase.java
- Integration tests: /IT*.java, /IT.java, and **/ITCase.java
Test coverage can be measured with . For running and viewing Jacoco code coverage, use eclemma
Code quality analysis tools and services
SonarQube is an open platform to manage code quality which can also show code coverage and count test results over time.
SonarQube can analyze Java, C, C++, Python and Javascript.
The analysis can be done in IDE or command line using http://www.sonarlint.org/
For example project see
Notifications of each project must be configured in your own account settings.
Code quality and coverage grouped by file.
Can setup goals to improve quality or coverage by file or category.
For example project see https://www.codacy.com/app/NLeSC/Xenon/dashboard
Debugging and Profiling
Use jConsole or jVisualVM.
For logging, we use the slf4j api. The advantage of slf4j is that it is trivial to change logging implementations. The API distribution also contains a few simple implementations.
To get logging info into Eclipse, one option is to use .
Writing documentation
Java has the inbuild system for generating API documentation, usually in the form of HTML. Highly recommended.
Recommended additional packages and libraries
is a Java library that allows to do nice looking charts.
Available Templates
There are currently no Java templates available. See as an (rather complex) example.
We use Bintray to publish packages.
Packages developed at the Netherlands eScience Center can be found .