I am trying to run a .jar that was complied by intellij with preview features in java 14.
I am now trying to run the .jar on a server with java 14.
Error: LinkageError occurred while loading main class com.wickedstacks.agenda.AgendaRestApp
java.lang.UnsupportedClassVersionError: Preview features are not enabled for com/wickedstacks/agenda/AgendaRestApp (class file version 58.65535). Try running with '--enable-preview'
What is the correct way to enable preview features at runtime?
java -jar agenda/agenda-rest-1.0.1.jar
gives the above error
java -jar agenda/agenda-rest-1.0.1.jar --enable-preview
This would make sense but does nothing
java --enable-preview [app]
I dont understand this, how do i provide the app when the main class is in a .jar?
any arguments listed after the jar/class-to-run are args for the app, not args for the VM. So, put those things in front.
java --enable-preview -jar agenda/agenda-rest-1.0.1.jar
or
java --enable-preview -cp lib1.jar:lib2.jar:. com.foo.MainClass
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With