Tune Java Code

Code Generation & Refactoring

  • XDoclet
    XDoclet is a code generation engine. It enables Attribute-Oriented Programming for java. In short, this means that you can add more significance to your code by adding meta data (attributes) to your java sources. This is done in special JavaDoc tags. Currently XDoclet can only be used as part of the build process utilizing Jakarta Ant. Although XDoclet originated as a tool for creating EJBs, it has evolved into a general-purpose code generation engine. XDoclet is open source developed by a group of experts around the world and distributed under a flexible BSD license.
    SourceForge Project: xdoclet.
  • JRefactory
    JRefactory is a tool that allows you to perform many package, class and method refactorings. JRefactory also includes other useful related tools: Pretty Printer/Beautifier, UML Diagrams, Printing, Coding Standards checking, BugFinding, Metrics, among others. The software is free, created by Chris Seguin and now maintained by Mike Atkinson. Currently supported IDEs: jEdit, NetBeans 3.6, JBuilder X, Stand-alone, Ant.

Code Quality Analysis & Problem Detection

  • Glean
    Glean is a framework of Ant scripts for generating feedback on a team's source code. Glean's goal is to make it possible to add feedback to your build cycle with as little pain as possible. The scripts drive a number of open-source tools and collect the resulting HTML for you to deploy to a project website or some other common team area. A dashboard collects the key metrics from the various tools that have been run and presents them on a summary HTML page.
    Supported tools: Spring beandoc, Checkstyle, Cobertura, PMD & CPD (Copy/Paste Detector), dbdoclet, doccheck, Emma, FindBugs, jaranalyzer, java2html14, java2html15, javadoc, JavaNCSS, jdepend, JUnitreport, QALab, SchemaSpy, statCVS, statSVN, UMLgraph-doc, UMLgraph-views.
  • QALab - Statistics for your Build
    Consolidade data from QA Tools like Checkstyle, PMD, FindBugs, Cobertura (cobertura-branch, cobertura-line), Emma and Simian into a generic qalab.xml format, and generate charts and summary pages (XML, HTML).
  • PMD
    PMD scans Java source code and looks for potential problems like: Possible bugs, dead code, suboptimal code, Overcomplicated expressions, Duplicate code. PMD is integrated with many Java IDEs: Eclipse, NetBeans, JDeveloper, JBuilder, BlueJ, JEdit, Gel, Emacs.
    PMD Copy-Paste Detector (CPD).
  • FindBugs
    FindBugs is a program which looks for bugs in Java code. It is free software, distributed under the terms of the Lesser GNU Public License. FindBugs requires JRE (or JDK) 1.4.0 or later to run. However, it can analyze programs compiled for any version of Java.
    The name FindBugs™ and the Findbugs logo are trademarked by The University of Maryland. FindBugs is sponsored by Fortify Software.
    Eclipse IDE plugin for FindBugs also provided.
  • Simian
    Simian (Similarity Analyser) identifies duplication in Java, C#, C, CPP, COBOL, JSP, HTML source code and even plain text files. Simian can be used as part of the build process during development or re-factoring to assist in raising the quality of your software.
  • JavaNCSS - A Source Measurement Suite for Java
    JavaNCSS is a simple command line utility which measures standard source code metrics for the Java programming language. The metrics are collected globally, for each class and/or for each function. It counts: Packages, Classes, Methods, NCSS (Non Commenting Source Statements).
  • CAP - Code Analysis Plugin
    CAP is a plugin for the Eclipse platform and analysis the dependencies of your Java project. It opens a own perspective and displays the results in a clear way using different diagrams.
  • Eclipse Metrics plugin Provide metrics calculation on Java code and dependency analyzer plugin for the Eclipse platform.
    This metrics plugin calculates various code and design metrics for Java projects — such as McCabe cyclomatic complexity and the dependency metrics of Robert Martin and many others —, with average and standard deviation; detect cycles in package and type dependencies and graph them. It also includes a graphical dependency analysis tool based on the dynamic hyperbolic graphing package TouchGraph.
    Metrics at SourceForge.
  • SourceMonitor
    The freeware program SourceMonitor lets you see inside your software source code to find out how much code you have and to identify the relative complexity of your modules. For example, you can use SourceMonitor to identify the code that is most likely to contain defects and thus warrants formal review. SourceMonitor, written in C++, runs through your code in a very fast (typically at least 10000 lines of code per second), single pass through source files written in C++, C, C#, VB.NET, Java, Delphi, Visual Basic (VB6) or HTML. It saves, exports (XML, CSV), displays and prints metrics in tables and charts, including Kiviat diagrams. Operates within a standard Windows GUI or inside your scripts using XML command files.

