Home  >  Article  >  Java  >  An introduction to eight development tools commonly used by Java programmers

An introduction to eight development tools commonly used by Java programmers

黄舟
黄舟Original
2017-05-14 09:22:561417browse

This article mainly introduces the eight development tools commonly used by novice and experienced Java programmers. Friends who need them can refer to them

Now there are many libraries, utility tools and programs for Java developers to choose from. Each tool has its merits, but some stand out from the crowd of options because of their popularity, versatility, and effectiveness.

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

1.Eclipse

Although IntelliJ IDEA, NetBeans and some other IDEs are becoming increasingly popular, surveys show that Eclipse is still almost The preferred development environment for half of Java developers. Eclipse is the Swiss Army Knife of IDEs, with a large number of customized interfaces and countless plug-ins. It's everywhere, and every other tool I'll recommend later in this article provides Eclipse plug-ins.

The workflow of Eclipse can be divided into three aspects: workbench, workspace and perspective. The workbench serves as the starting point to the IDE. Workspaces group projects, files, and configuration settings into a single directory. Perspective definition tools, Views and valid settings. Although novice developers may find Eclipse more difficult to use than Netbeans and IntelliJ IDEA, Eclipse's flexibility makes it the preferred IDE for enterprise development.

Luna, the latest version of Eclipse, supports Java 8, split-screen editing, a new dark theme, and a full-featured command line terminal.

2.Gradle

Gradle is an automation project tool built on the functionality of Apache Maven and Apache Ant . While Gradle is not the most popular build tool (the most popular is Maven, chosen by 64% of Java developers), its popularity is growing rapidly. It also serves as the default Android build tool.

Gradle prides itself on its simplicity. Gradle uses the Groovy programming language, as opposed to Maven and Ant, which use XML syntax. A basic Gradle build file consists of a simple line of code:

apply plugin: 'java'.

The following command will generate a Gradle build file, create a directory tree for the project file, and Comes with a project portable Gradle package:

$ gradle init --type java-library

Gradle can also be used to add new languages, generate project files that support IDEs, and build local binary documents. Check dependencies Update etc. for plugins.

For more information, see Gradle’s Java/JVM Getting Started Guide.

3.Javadoc

Javadoc is the documentation generator provided by Oracle. It can parse specially formatted comments into HTML documents. The following screenshot is the Java SE 8 API specification generated by Javadoc:

Javadoc comments use the format of opening tags, closing tags, and one or more descriptive tags. Open tags are similar to standard Java multiline comment tags, except that two asterisks are used. Javadoc also parses the ordinary HTML tag .

Javadoc automatically formats tags and keywords unless otherwise specified. Javadoc makes extensive use of hyperlinks, allowing you to reference and link to different areas of the code. Many IDEs—including Eclipse—can automatically add Javadoc comment modules to variables, classes, and methods. Plug-ins that support Maven, Gradle, and Ant can also build Javadoc HTML while compiling code.

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

4.JUnit

JUnit is an open source framework for writing and running unit tests . A basic JUnit test includes a test class, a test method, and the function to execute the test. JUnit uses annotations to determine how tests are constructed and run. For example, if your program has a class called MathClass that 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 entering 0 as the second argument to a division method, you would expect a warning about a numeric calculation exception because the divisor cannot be 0: The

@Test annotation specifies that the MathClass method is a test case. Provide additional annotations in JUnit, such as @Before, so that you can set the environment before the test is run. JUnit can also set rules to define the behavior of test methods. For example, the TemporaryFolder rule causes files or folders created by the test to be deleted once the test is completed.

For more information, please refer to Getting Started with JUnit. There are also tutorials on unit testing using JUnit.

5.Cobertura

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

Cobertura provides tools that can be used to instrument, inspect and test code. By monitoring testable code, Cobertura allows you to use the testing framework of your choice or even run the program without a testing framework.

Cobertura gives code coverage reports based on three aspects: line, branch and package. Each category has a customizable threshold, and if coverage falls below the threshold, a warning is triggered. Cobertura also integrates the automatic detection functions of Maven and Gradle.

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

6.FindBugs

FindBugs is a tool that matches compiled code patterns instead of using a bug database. When source code is provided, FindBugs can also highlight the lines of code where bugs were detected.

In its 3.0.1 version, FindBugs continues to maintain hundreds of bug descriptions. FindBugs classifies bugs into four levels based on their severity: relevant, bothersome, scary, and most scary. In addition to the graphical user interface, FindBugs also provides a command line interface, Ant tasks, and Eclipse plug-ins.

7.VisualVM

VisualVM included in the JDK is a tool for monitoring and auditing the performance of Java applications. VisualVM detects and monitors active JVM instances to retrieve diagnostic information about the process.

VisualVM makes it easy to diagnose performance issues in real time. It provides a full set of analysis tools, including JConsole, jstack, jmap, jinfo and jstat, etc. Additionally, you can take a snapshot of the JVM so you can review it at any time.

8.Groovy

Groovy is a programming language that automatically imports commonly used Classes, as well as optional type variable declarations, both simplify and extend Java.

One of Groovy's core strengths is its scripting capabilities. Classes can be compiled to Java bytecode or executed dynamically using the Groovy Shell. Groovy's Java foundation makes it more accessible to Java developers than Jython and JRuby.

For more information, see Groovy's Getting Started Guide.

Other options

New tools, utilities, and libraries are constantly emerging in the big world of Java. If your go-to tool didn’t make the list above, please share it.

The above is the detailed content of An introduction to eight development tools commonly used by Java programmers. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn