Java code has the big advantage of being very portable.
Recommended sources of information
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 Eclipse IDE.
Coding style conventions
We follow the standard coding style defined by SUN.
Latest version seems to be available here.
We have standard code formatting settings for eclipse.
TODO: describe tabs-vs-spaces and indentation size.
Automated checking of the code style can be done with PMD and FindBugs.`
TODO: add (a link to) our standard ruleset.
Building and packaging code
As a build system we normally use Gradle. This also determines the project layout, and has standard features for packaging code.
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
Code quality analysis tools and services
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 logback beagle.
Java has the inbuild JavaDoc system for generating API documentation, usually in the form of HTML. Highly recommended.
Recommended additional packages and libraries
JFreeChart is a Java library that allows to do nice looking charts.
There are currently no Java templates available. See The Xenon repo on GitHub as an (rather complex) example.