Skip to content

About

In-browser Java notebook for CS143 — write, compile and run Java with syntax highlighting and PDF export, built with Next.js and the Eclipse Java Compiler.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

v0-universal-cs143-notebook

This is a Next.js project bootstrapped with v0.

Tech Stack & Features

Core Stack

  • Framework: Next.js
  • Language: TypeScript
  • Styling: Tailwind CSS with Radix UI primitives (shadcn/ui style components)
  • Icons: Lucide React

Java Execution in the Browser

This project achieves client-side Java execution without requiring a backend server by combining two core technologies:

  1. CheerpJ (WebAssembly JVM): A WebAssembly-based Java Virtual Machine that runs completely client-side in the browser. It intercepts System.out/System.err to capture output directly to the UI.
  2. ECJ (Eclipse Compiler for Java): Because CheerpJ ships as a JRE (Java Runtime Environment) and lacks javac, the app uses the Eclipse Compiler for Java (ecj.jar).
    • Execution Flow: The user's Java code is intercepted and saved to a virtual file system (/str/). The app invokes the ECJ compiler via cheerpjRunMain to compile the .java file into a .class file. CheerpJ then executes the compiled bytecode locally in the browser.
    • Safeguards: To prevent infinite loops or memory crashes, the compiler has a 30-second timeout, the execution has a 10-second timeout, and output length is capped at 1MB.

Key Features & Libraries

  • Code Editor: @monaco-editor/react powers the in-browser IDE with syntax highlighting and code completion for Java.
  • PDF Processing: pdfjs-dist is used to parse uploaded computer science lab handouts (PDFs) and dynamically turn them into an interactive Jupyter-style notebook.
  • Markdown & Math Rendering: react-markdown is used alongside remark-math and rehype-katex to perfectly render complex LaTeX formulas (like Euclidean distance formulas found in the labs).
  • Syntax Highlighting: prismjs is used for rendering static Java code blocks outside of the interactive Monaco editor.

Built with v0

This repository is linked to a v0 project. You can continue developing by visiting the link below -- start new chats to make changes, and v0 will push commits directly to this repo. Every merge to main will automatically deploy.

Continue working on v0 →

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

Learn More

To learn more, take a look at the following resources:

About

In-browser Java notebook for CS143 — write, compile and run Java with syntax highlighting and PDF export, built with Next.js and the Eclipse Java Compiler.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages