Play Framework运行应用程序问题

每当我尝试运行使用Play创建的新Web应用程序时,我都会收到以下错误。

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. 

在Play framework 2.0.3中, \framework\build.bat脚本需要替换下面命令的命令行参数

 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" %* 

刚刚在我的Windows 8计算机上下载并解压缩了2.2.1。

遵循Play Framework网站上的文档,最终遇到了与您相同的问题。 调整构建文件中的各种参数没有做任何事情,但是:

 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" %* 

……解决了这个问题。 我不知道其他人在哪里找到了这个解决方案,但Play Framework网站上没有提到这个解决方案。 事实上,没有任何迹象表明任何事情都可能出错。 毕竟,它只是一个需要解压缩的文件。

它现在正在运行,但有点难以相信早期搞砸的框架。 似乎作者不测试除Linux之外的任何东西。

在2.3 Play框架中:

  GO to : 

C://Play2.3/framework/build.bat并打开此文件并进行这些更改。 用下面的行替换这一行。

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”%*

然后在命令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 

如果您无法执行此命令,则在Windows路径中的环境变量中设置play2.3框架路径。