Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
J/Link User Guide
JLINK OVERVIEW

J/Link User Guide

Introduction to J/Link

J/Link and WSTP

Calling Java from the Wolfram Language

J/Link Basics

Preamble

Loading the J/Link Package

Launching the Java Runtime

InstallJava
Controlling the Command Used to Launch Java
Overriding the Class Path

Loading Classes

LoadJavaClass
When to Call LoadJavaClass
Contexts and Visibility of Static Members
Inner Classes

Conversion of Types between Java and the Wolfram Language

Creating Objects

Calling Methods and Accessing Fields

Syntax
Underscores in Java Names

Getting Information about Classes and Objects

Quitting or Restarting Java

Version Information

Advanced Topics in J/Link

Controlling the Class Path: How J/Link Finds Classes

The Java Class Path
Overriding the Startup Class Path
Dynamically Modifying the Class Path
Examining the Class Path
Using J/Link's Class Loader Directly

Performance Issues

Overhead of Calls to Java
Speeding Up Sending Large Arrays
An Optimization Example

Reference Counts and Memory Management

Object References in the Wolfram Language
ReleaseJavaObject
JavaBlock
PeekObjects and PeekClasses

Exceptions

How Exceptions Are Handled
The JavaThrow Function

Returning Objects "by Value" and "by Reference"

References and Values
ReturnAsJavaObject
JavaObjectToExpression

MakeJavaObject and MakeJavaExpr

Preamble
MakeJavaObject
MakeJavaExpr

Creating Windows and Other User Interface Elements

Preamble
Interactive and Non-Interactive Interfaces
Modal versus Modeless Operation
Handling Events with Wolfram Language Code: The "MathListener" Classes
Bringing Java Windows to the Foreground
Modal Windows
MathFrame and MathJFrame
Modeless Windows: Sharing the Kernel with Java
Sharing the Front End
Summary of Modal and Modeless Operation
"Manual" Interfaces: The ServiceJava Function
Using a GUI Builder

Drawing and Displaying Wolfram Language Images in Java Windows

The MathCanvas and MathGraphicsJPanel Classes
Showing Wolfram Language Graphics and Typeset Expressions
Drawing Using Java's Graphics Functions
Bitmaps

The Java Console Window

Using JavaBeans

Hosting Applets

Periodical Tasks

Some Special Number Classes

Preamble
The "Wrapper" Classes: Integer, Float, Boolean, and Others
Complex Numbers
BigInteger and BigDecimal

Ragged Arrays

Implementing a Java Interface with Wolfram Language Code

Writing Your Own Installable Java Classes

Preamble
Installable Functions—The Old Way
Installable Functions in Java
Setting Up Definitions in the Wolfram Language When Your Class Is Loaded
Manually Returning a Result to the Wolfram Language
Requesting Evaluations by the Wolfram Language
Throwing Exceptions
Making a Method Interruptible
Writing Your Own Event Handler Code
Debugging Your Java Classes

Deploying Applications That Use J/Link

Coding Tips

Example Programs

Introduction

A Beep Function

Formatting Dates

A Progress Bar

A Simple Modal Input Dialog

A File Chooser Dialog Box

Sharing the Front End: Palette-Type Buttons

Real-Time Algebra: A Mini-Application

GraphicsDlg: Graphics and Typeset Output in a Window

BouncingBalls: Drawing in a Window

Spirograph

A Piano Keyboard

Writing Java Programs That Use the Wolfram Language

Introduction

What Is WSTP?

Overview of the Main J/Link Interfaces and Classes

Preamble

MathLink and KernelLink

MathLinkFactory

MathLinkException

Expr

PacketListener

High-Level User Interface Classes

Sample Program

Creating Links with MathLinkFactory

Using Listen and Connect Modes

Using a Remote Kernel

The MathLink Interface

Managing Links

Packet Functions

Error Handling

Link State

Putting

Getting

Messages

Marks

Complex Class

Yield and Message Handlers

Constants

The KernelLink Interface

Evaluate

Waiting for the Result

The "evaluateTo" Methods

Sending Java Object References

Interrupting, Aborting, and Abandoning Evaluations

Support for PacketListeners

The handlePacket() Method (Advanced Users Only)

Methods Valid Only for "StdLinks"

Sending Computations and Reading Results

WSTP Packets

The WSTP "Packet Loop"

Sending an Evaluation

Reading the Result

The "evaluateTo" Methods

Using the PacketListener Interface

The PacketPrinter Class for Debugging

Using EnterTextPacket

Handling MathLinkExceptions

Graphics and Typeset Output

Preamble

MathCanvas and MathGraphicsJPanel

A Sample Program That Displays Graphics and Typeset Results

evaluateToImage() and evaluateToTypeset()

Aborting and Interrupting Computations

Using Marks

Using Loopback Links

Using Expr Objects

Motivation for the Expr Class

Methods in the MathLink Interface for Reading and Writing Exprs

Exprs as Replacements for Loopback Links

Exprs as a Means to Get String Representations of Expressions

Exprs as Arguments to KernelLink Methods

Examining and Manipulating Exprs

Disposing of Exprs

Threads, Blocking, and Yielding

Sending Object References to the Wolfram Language

Some Special User Interface Classes

Introduction

ConsoleWindow

MathSessionPane

BracketMatcher and SyntaxTokenizer

InterruptDialog

Writing Applets

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English