Skip to content

Instantly share code, notes, and snippets.

@paulmallon
Created November 2, 2019 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulmallon/bea43c82f519eec2c6666521aed15f85 to your computer and use it in GitHub Desktop.
Save paulmallon/bea43c82f519eec2c6666521aed15f85 to your computer and use it in GitHub Desktop.
Jetbrains Java Console Decompiler
$basePath = "C:\src\runtimeService-unpacked"
$targetPath = "c:\src\decompile"
$decompilerPath = "C:/Program Files/JetBrains/IntelliJ IDEA 2019.2.3/plugins/java-decompiler/lib/java-decompiler.jar"
$decompilerClass = "org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler"
Get-ChildItem $basePath *.class -Recurse | ForEach-Object {
java -cp $decompilerPath $decompilerClass `
-hdc=0 -dgs=1 -rsy=1 -rbr=1 -lit=1 -nls=1 -mpm=60 `
$_.FullName (split-path $_.FullName -Parent)
}
# copy decompiled code to destination
Copy-Item $basePath -filter *.java -Recurse -Destination $targetPath
# remove decompiled code in base dir
#Get-ChildItem $basePath *.java | Remove-item -Force
@paulmallon
Copy link
Author

hdc = hide empty default constructor
dsg = decompile generic signatures
rsy = hide syntetic class members
rbr = hide brigde methods
lit = output numberic literal "as-is"
nls = define new line character to be used for outpu
mpm = max allowed processing time per deompile method

https://github.com/fesh0r/fernflower

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment