Skip to content

Commit dbd7331

Browse files
authored
document to use aliases to set JVM args (#232)
available since clojurebridge 0.0.8: See here for background on this feature. behrica/clojurebridge#4
1 parent 84e6306 commit dbd7331

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

topics/embedded.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,36 @@ two important libraries for clojure loaded, nrepl and cider which allow a rich,
8181
interactive development experience so let's now connect to that port with our favorite
8282
Clojure editor - emacs of course ;-).
8383

84+
### Passing JVM arguments
85+
8486
If you want to specify arbitrary arguments for the JVM to be started by Python,
8587
you can use the environment variable `JDK_JAVA_OPTIONS` to do so. It will be picked up by
8688
the JVM when starting.
89+
90+
Since clojurebridge 0.0.8, you can as well specify a list of aliases, which get resolved
91+
from the `deps.edn` file. This allows as well to specify JVM arguments and JVM properties.
92+
93+
Example:
94+
95+
Starting Clojure embedded from python via
96+
97+
```python
98+
cljbridge.init_jvm(aliases=["jdk-17","fastcall"],start_repl=True)
8799
```
100+
and a `deps.edn` with
101+
102+
```clojure
103+
:aliases {
104+
105+
:fastcall
106+
{:jvm-opts ["-Dlibpython_clj.manual_gil=true"]}
107+
:jdk-17
108+
{:jvm-opts ["--add-modules=jdk.incubator.foreign"
109+
"--enable-native-access=ALL-UNNAMED"]}}
88110
```
89111

112+
would add then the appropriate JVM options.
113+
90114
## From the Clojure REPL
91115

92116

0 commit comments

Comments
 (0)