palantir / palantir/palantir-java-format

Running palantir-java-format from the command line

Open
#1,513 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
907
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
19

Description

Ran this code and got the message below. I am not sure what I am missing. Thanks.

java \
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
--class-path \
palantir-java-format-spi-2.83.0.jar:\
palantir-java-format-2.83.0.jar:\
guava-33.5.0-jre.jar:\
jackson-core-2.20.1.jar:\
jackson-databind-2.20.1.jar:\
jackson-datatype-guava-2.20.1.jar:\
jackson-annotations-3.0-rc5.jar:\
#tmp \
com.palantir.javaformat.java.Main \
Main.java

Main.java: error: fj/F
java.lang.NoClassDefFoundError: fj/F
at com.palantir.javaformat.doc.HasUniqueId.ord(HasUniqueId.java:37)
at com.palantir.javaformat.doc.State.startingState(State.java:87)
at com.palantir.javaformat.OpsBuilder.build(OpsBuilder.java:658)
at com.palantir.javaformat.java.Formatter.format(Formatter.java:146)
at com.palantir.javaformat.java.Formatter.getFormatReplacements(Formatter.java:322)
at com.palantir.javaformat.java.Formatter.formatSource(Formatter.java:299)
at com.palantir.javaformat.java.FormatFileCallable.formatFile(FormatFileCallable.java:84)
at com.palantir.javaformat.java.FormatFileCallable.call(FormatFileCallable.java:72)
at com.palantir.javaformat.java.FormatFileCallable.call(FormatFileCallable.java:31)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1090)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.base/java.lang.Thread.run(Thread.java:1474)
Caused by: java.lang.ClassNotFoundException: fj.F
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command-line invocation against Main.java and inspect the --class-path entries alongside the reported fj/F NoClassDefFoundError. Check how the CLI distribution declares or packages its runtime dependencies; done means the documented invocation runs successfully or clearly identifies the required dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.