Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

prettier-java

> 编程语言
Open source

Prettier Java Plugin

1.2K stars0 likes2 views
WebsiteGitHub

About

Prettier Java Plugin

Prettier Java Plugin

Intro

Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

This plugin adds support for the Java language to Prettier.

Input

java
public class HelloWorld {
public static void main(String[] args) {System.out.println("Hello World!");;;;;}

@Override
public String toString() {
  return "Hello World";
}
  public int sum(int argument1,int argument2,int argument3,int argument4,int argument5
  ) {
    return argument1+argument2+ argument3 +argument4  + argument5;
  }
}

Output

java
public class HelloWorld {

  public static void main(String[] args) {
    System.out.println("Hello World!");
  }

  @Override
  public String toString() {
    return "Hello World";
  }

  public int sum(
    int argument1,
    int argument2,
    int argument3,
    int argument4,
    int argument5
  ) {
    return argument1 + argument2 + argument3 + argument4 + argument5;
  }
}

Playground

You can give the plugin a try in our playground!

Getting Started

Installation

npm:

bash
npm install --save-dev --save-exact prettier prettier-plugin-java

Yarn:

bash
yarn add --dev --exact prettier prettier-plugin-java

Usage

npm:

bash
npx prettier --plugin=prettier-plugin-java --write "**/*.java"

Yarn:

bash
yarn exec prettier --plugin=prettier-plugin-java --write "**/*.java"

Integration

  • Editors
  • Spotless lets you run Prettier from Gradle or Maven

Contributing

See CONTRIBUTING.md.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javajavaprettier

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言