Skip to content

About

JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

JVM Explorer

This project is forked from Naton1/jvm-explorer. Thanks to the original author for the great work.

JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines.

JVM Explorer Screenshot

Features

  • Browse local JVMs
  • View all classes inside each JVM
  • Search to find specific classes (supports regex)
  • View classloader hierarchy
  • View decompiled bytecode
  • View disassembled bytecode
  • Re-assemble bytecode
  • Re-compile class file
  • Modify method implementations (insert, replace method body with java code)
  • Execute code in local JVMs
  • Export loaded classes to a JAR file
  • Browse the state of all static variables in a class (and their nested fields)
  • Modify the state of static variables (and their nested fields)
  • Replace class file definitions
  • View system properties of running JVMs
  • Run JAR files with a patched ProcessBuilder to remove any -XX:+DisableAttachMechanism argument

Demos

Browse Classes And Fields

Notes:

  • Ctrl + Click on a class name in the class file viewer to open it
  • Search and press enter to open a class with the specified name
  • Edit a field value (under Fields tab) through Right Click -> Edit - only works for primitives and Strings

Browse Classes Example

Execute Code In Remote JVM

Notes:

  • You can call methods in the remote classes - the loaded classes are used for the compiler classpath

Execute Code Example

Show Class Loader Hierarchy

Class Loader Hierarchy Example

Launch Jar With Patched ProcessBuilder

Launch Patched Jar Example

Export Classes In Package

Export Classes Example

Modify Method

Notes:

  • You can insert code to the beginning of a method or replace the entire method body
  • The compiler currently uses the loaded classes as the classpath, so if a parameter type or return type isn't loaded, it may fail (you can replace the type with Object to make it compile if you don't need that type)
  • To access fields in the class, add a field with the same name and type in the class to compile - the reference will automatically be replaced

Modify Method Example

Modify Class

Notes:

  • Ctrl+S to re-recompile and patch class (or Right-Click -> Save Changes)
  • Often, decompiled code is not valid Java code, so it may not compile in some cases - the modify method feature is the workaround for this
  • The compiler currently uses the loaded classes as the classpath, so if some required type isn't loaded, it may fail

Modify Class Example

Modify Bytecode

Notes:

  • Ctrl+S to re-assemble and patch class (or Right-Click -> Save Changes)
  • The disassembler/assembler isn't perfect - it works most of the time but struggles with some cases (it uses OpenJDK AsmTools)

Modify Bytecode Example

Getting Started

There are two ways to run the application. Download a provided platform-specific package, or build and run it yourself. This application requires Java 25+ and can attach to JVMs running Java 7+.

Download Package:

  1. Download a platform-specific package from the latest release
  2. Extract the archive and run the startup script for your platform

Build And Run:

  1. Clone with Git
git clone https://github.com/unknowIfGuestInDream/jvm-explorer.git
  1. Change into the project directory
cd jvm-explorer
  1. Build with Maven (Java 25+, Maven 3.9+)
mvn clean install -DskipTests
  1. Run the application
mvn -pl explorer javafx:run

Troubleshooting

Two logs files application.log and agent.log are created at [User Home]/jvm-explorer/logs

  • Must run the application with a Java version of at least Java 25
  • Must attach to a JVM running a Java version of at least Java 7
  • Must attach to a JVM running the same architecture - a 32-bit JVM must attach to a 32-bit JVM
  • May have to attach to a JVM that the same user started
  • Must attach to a JVM that supports the Java Attach API
  • If you run an old version of this application and attach it to a JVM, then update to a newer version and try to re-attach, the agent will be outdated. If there are changes in the client-server protocol, the agent will fail. Restart the target JVM to fix this.

Note: this uses the Java Attach API so any limitations will apply here.

Project Principles

  • Maintain a simple and easy-to-use interface
  • Take advantage of attaching to running JVMs - this is not a traditional GUI decompiler

Project Structure

Module Description
protocol Shared protocol classes for communication
agent JVM agent injected into target processes
launch-agent Launch patch agent for JDK compatibility
explorer JavaFX desktop application (main module)

License

This project is licensed under the MIT License.

About

JVM Explorer is a Java desktop application for browsing loaded class files inside locally running Java Virtual Machines.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages