Eight tools common to Java programmers

Source: Internet
Author: User
Tags comment tag configuration settings visualvm netbeans java se

The following 8 tools, from code building to error squeezing, cover the entire domain of Java development. Learning these tools can help you improve the quality of your code and become a more efficient Java developer.

1.Eclipse

Although IntelliJ idea, NetBeans, and some other Ides are gaining popularity, a survey shows that eclipse is still the preferred development environment for almost half of Java developers. Eclipse is the Swiss Army knife in the IDE, with a large number of custom interfaces and countless plugins. It is ubiquitous, and the Eclipse plugin is available in all other tools that this article will recommend.

Eclipse's workflow can be divided into three areas: Workbench, Workspace, and perspective. Workbench as a starting point to the IDE. Workspaces combine project, file, and configuration settings in a separate directory. Perspective defines tools, views, and valid settings. While novice developers may find it harder to use than NetBeans and IntelliJ Idea,eclipse, Eclipse's flexibility makes it the preferred IDE for enterprise development.

The latest version of Luna,eclipse, with support for Java 8, split screen editing, New Black themes, and a full-featured command-line terminal.

Official website: https://eclipse.org/

2.Gradle

Gradle is an automated project tool built on the capabilities of Apache Maven and Apache Ant. Although Gradle is not the most popular build tool (the most popular is the Java developer of maven,64% will choose it), it is fast to popularize. It can also be used as the default Android build tool.

Gradle was proud of its simplicity. Gradle uses the Groovy programming language, which is diametrically opposed to the use of XML syntax by maven and Ant. A basic Gradle build file consists of a simple line of code:

' Java '.

The following command generates a Gradle build file, creates a directory tree of project files, and comes with a project portable Gradle package:

Init--type java-library

Gradle also has plugins that can be used to add new languages, build project files that support the IDE, build local binaries, check for dependency updates, and more.

For more information, see the JAVA/JVM Getting Started guide for Gradle.

Official website: https://gradle.org/

3.Javadoc

The Javadoc is a document generator provided by Oracle. It can parse special-format annotations into HTML documents. The following is the Java SE 8 API specification generated by Javadoc:

Javadoc annotations Use open tags, close labels, and the format of one or more descriptive labels. An open label is similar to a standard Java multiline comment tag, with the exception of two asterisks. Javadoc also parses ordinary HTML tags.

Javadoc automatically formats labels and keywords, unless otherwise specified. Javadoc uses hyperlinks extensively, allowing you to refer to and link to different areas of your code. Many ide--include eclipse--can automatically add Javadoc annotation modules to variables, classes, and methods. Plugins that support Maven, Gradle, and Ant can build Javadoc HTML while compiling code.

For more information, see Oracle's article on how to write documentation notes for the Javadoc tool.

Official website: http://www.oracle.com/technetwork/java/javase/documentation/index-jsp-135444.html

4.JUnit

JUnit is an open-source framework for writing and running unit tests. A basic JUnit test includes test classes, test methods, and the ability to perform tests. JUnit uses annotations to determine how tests are constructed and run. For example, if your program has a class called MathClass, which has methods for multiplication and division, you can create JUnit tests to check for values that do not meet expectations. Enter the numbers 2 and 5 into the multiplication method, and you want the result to be 10. When you enter 0 as the second parameter of the division method, you expect to give a warning that the number calculates the exception because the divisor cannot be 0:

@Test labeling rules, the MathClass method is a test case. Provide additional annotations in JUnit, such as @before, so you can set the environment before the test runs. JUnit can also set rules to define the behavior of test methods. For example, the Temporaryfolder rule allows a file or folder created by the test to be deleted once the test is complete.

For more information, please refer to the introduction to JUnit. There is also a tutorial that uses JUnit unit testing.

Official website: http://junit.org/

5.Cobertura

Cobertura can be used to analyze test coverage of Java code. Cobertura generates HTML-based reports based on code that is not covered by the test.

Cobertura provides tools that you can use to plug in, inspect, and test code. By monitoring testable code, Cobertura allows you to run your program using the test framework you choose, without even needing to test the framework.

Cobertura provides code coverage reports based on lines, branches, and packages. Each category has a customizable threshold that triggers a warning if the coverage falls below the threshold. The Cobertura also integrates the automatic detection capabilities of MAVEN and Gradle.

Mkyong.com provides an example of integrating Cobertura with Maven.

Official website: http://cobertura.github.io/cobertura/

6.FindBugs

FindBugs is a tool that matches the compiled code pattern rather than using the bug database. FindBugs can also highlight lines of code that detect bugs when the source code is provided.

In its version 3.0.1, FindBugs continues to maintain hundreds of bug descriptions. Depending on the severity of the bug, FindBugs divides the bug into four levels: related, disturbing, scary, and most frightening. In addition to the graphical user interface, FindBugs also provides a command line interface, ant tasks, and Eclipse plugins.

Official website: http://findbugs.sourceforge.net/

7.VisualVM

The VISUALVM included in the JDK is a tool for monitoring and reviewing the performance of Java applications. VISUALVM detects and attaches importance to the active JVM instance to retrieve diagnostic information about the process.

VISUALVM can easily diagnose performance problems in real time. It provides a full suite of analytical tools, including Jconsole, Jstack, Jmap, Jinfo, and Jstat. In addition, you can take a snapshot of the JVM so that it can be reviewed at any time later.

Official website: http://visualvm.java.net/

8.Groovy

Groovy is a programming language that simplifies and extends Java by adding new keywords, automatically importing commonly used classes, and optional type variable declarations.

One of the core strengths of groovy is its scripting capabilities. Classes can be compiled into Java bytecode or executed dynamically using groovy shell. Groovy's Java base makes it easier for Java developers to accept than Jython and JRuby.

For more information, see the Getting Started Guide to groovy.

Official website: http://www.groovy-lang.org/

Other options

New tools, utilities, and libraries are emerging in the big world of Java. If your preferred tool does not have access to the above list, please share it.

Eight tools common to Java programmers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.