Skip to content

document to use aliases to set JVM args #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions topics/embedded.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,36 @@ two important libraries for clojure loaded, nrepl and cider which allow a rich,
interactive development experience so let's now connect to that port with our favorite
Clojure editor - emacs of course ;-).

### Passing JVM arguments

If you want to specify arbitrary arguments for the JVM to be started by Python,
you can use the environment variable `JDK_JAVA_OPTIONS` to do so. It will be picked up by
the JVM when starting.

Since clojurebridge 0.0.8, you can as well specify a list of aliases, which get resolved
from the `deps.edn` file. This allows as well to specify JVM arguments and JVM properties.

Example:

Starting Clojure embedded from python via

```python
cljbridge.init_jvm(aliases=["jdk-17","fastcall"],start_repl=True)
```
and a `deps.edn` with

```clojure
:aliases {

:fastcall
{:jvm-opts ["-Dlibpython_clj.manual_gil=true"]}
:jdk-17
{:jvm-opts ["--add-modules=jdk.incubator.foreign"
"--enable-native-access=ALL-UNNAMED"]}}
```

would add then the appropriate JVM options.

## From the Clojure REPL


Expand Down