Skip to content

Modern Java decompiler leveraging Groq/Gemini/OpenRouter APIs with ASM-based analysis, streaming output, and professional dark UI. Supports batch processing.

License

Notifications You must be signed in to change notification settings

Muhib-Mehdi/AI-Java-Decompiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Advanced Java Decompiler

Java Gradle JavaFX License

Next-generation Java bytecode decompilation with intelligent code reconstruction

Features β€’ Installation β€’ Usage β€’ Architecture β€’ Contributing


πŸ“‹ Table of Contents


🌟 Overview

Advanced Java Decompiler is a professional-grade tool designed to reconstruct readable Java source code from compiled .class files. Built with a modern JavaFX interface and powered by multiple decompilation backends, it offers unparalleled accuracy and flexibility.

Why Choose This Decompiler?

Feature Traditional Decompilers Advanced Java Decompiler
Multiple Backends ❌ Single engine βœ… Groq, Gemini, OpenRouter, Heuristic
Streaming Output ❌ Wait for completion βœ… Real-time streaming
Batch Processing ⚠️ Limited βœ… JARs, ZIPs, Folders
Dependency Graph ❌ Not available βœ… Interactive visualization
Auto-Refactoring ❌ Raw output βœ… Modern Java patterns
Plugin System ❌ Fixed βœ… Groovy-based extensibility
Token Management ❌ Manual limits βœ… Auto-truncation & routing

πŸš€ Features

πŸ”§ Core Decompilation

  • Multi-Backend Support

    • Groq: Fast, free-tier Llama 3.3 70B with streaming
    • Gemini: Google's advanced models (2.0 Flash, 2.5 Pro)
    • OpenRouter: Unified API access
    • Heuristic: Instant offline ASM-based decompilation
  • Smart Auto Mode

    • Automatically selects optimal backend based on:
      • Code complexity analysis
      • Token limit estimation
      • Available API quotas
  • Token Limit Management

    • Automatic bytecode truncation for large classes
    • Pre-flight token estimation
    • Intelligent routing to avoid rate limits

🎨 User Interface

  • Professional Dark Theme

    • VSCode/IntelliJ-inspired design
    • High-contrast syntax highlighting
    • Smooth animations and transitions
  • Dual View Modes

    • Single View: Decompiled code only
    • Diff View: Side-by-side bytecode ↔ source comparison
  • Drag & Drop Support

    • .class files
    • .jar archives
    • .zip archives
    • Entire folders

πŸ“Š Advanced Analysis

  • Interactive Dependency Graph

    • Visual class relationship mapping
    • Color-coded node types:
      • πŸ”΅ Main class (cyan)
      • 🟠 Custom dependencies (orange)
      • βšͺ Java standard library (gray)
    • Hover highlighting
    • Circular layout algorithm
  • Batch Processing

    • Decompile entire JARs in one click
    • Process folders recursively
    • Aggregate results with class separators

πŸ›‘οΈ Security & Privacy

  • Secure Mode

    • Automatic secret redaction
    • Pattern-based detection:
      • API keys
      • Passwords
      • Tokens
      • Connection strings
  • Local Processing

    • Heuristic mode runs 100% offline
    • No data sent to external servers

πŸ”Œ Extensibility

  • Plugin System

    • Groovy-based post-processing scripts
    • Located in plugins/ folder
    • Example: deobfuscate.groovy for name recovery
  • Auto-Refactoring Suggestions

    • Modern Java patterns (Streams, Records, Switch Expressions)
    • Inline comments with recommendations
    • Toggle on/off per session

πŸ“¦ Export Options

  • Project Structure Export
    • Maven-compatible layout
    • Gradle-compatible layout
    • Preserves package hierarchy
    • Generates build files

πŸ’» Installation

Prerequisites

Requirement Version Download
Java 17+ Oracle JDK
Gradle 7+ Included (Wrapper)
API Keys Optional See API Configuration

Quick Start

# Clone the repository
git clone https://github.com/Muhib-Mehdi/Advanced-Java-Decompiler.git
cd Advanced-Java-Decompiler

# Build the project
./gradlew build

# Run the application
./gradlew run

Windows Users

# Use gradlew.bat instead
.\gradlew.bat build
.\gradlew.bat run

🎯 Usage

Basic Workflow

graph LR
    A[Upload .class] --> B{Select Mode}
    B -->|Auto| C[Smart Routing]
    B -->|Groq| D[Fast Streaming]
    B -->|Gemini| E[High Quality]
    B -->|Heuristic| F[Instant Offline]
    C --> G[Decompiled Code]
    D --> G
    E --> G
    F --> G
    G --> H{Export?}
    H -->|Yes| I[Maven/Gradle Project]
    H -->|No| J[Done]
Loading

Decompilation Modes

Mode Speed Quality Requires API Best For
Auto (Smart) ⚑⚑⚑ ⭐⭐⭐⭐ Optional General use
Heuristic ⚑⚑⚑⚑⚑ ⭐⭐⭐ No Quick inspection
Groq ⚑⚑⚑⚑ ⭐⭐⭐⭐ Yes Real-time streaming
Gemini ⚑⚑⚑ ⭐⭐⭐⭐⭐ Yes Complex classes
OpenRouter ⚑⚑⚑ ⭐⭐⭐⭐ Yes Unified access

