I am using VSCode to create a Java GUI (that is connected to a SQL Server Database). Everything runs when I run it using VSCode's Java Project system, however, when I try to convert it to a jar file, I get this error:
Error: LinkageError occurred while loading main class App java.lang.UnsupportedClassVersionError: Preview features are not enabled for App (class file version 64.65535). Try running with '--enable-preview'
When I run it with --enable-preview
, it works. However, I need to make it work permanently on the jar (when I double click)
App is the name of my 'Main' class
My current java version:
java -version
java version "20" 2023-03-21
Java(TM) SE Runtime Environment (build 20+36-2344)
Java HotSpot(TM) 64-Bit Server VM (build 20+36-2344, mixed mode, sharing)
Note: I am using a Mac and NO build tools (like Maven/Gradle etc.)
Any help is appreciated!
It is working now. I just had to add a .settings folder that contains a file with org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled.