GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JuliaInterop/JavaCall.jl: Call Java from Julia

BranchesTags
Open more actions menu

Latest commit

 

History

435 Commits
435 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
JProxies
JProxies
 
 
doc
doc
 
 
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE.md
LICENSE.md
 
 
Project.toml
Project.toml
 
 
README.md
README.md
 
 

Repository files navigation

JavaCall.jl

master GHA CI

Call Java programs from Julia.

Documentation

Documentation is available at http://juliainterop.github.io/JavaCall.jl

Quick Start Example Usage

$ JULIA_NUM_THREADS=1 JULIA_COPY_STACKS=1 julia

julia> using Pkg; Pkg.activate(; temp = true)
  Activating new project at `/tmp/jl_e6uPja`

julia> using JavaCall
 │ Package JavaCall not found, but a package named JavaCall is available from a
 │ registry. 
 │ Install package?
 │   (jl_e6uPja) pkg> add JavaCall 
 └ (y/n) [y]: y

...

julia> JavaCall.addClassPath(pwd()) # Set appropriate classpath

julia> JavaCall.addOpts("-Xmx1024M") # Use 1 GB of memory
OrderedCollections.OrderedSet{String} with 1 element:
  "-Xmx1024M"

julia> JavaCall.addOpts("-Xrs") # Disable signal handling in the JVM, reducing performance but enhancing compatability
OrderedCollections.OrderedSet{String} with 2 elements:
  "-Xmx1024M"
  "-Xrs"

julia> JavaCall.init() # Call before using `jcall` or `jfield`. Do not use this in package `__init__()` to allow other packages to add classpaths or options.

julia> jls = @jimport java.lang.System
JavaObject{Symbol("java.lang.System")}

julia> out = jfield(jls, "out", @jimport java.io.PrintStream) # Third arg is optional, but helps type stability.
JavaObject{Symbol("java.io.PrintStream")}(JavaCall.JavaLocalRef(Ptr{Nothing} @0x0000000003ecda38))

julia> jcall(out, "println", Nothing, (JString,), "Hello World")
Hello World

Julia version compatibility

The CI tests for Julia 1.6 as min, Julia LTS, and the latest stable release.

macOS and Linux

For Julia 1.3 onwards, please set the environment variable JULIA_COPY_STACKS = 1. For Julia 1.11 onwards, please also set JULIA_NUM_THREADS = 1

Multithreaded access to the JVM is supported as JavaCall version 0.8.0, but doesn't work in recent Julia versions.

Windows

Do not set the environmental variable JULIA_COPY_STACKS or set the variable to 0.

To use jcall with @async, start Julia in the following way:

$ julia -i -e "using JavaCall; JavaCall.init()"

Windows currently lacks support for multithreaded access to the JVM.

Other Operating Systems

JavaCall has not been tested on operating systems other than macOS, Windows, or Linux. You should probably set the environment variable JULIA_COPY_STACKS = 1 and JULIA_NUM_THREADS = 1. If you have success using JavaCall on another operating system than listed above, please create an issue or pull request to let us know about compatability.

About

Call Java from Julia

juliainterop.github.io/JavaCall.jl

Topics

javajuliajulialang

Resources

Readme
License
Activity
Custom properties

Stars

125 stars

Watchers

14 watching

Forks

53 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.