Summers Pittman
Summers Pittman

Reputation: 319

Enable preview features with jlinked java launcher

I am using Java 13 preview features, but I can't find the option in jlink to add the "--enable-preview" flag to the java command inside of the launcher script jlink generates.

As you can see, the launcher script that is generated is

#!/bin/sh
JLINK_VM_OPTIONS=
DIR=`dirname $0`
$DIR/java $JLINK_VM_OPTIONS -m wla_server/net.saga.snes.dev.wlalanguageserver.Main $@

However, I don't know how to get the script to be generated with JLINK_VM_OPTIONS=--enable-preview using the jlink command.

My jlink command is

$JAVA_HOME/bin/jlink \
  --module-path target/classes:target/dependency \
  --add-modules ALL-MODULE-PATH \
  --launcher launcher=wla_server/net.saga.snes.dev.wlalanguageserver.Main \
  --output dist/linux \
  --vm=server \
  --compress 2 

Upvotes: 1

Views: 258

Answers (1)

Summers Pittman
Summers Pittman

Reputation: 319

I've added the following sed command to my build script :

sed -i 's/JLINK_VM_OPTIONS=.*/JLINK_VM_OPTIONS=--enable-preview/' dist/linux/bin/launcher

This edits the launcher script:

#!/bin/sh
JLINK_VM_OPTIONS=--enable-preview
DIR=`dirname $0`
$DIR/java $JLINK_VM_OPTIONS -m wla_server/net.saga.snes.dev.wlalanguageserver.Main $@

Which works well enough.

Upvotes: 3

Related Questions