Play Framework Run Application Issue

2019-03-11 01:24发布

I am getting the following error whenever i am trying to run a new Web Application created using Play.

Error occurred during initialization of VM
Could not reserve enough space for object heap

Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

3条回答
Anthone
2楼-- · 2019-03-11 02:07

in 2.3 Play framework :

    GO to : 

C://Play2.3/framework/build.bat and open this file and make these changes. Replace this line with below line.

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

then type this command on command promt:

       C:\Users\k.ashish\Downloads\play-2.2.3\play-2.2.3\yourapp>play

        C:\Users\k.ashish\Downloads\play-2.2.3\play-2.2.3\yourapp>run

If you are not able to execute this command then set the play2.3 framework path in Environment variable in windows like java path .

查看更多
▲ chillily
3楼-- · 2019-03-11 02:24

In Play framework 2.0.3, <play framework install dir>\framework\build.bat script you need to replace the command line argument for the command below

java -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

Into

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*
查看更多
闹够了就滚
4楼-- · 2019-03-11 02:30

Just downloaded and unzipped 2.2.1 on my Windows 8 computer.

Followed the documentation at Play Framework website, and ended up having the same issue as you. Adjusting the various parameters in the build file didn't do anything, but the:

java -XX:+CMSClassUnloadingEnabled %DEBUG_PARAM% -Dfile.encoding=UTF8 -Dplay.version="%PLAY_VERSION%" -Dsbt.ivy.home="%~dp0..\repository" -Dplay.home="%~dp0." -Dsbt.boot.properties="file:///%p%sbt/sbt.boot.properties" -jar "%~dp0sbt\sbt-launch.jar" %*

... solved the problem. I don't know where other people found this solution, but there's no mentioning of this solution on the Play Framework website. In fact, there's nothing to suggest that anything could go wrong. After all, it's just a file you need to unzip.

It's running now, however it's a little hard to trust a framework that screws up that early on. Seems the authors don't test on anything but Linux.

查看更多
登录 后发表回答