Coding Style & Standardization

  • Java Checkstyle
    Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard. By default it supports the Sun Code Conventions. However, Checkstyle is highly configurable.
  • Jalopy
    Java Source Code Formatter, Beautifier, Pretty Printer.
    Jalopy is a source code formatter for the Sun Java programming language. It layouts any valid Java source code according to some widely configurable rules; to meet a certain coding style without putting a formatting burden on individual developers. With Jalopy you will be able to transform any foreign coding style to your own preferences, without any browbeating or bloodletting.
    Jalopy is "OSI Certified Open Source Software", released under a BSD License.
    Jalopy commercial version, by TRIEMAX Software.
  • Artistic Style
    A Free, fast and small Automatic Indentation Filter for C, C++, C#, and Java Source Codes, by Tal Davidson, Israel.
    SourceForge Project: astyle.
  • Jindent
    Jindent is a Java source-code formatter, beautifier and pretty printer. Commercial product.
  • Jacobe - Java Code Beautifier
    Jacobe is a configurable code beautifier for the Java programming language. It is possible to let Jacobe print your Java code according to the widely used layout rules of Sun Microsystems, or customize it to your own standards. Jacobe for Linux and Windows are free. Jacobe for Solaris has a commercial licence. By TIOBE Software.
  • JPretty - Java Source Code Beautifier
    JPretty is a Java source beautifier. It takes a syntactically correct Java program and reformats it according to specified options. Commercial product.
  • Google Web Directory: Programming Languages: Java Development Tools
    Ant, Applet Development, Code Beautifiers, Code Exploring and Managing, Code Refactoring, Debugging, Deployment, Design and Modelling, Integrated Development Environment (IDE), Micro, Obfuscators, Performance and Testing, Translators.
    Java Code Beautifiers.

Performance Analysis - Profiling

  • Java Performance Tuning
    Tuning tips, tool reports, articles, book listing and reviews, and other resources. By Fasterj.com.
  • NetBeans Profiler (open source)
    NetBeans Profiler is a NetBeans project to provide a Full-featured profiling functionality for the NetBeans IDE.
  • Eclipse Test & Performance Tools Platform (TPTP) (open source)
    TPTP is an open source top-level Project of the Eclipse Foundation, divided into four projects: TPTP Platform, Monitoring Tools, Testing Tools, Tracing and Profiling Tools.
  • JProbe (commercial)
    By Quest Software. JProbe is an enterprise-class Java profiler providing an integrated console for intelligent diagnostics on memory usage (memory leaks and object cycling), performance (bottlenecks and deadlocks) and test coverage (QA), allowing developers and administrators to quickly pinpoint and repair the root cause of application code performance and stability problems.
  • JProfiler (commercial)
    JProfiler is an award-winning all-in-one Java profiler. Its GUI helps to find performance bottlenecks, pin down memory leaks and resolve threading issues. By ej-technologies.
  • Borland SilkPerformer (commercial)
    Performance and load testing for Java and .NET software applications and web services. By Borland - Application Lifecycle Management (ALM).
  • YourKit Java Profiler (commercial)
    YourKit Java Profiler do both CPU and memory profiling, where one can profile even huge applications with high productivity and very low overhead.
  • Need for speed -- Eliminating performance bottlenecks
    Optimizing Java Programs Using IBM Rational Application Developer 6.0.1. Article by Satish Chandra Gupta Rational Software, IBM, 04 Oct 2005, updated 10 Nov 2005. IBM developerWorks - Rational Java technology.
    See also: Rational Application Developer for WebSphere, IBM Rational Software Development Platform, IBM Rational Software (commercial).
  • DevPartner Java Edition (commercial)
    By Micro Focus. Tune, test and analyze the design of Java applications.
  • HP OpenView Transaction Analyzer (commercial)
    Monitor, analyze and profile J2EE and .NET applications in live production and test environments.
  • JMP - Java Memory Profiler (open source)
    JMP is a profiler for java that can be used to trace objects usage and method timings. JMP uses the JVMPI interface to gather statistics and interact with the JVM. JMP uses a GTK+ interface to show the status. Runs on Linux and Windows (Cygwin).
  • Performance analysis
    Performance analysis in software engineering. From Wikipedia, the free encyclopedia.

