我有 hello world scalatra 应用程序。我添加了 scalatra-sbt 插件和:
val myDistSettings = DistPlugin.distSettings ++ Seq(
mainClass in Dist := Some("WebServerLauncher"),
memSetting in Dist := "2g",
permGenSetting in Dist := "256m",
envExports in Dist := Seq("LC_CTYPE=en_US.UTF-8", "LC_ALL=en_US.utf-8"),
javaOptions in Dist ++= Seq("-Xss4m",
"-Dfile.encoding=UTF-8",
"-Dlogback.configurationFile=logback.prod.xml",
"-Dorg.scalatra.environment=production")
)
使其 sbt dist
生成 .zip 后:
#!/bin/env bash
export CLASSPATH="lib:lib/logback-core-1.0.6.jar:lib/jetty-webapp-8.1.8.v20121106.jar:lib/jetty-io-8.1.8.v20121106.jar:lib/scalatra-scalate_2.10-2.2.2.jar:lib/jetty-server-8.1.8.v20121106.jar:lib/mime-util-2.1.3.jar:lib/scalatra-common_2.10-2.2.2.jar:lib/scalate-core_2.10-1.6.1.jar:lib/jetty-util-8.1.8.v20121106.jar:lib/jetty-servlet-8.1.8.v20121106.jar:lib/joda-convert-1.2.jar:lib/juniversalchardet-1.0.3.jar:lib/slf4j-api-1.7.5.jar:lib/scala-library-2.10.4.jar:lib/jetty-continuation-8.1.8.v20121106.jar:lib/grizzled-slf4j_2.10-1.0.1.jar:lib/config-1.0.0.jar:lib/javax.servlet-3.0.0.v201112011016.jar:lib/jetty-xml-8.1.8.v20121106.jar:lib/rl_2.10-0.4.4.jar:lib/jetty-security-8.1.8.v20121106.jar:lib/akka-actor_2.10-2.1.2.jar:lib/jetty-http-8.1.8.v20121106.jar:lib/scala-reflect-2.10.0.jar:lib/scalate-util_2.10-1.6.1.jar:lib/logback-classic-1.0.6.jar:lib/scalatra_2.10-2.2.2.jar:lib/joda-time-2.2.jar:lib/scala-compiler-2.10.0.jar:"
export JAVA_OPTS="-Xms2g -Xmx2g -XX:PermSize=256m -XX:MaxPermSize=256m -Xss4m -Dfile.encoding=UTF-8 -Dlogback.configurationFile=logback.prod.xml -Dorg.scalatra.environment=production"
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.utf-8
java $JAVA_OPTS -cp $CLASSPATH WebServerLauncher
当我试图运行它时,我得到了:
Error: Could not find or load main class WebServerLauncher
WebServerLauncher.class
在lib目录中有。
如何正确启动它?
谢谢你。