Unrecognized Vm Option 'Cmsclassunloadingenabledn-J-Xmx2Gn'

I have installed scala, sbt on Mac. When I try to run sbt it gives an error Unrecognized VM option 'CMSClassUnloadingEnabledn-J-Xmx2Gn'. I think there is an issue with JVM but could not find any help for this error.

More error info: Did you mean '(+/-)CMSClassUnloadingEnabled'? Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

3

2 Answers

I faced the same issue after I ran the command I ran this command: echo '-J-XX:+CMSClassUnloadingEnabled\n-J-Xmx2G\n' >> /usr/local/etc/sbtopts. It seems the file /usr/local/etc/sbtopts contained both options in same line, separated by \n, i.e. the actual contents of the file were -J-XX:+CMSClassUnloadingEnabled\n-J-Xmx2G\n

The solution was to remove \n by editing this file, and pressing enter key instead, so that the contents of file /usr/local/etc/sbtopts look the way David mentioned in his response.

My guess is that the sbt configuration is confused with regards to line breaks and mangles something like

-J-XX:+CMSClassUnloadingEnabled
-J-Xmx2G

into one line

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest