Skip to content
Advertisement

Unable to run jar file with –enable-preview flag when using corretto 17

I am trying to run my application in an ec2 instance using the command

nohup java --enable-preview my-application.jar

But somehow the --enable-preview flag is ignored and i still get an error on startup telling me that i should try running it with the flag --enable-preview. I use amazon’s corretto-17 as the openJDK version.

Does corretto-17 not support the --enable-preview flag? The jar file runs fine when i run it in Intellij IDEA with --enable-preview. I’ve also added this flag as a compile argument to my pom.xml.

Advertisement

Answer

The problem was caused by nohup. Apparently java arguments are ignored when you execute the jar file while also using the supplemental command nohup.

Advertisement