NoClassDefFoundError on MacOS

Hello,

I am trying to run CUBA Studio on Mac OS Sierra 10.12.6 but I get NoClassDefFoundException javax/annotation/PreDestroy.

I have installed Java:

$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

And exported the JAVA_HOME variable:

$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home/jre/

Can anyone help please?

Thanks,
Delyan

Fixed:

Edit /Applications/CUBA Studio.app/Contents/Info.plist

And change the XML to:

JVMOptions

–add-modules=ALL-SYSTEM

JVMArguments

-Dosgi.requiredJavaVersion=1.8

Then I got another error that studio cannot find the version from 9.0.1
I did full cleanup of Java and reinstalled and now everything is ok.