Step-by-Step Guide

  1. Launch Application

    ./gradlew run
  2. Select Decompilation Mode

    • Choose from dropdown menu
    • Auto mode recommended for beginners
  3. Upload File

    • Drag & drop .class, .jar, .zip, or folder
    • Or click "Upload" button
  4. Configure Options

    • β˜‘οΈ Secure Mode: Redact secrets
    • β˜‘οΈ Show Refactoring Tips: Get modernization suggestions
  5. View Results

    • Toggle Diff View for bytecode comparison
    • Click Dependency Graph for class relationships
    • Use Export for project structure

πŸ—οΈ Architecture

System Pipeline

graph TD
    A[JavaFX UI] --> B[Decompiler Pipeline]
    B --> C{Mode Selection}
    C -->|Auto| D[Model Orchestrator]
    C -->|Manual| E[Direct Backend]
    D --> F{Token Check}
    F -->|Within Limit| G[Groq/Gemini]
    F -->|Too Large| H[Gemini Fallback]
    E --> I[Selected Backend]
    G --> J[Plugin System]
    H --> J
    I --> J
    J --> K[Refactoring Advisor]
    K --> L[Output]
Loading

Component Breakdown

Component Responsibility Technology
UI Layer User interaction, visualization JavaFX 21
Pipeline Orchestration, caching Java 17
Backends Code reconstruction Groq, Gemini, OpenRouter
Analyzer Bytecode parsing ASM 9.7
Plugins Post-processing Groovy 4.0
Security Secret redaction Regex patterns

πŸ”‘ API Configuration

Supported Providers

Groq (Recommended - Free Tier)

Features:

  • βœ… Free tier available
  • βœ… Real-time streaming
  • βœ… Fast response times
  • ⚠️ 12,000 token limit (auto-handled)

Setup:

  1. Get API key: console.groq.com/keys
  2. Add to .env:
    GROQ_API_KEY=gsk_...
Google Gemini (High Quality)

Features:

  • βœ… Free tier available
  • βœ… Multiple model options (2.0 Flash, 2.5 Pro)
  • βœ… High accuracy
  • ⚠️ Rate limits apply

Setup:

  1. Get API key: aistudio.google.com/app/apikey
  2. Add to .env:
    GEMINI_API_KEY_1=...
OpenRouter (Unified Access)

Features:

  • βœ… Access to multiple models
  • βœ… Unified billing
  • ⚠️ Paid service

Setup:

  1. Get API key: openrouter.ai/keys
  2. Add to .env:
    OPENROUTER_API_KEY=sk-or-...

Environment File Example

Create .env in project root:

# Choose ONE or more providers

# Groq (Fast & Free)
GROQ_API_KEY=gsk_your_key_here

# Gemini (High Quality)
GEMINI_API_KEY_1=your_key_here

# OpenRouter (Unified)
OPENROUTER_API_KEY=sk-or-your_key_here

Note: The application works offline with Heuristic mode even without API keys.


πŸŽ“ Advanced Features

Plugin Development

Create custom post-processing plugins in plugins/ folder:

// plugins/custom-formatter.groovy
def transform(String code) {
    // Your transformation logic
    return code.replaceAll("oldPattern", "newPattern")
}

return this

Feedback System

The application includes a RAG-enhanced feedback system:

  1. Rate decompilation accuracy (1-5 stars)
  2. Provide corrections
  3. System learns from feedback
  4. Stored in ~/.aidecompiler/feedback.json

Keyboard Shortcuts

Shortcut Action
Ctrl+O Open file
Ctrl+S Save output
Ctrl+D Toggle diff view
Ctrl+G Show dependency graph
Ctrl+E Export project

πŸ“Έ Screenshots

Note: Screenshots showcase the professional dark theme and key features.

Main Interface

Main Interface

Dependency Graph

Dependency Graph

Diff View

Diff View


🀝 Contributing

Contributions are welcome! Please follow these guidelines:

Development Setup

# Fork and clone
git clone https://github.com/YOUR_USERNAME/Advanced-Java-Decompiler.git

# Create feature branch
git checkout -b feature/amazing-feature

# Make changes and test
./gradlew test

# Commit with conventional commits
git commit -m "feat: add amazing feature"

# Push and create PR
git push origin feature/amazing-feature

Code Style

  • Follow Java naming conventions
  • Use 4-space indentation
  • Add JavaDoc for public methods
  • Keep methods under 50 lines

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • ASM Framework - Bytecode manipulation
  • JavaFX - Modern UI framework
  • Groq - Fast LLM inference
  • Google Gemini - Advanced language models

πŸ“ž Contact

Muhib Mehdi

GitHub LinkedIn


⭐ Star this repo if you find it useful!

Made with ❀️ by Muhib Mehdi

About

Modern Java decompiler leveraging Groq/Gemini/OpenRouter APIs with ASM-based analysis, streaming output, and professional dark UI. Supports batch processing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published