Implementation Testing

  • Open source Java developer testing tools
  • In pursuit of code quality: JUnit 4 vs. TestNG
    Why TestNG is still the better framework for large-scale testing. By Andrew Glover, President, Stelligent Incorporated, 2006-08-29, IBM developerWorks Java Technology.
  • Java Test Frameworks: JUnit and TestNG (PDF)
    By Kedar Mhaswade, 2006.
  • See: JUnit
  • TestNG
    Next Generation Java Testing. TestNG is a testing framework inspired from JUnit and NUnit, but introducing some new functionalities that make it more powerful and easier to use. TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration etc.
  • JTiger
    JTiger Unit Testing Framework for Java SE 5+ is an open source solution that provides a robust and feature-rich abstraction to develop and execute unit test cases. Test case metadata and unit test documentation is expressed through annotations. Assertions, from the basic to the complex, can be made using the JTiger assertions package rather than having to write the logic for those assertions yourself.
  • Java Application Verification Kit (AVK) for the Enterprise
    The Java Application Verification Kit (AVK) for the Enterprise is a tool intended to help developers test their applications for correct use of J2EE APIs and portability across J2EE compatible application servers, and to help developers avoid inadvertently writing non-portable code.
    Java Application Verification Kit (AVK) for the Enterprise 1.4 FCS - Download.
  • HttpUnit
    Written in Java, HttpUnit emulates the relevant portions of browser behavior, including form submission, JavaScript, basic HTTP authentication, cookies and automatic page redirection, and allows Java test code to examine returned pages either as text, an XML DOM, or containers of forms, tables, and links. When combined with a framework such as JUnit, it is fairly easy to write tests that very quickly verify the functioning of a web site.
    SourceForge: HttpUnit.
  • jWebUnit
    jWebUnit is a Java framework that facilitates creation of acceptance tests for web applications. It evolved from a project where we were using HttpUnit and JUnit to create acceptance tests. As the tests were being written, they were continuously refactored to remove duplication and other bad smells in the test code. jWebUnit is the result of these refactorings.
    SourceForge: jWebUnit.
  • JMockIt
    JMockIt is a Java class library for developer testing with "mock methods". JMockit consists of a single class with a small set of static methods, which allow arbitrary methods and constructors of any other class to be replaced by mock implementations at runtime. JMockIt is open source software released under The MIT License.
  • Mock Objects
    Mock Objects, a technique for improving the design of code within Test-Driven Development.

