An interactive educational tool that visualizes Java 8 code execution at the bytecode level, helping users understand JVM internals including memory areas, stack frames, and data structures.
- Interactive Code Editor - Write and edit Java 8 code directly in the browser
- Step-by-Step Execution - Execute bytecode instructions one at a time with full visualization
- Real-time Visualization - See JVM memory areas update as code executes
- Variable History - Track how variable values change throughout program execution
- Visualize stack frames being pushed and popped
- See local variables and operand stacks in action
- Track method calls and returns
- View program counters for each thread
- Object allocation and storage
- Array creation and manipulation
- Reference tracking between objects and stack frames
- Three view modes: All Objects, Instance Only, Array Only
- Class structure visualization
- Field and method information
- Static members display
- Bytecode instruction listing
- Main thread visualization
- Thread state tracking
- Program counter per thread
Automatic detection and enhanced visualization for:
- Linked Lists - Node-based structure with next pointers
- Stacks - LIFO structure with push/pop operations
- Queues - FIFO structure with front/rear pointers
- Trees - Hierarchical structure with left/right children
- Graphs - Nodes with multiple connections
- Syntax Highlighting - Java keywords, types, operators, and strings
- Line Numbers - Easy reference during debugging
- Auto-indentation - Clean, formatted code automatically
- Snippet Shortcuts - Quick insert common Java patterns:
- Hello World
- Variables & Types
- Arrays
- Loops (for, while)
- Conditionals (if-else, switch)
- Methods
- Classes & Objects
- Recursion (Fibonacci, Factorial)
- Data Structures (LinkedList, Stack, Queue, Tree, Graph)
- Algorithms (Bubble Sort, Binary Search, Trapping Rain Water)
- Compile - Convert Java source to bytecode
- Run - Execute entire program at once
- Step - Execute one bytecode instruction at a time
- Reset - Clear execution state and start fresh
- Speed Control - Adjust step execution delay (100ms - 2000ms)
Built-in text area for taking notes while learning and experimenting
- Node.js 18+ and npm
- Modern web browser (Chrome, Firefox, Edge, Safari)
# Clone or navigate to the project directory
cd java9visualizer
# Install dependencies
npm install
# Start development server
npm run devThe application will open at http://localhost:5173
# Create production build
npm run build
# Preview production build
npm run previewUse the code editor to write Java 8 code or select from pre-loaded snippets using the shortcuts panel.
Example:
public class Test {
public static void main(String[] args) {
int x = 5;
int y = 10;
int sum = x + y;
System.out.println("Sum: " + sum);
}
}Click the Compile button to convert your Java source code into JVM bytecode instructions.
- Run: Execute the entire program at once
- Step: Execute one bytecode instruction at a time to see exactly how the JVM works
Watch as the visualizations update in real-time:
- Stack Frames: See local variables being stored and operand stack being used
- Heap: Watch objects and arrays being created
- Method Area: View class structure and bytecode
- Threads: Track execution flow
The Variable History panel shows how each variable's value changes throughout execution with color coding:
- π΅ Blue circles: Primitive values
- π’ Green circles: String values
- π‘ Yellow circles: Object references
java9visualizer/
βββ src/
β βββ components/ # React UI components
β β βββ CodeEditor/ # Editor components
β β βββ Layout/ # Main layout components
β β βββ Visualizations/ # JVM visualization components
β βββ jvm/ # Core JVM simulation engine
β β βββ parser/ # Lexer and Parser (Java β AST)
β β βββ compiler/ # Bytecode compiler (AST β Bytecode)
β β βββ runtime/ # JVM simulator (Bytecode execution)
β β βββ types/ # Type definitions
β βββ state/ # State management (Zustand)
β βββ utils/ # Utility functions
β βββ main.tsx # Application entry point
βββ public/ # Static assets
βββ package.json
- Frontend Framework: React 19 with TypeScript
- Build Tool: Vite (fast HMR and bundling)
- Styling: Tailwind CSS
- State Management: Zustand
- Icons: Lucide React
- UI Components: Radix UI primitives
- Code Editor: Custom implementation with syntax highlighting
- Understand how Java code executes at the bytecode level
- Visualize object-oriented concepts like inheritance and polymorphism
- Debug code by stepping through execution
- Learn about JVM memory management
- Demonstrate JVM internals in computer science courses
- Explain stack vs heap allocation
- Show how data structures work internally
- Illustrate algorithm execution step-by-step
- Practice coding problems with visual feedback
- Understand time/space complexity through execution
- Master data structure manipulation algorithms
The visualizer includes built-in examples:
- Basic syntax and variables
- Control flow (loops, conditionals)
- Arrays and collections
- Object-oriented programming
- Recursion
- Classic algorithms (sorting, searching)
- Data structure implementations
- LeetCode-style problems (Trapping Rain Water)
Access via the Settings button (βοΈ):
- Font Size: Adjust code editor text size (12px - 20px)
- Theme: Light/Dark mode (planned)
- Auto-close Braces: Enable/disable automatic bracket closing
- Tab Size: Configure indentation width
This is an educational simulator, not a full Java VM. Current limitations:
- Single-threaded execution only (main thread)
- Limited exception handling
- No support for generics, annotations, or inner classes
- Simplified garbage collection (no automatic cleanup)
- Method overloading resolution by parameter count only
- Some Java 8 features not yet implemented (lambdas partially supported)
Contributions are welcome! Areas for improvement:
- Additional Java 8 language features
- More sample programs and algorithms
- Enhanced data structure detection
- Better error messages and debugging tools
- Performance optimizations
MIT License - feel free to use this project for learning and teaching.
This project is inspired by:
- OpenJDK JVM specification
- Java Virtual Machine architecture
- Various Java visualization tools
For issues, questions, or suggestions:
- Open an issue on GitHub
- Check existing documentation
- Review sample programs for examples
Built with β€οΈ for Java education and visualization
Last updated: March 2026