From 3c0234817484413ebecb504618f4f2ade4d05a28 Mon Sep 17 00:00:00 2001 From: "markkitt@gmail.com" Date: Sun, 20 Mar 2022 20:52:23 -0400 Subject: [PATCH 1/3] Setup CI on v0.7 branch --- .github/workflows/CI.yml | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..c9551d1 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,58 @@ +name: CI +on: + pull_request: + push: + branches: + - master + - v0.7 + tags: '*' +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - '1.0' + - '1.6' + - '1' + - 'nightly' + os: + - ubuntu-latest + - windows-latest + arch: + - x64 + env: + - JULIA_COPY_STACKS: 0 + - JULIA_COPY_STACKS: 1 + exclude: + - os: windows-latest + env: + JULIA_COPY_STACKS: 1 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: '11' + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: actions/cache@v1 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info From c4fa4c60ace6faceada7c77a8f13ae74627e4b1f Mon Sep 17 00:00:00 2001 From: "markkitt@gmail.com" Date: Sun, 20 Mar 2022 22:45:38 -0400 Subject: [PATCH 2/3] Update CI.yml from master branch PR --- .github/workflows/CI.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c9551d1..0a7231d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -23,13 +23,19 @@ jobs: - windows-latest arch: - x64 - env: - - JULIA_COPY_STACKS: 0 - - JULIA_COPY_STACKS: 1 - exclude: + include: + - version: '1.0' + os: macos-latest + arch: x64 + julia_copy_stacks: 1 + - version: '1.6.2' + os: macos-latest + arch: x64 + julia_copy_stacks: 1 + - os: ubuntu-latest + julia_copy_stacks: 1 - os: windows-latest - env: - JULIA_COPY_STACKS: 1 + julia_copy_stacks: 0 steps: - uses: actions/checkout@v2 - uses: actions/setup-java@v2 @@ -52,6 +58,8 @@ jobs: ${{ runner.os }}- - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + env: + JULIA_COPY_STACKS: ${{ matrix.julia_copy_stacks }} - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v1 with: From 1aaffe342aa396f079418c246ece4a8a66272f23 Mon Sep 17 00:00:00 2001 From: "markkitt@gmail.com" Date: Sun, 20 Mar 2022 22:47:29 -0400 Subject: [PATCH 3/3] Get README.md from master branch --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c0dfdfe..ab178f6 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# JavaCall - -[![Build Statusi v0.7](https://travis-ci.com/JuliaInterop/JavaCall.jl.png?branch=v0.7)](https://travis-ci.com/github/JuliaInterop/JavaCall.jl) -[![Build Status master](https://travis-ci.com/JuliaInterop/JavaCall.jl.svg)](https://travis-ci.com/github/JuliaInterop/JavaCall.jl) -[![Build status](https://ci.appveyor.com/api/projects/status/qeu6ul9o9s6t5tiw?svg=true)](https://ci.appveyor.com/project/aviks/javacall-jl-6c24s) +# JavaCall.jl +![master GHA CI](https://github.com/JuliaInterop/JavaCall.jl/actions/workflows/CI.yml/badge.svg) +![v0.7 GHA CI](https://github.com/JuliaInterop/JavaCall.jl/actions/workflows/CI.yml/badge.svg?branch=v0.7) +[![Windows x86 CI](https://ci.appveyor.com/api/projects/status/qeu6ul9o9s6t5tiw?svg=true)](https://ci.appveyor.com/project/aviks/javacall-jl-6c24s) +[![Gitter](https://badges.gitter.im/JavaCall-jl/community.svg)](https://gitter.im/JavaCall-jl/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) Call Java programs from Julia. @@ -11,21 +11,97 @@ Call Java programs from Julia. Documentation is available at http://juliainterop.github.io/JavaCall.jl +## Quick Start Example Usage + +```julia +$ 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() # Optionally, explicitly initialize the JVM. Do not use this in package `__init__()` to allow other packages to add class paths or options. + +julia> jls = @jimport java.lang.System +JavaObject{Symbol("java.lang.System")} + +julia> out = jfield(jls, "out", @jimport java.io.PrintStream) +JavaObject{Symbol("java.io.PrintStream")}(JavaCall.JavaLocalRef(Ptr{Nothing} @0x0000000003ecda38)) + +julia> jcall(out, "println", Nothing, (JString,), "Hello World") +Hello World +``` + ## Versions * 0.7 branch is currently being maintained for bug fixes only * master branch is currently proposed to be v0.8.0 -## Non-Windows Operating Systems +## Julia version compatability + +JavaCall should continue to work with Julia 1.0.x (formerly a long term support version of Julia). -_JavaCall and its derivatives do not work correctly on Julia 1.1 and Julia 1.2. On Julia 1.3, please set the environment variable `JULIA_COPY_STACKS`. On 1.1 and 1.2, and on 1.3 without `JULIA_COPY_STACKS` set, you may see segfaults or incorrect results. This is typically due to stack corruption. The Julia long-term-support version of 1.0.x continues to work correctly as before._ +JavaCall and its dependents do not work correctly on Julia 1.1 and Julia 1.2. On Julia 1.1 and 1.2, you may see segfaults or incorrect results. This is typically due to stack corruption. For Julia pre-1.5, consider the [RootTaskRepl.jl](https://github.com/mkitti/RootTaskREPL.jl) package. With RootTaskREPL.jl, JavaCall is able to execute fine without the need of `JULIA_COPY_STACKS=1` with the exception of `@async` calls. Starting with the Julia 1.5, the REPL backend now runs on the root Task by default. +Julia 1.3.0 through Julia 1.6.2 are tested and guaranteed to work on Linux, macOS, and Windows via continuous integration. Julia 1.6.2 and newer should work on Linux and Windows. The `JULIA_COPY_STACKS` environment variable should be set to `1` on macOS and Linux, but not Windows. + +## Apple macOS + +JavaCall works on Julia 1.0 and Julia 1.3 to Julia 1.6.2. Please set the environment variable `JULIA_COPY_STACKS = 1`. + +As of Julia 1.6.3, JavaCall fails on macOS due to a fatal segmentation fault, signal (11). See [JavaCall#151](https://github.com/JuliaInterop/JavaCall.jl/issues/151) and [JuliaLang/julia#40056](https://github.com/JuliaLang/julia/pull/40056). + +The current developers of JavaCall do not posess current Apple hardware to debug this issue. [Help is needed.](https://github.com/JuliaInterop/JavaCall.jl/issues/151) + +Julia 1.0 and Julia 1.6.2 are tested via Github Actions continuous integration on macOS. + ## Windows Operating System -Do not set the environmental variable `JULIA_COPY_STACKS`. To use `jcall` with `@async` start Julia in the following way: +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. + +Julia 1.0, 1.6, 1 (latest release), and nightly are tested on Windows via Github Actions continuous integration. +x86 compatability is also tested on the latest Julia 1 release. + +## Linux + +On Julia 1.3 and newer, please set the environment variable `JULIA_COPY_STACKS = 1`. + +Multithreaded access to the JVM is supported as JavaCall version `0.8.0`. + +Julia 1.0, 1.6, 1 (latest release), and nightly are tested on Linux via Github Actions continuous integration. + +## 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`. +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.