JUnit

  • JUnit
    JUnit is a simple framework to write repeatable tests in/for Java. It is an instance of the xUnit architecture for unit testing frameworks.
  • JUnit.org
    This site is dedicated to software developers using JUnit or one of the other XUnit testing frameworks.
  • Java Extreme Programming: JUnit
    Google Preview: Chapter 4 from the book Java Extreme Programming Cookbook, by Eric M. Burke and Brian M. Coyner, O'Reilly Media, March 2003, ISBN 0-596-00387-0.
  • Apache Jakarta Cactus
    Cactus is a simple test framework for unit testing server-side Java code (Servlets, EJBs, Tag Libs, Filters, ...). The intent of Cactus is to lower the cost of writing tests for server-side code. It uses JUnit and extends it. Cactus implements an in-container strategy, meaning that tests are executed inside the container.
  • Ejb3Unit
    Ejb3Unit - out of container EJB 3.0 testing - Automate your ejb3 testing. The Ejb3Unit project automates Entity and Session bean testing outside the container for the EJB 3.0 specification. Ejb3Unit is a JUnit extention and can execute automated standalone JUnit tests for all EJB 3.0 conform JEE projects. Ejb3Unit is released under the LGPL License.
  • StrutsTestCase for JUnit
    StrutsTestCase for JUnit is an extension of the standard JUnit TestCase class that provides facilities for testing code based on the Struts framework.

Code Coverage of Tests

  • EMMA
    EMMA is an open-source toolkit for measuring and reporting Java code coverage.
  • Cobertura
    Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.
  • Coverlipse
    Coverlipse is an Eclipse plugin that visualizes the code coverage of JUnit Tests. It is unique for it integrates seamlessly in Eclipse.

Obfuscation & Optimization

  • ProGuard
    ProGuard is a free Java class file shrinker and obfuscator. It can detect and remove unused classes, fields, methods, and attributes. It can then rename the remaining classes, fields, and methods using short meaningless names. The resulting jars are smaller and harder to reverse-engineer. ProGuard is a fast command-line tool with an optional graphical user interface. ProGuard is free, under a GPL license.
    ProGuard alternatives.
  • Java Optimize and Decompile Environment (JODE)
    JODE is a java package containing a decompiler and an optimizer and obfuscator for java. This package is freely available under the GNU GPL.
  • jarg - Java Archive Grinder
    The jarg makes smaller a jar file in whitch java classes are stored. jarg is an open source software, distributed under BSD License.
  • RetroGuard
    Java Bytecode Obfuscation. By Retrologic Systems. Written in Java, supports JDK 1.1 through 1.5 and J2ME. RetroGuard is distributed under dual licensing: GNU GPL at no charge for non-commercial use, annual license and support fee for commercial use.
  • yGuard

Decompilation

  • Java Optimize and Decompile Environment (JODE)
    JODE is a java package containing a decompiler and an optimizer and obfuscator for java. This package is freely available under the GNU GPL.
  • DJ Java Decompiler
    DJ Java Decompiler is Windows decompiler and disassembler for Java that reconstructs the original source code from the compiled binary CLASS files. It is a stand-alone Windows application (doesn't require Java installed), using Jad as its decompiling engine, including a built-in Java source graphical editor with syntax-coloring. DJ Java Decompiler is written and supported by Atanas Neshkov and is a freeware software.
  • JAD - the fast JAva Decompiler
    Jad is a Java decompiler, i.e. program that reads one or more Java class files and converts them into Java source files which can be compiled again. Jad is a 100% pure C++ program and it generally works several times faster than decompilers written in Java. Jad doesn't use the Java runtime for its functioning, therefore no special setup is required. Jad can be used: for recovering lost source codes; for exploring the sources of Java runtime libraries; as a Java disassembler; as a Java source code cleaner and beautifier. Jad is free for non-commercial use.
  • JReversePro - Java Decompiler
    JReversePro is a Java Decompiler / Disassembler written entirely in Java. This reverse engineering utility is issued under the GNU GPL.
    SourceForge Project: JReversePro. JReversePro @ Blogspot.
  • Java Decompiler HOW-TO
    At TLDP - the Linux Documentation Project. (LinuxDoc link).
  • Java decompilers compared
    By Dave Dyer, JavaWorld July 1997.
  • Mocha, the Java Decompiler
  • Java Decompilers
    By Program-Transformation.Org.