我一直在使用AS3中的事件监听器,但似乎在java中没有(除了图形组件).这令人惊讶.
问题是,我怎样才能在java中实现自己的事件监听器?也许有人之前做过这项工作?
我无法使用 Process("dir/e.exe") 因为 e 需要在它自己的目录上执行,否则它无法访问其资源。但每当我尝试更改工作目录时,我都会收到异常:
Process("e.exe", new File(dir))
Process("e.exe", new File("\"+ dir))
Process("e.exe", new File(new File(dir).getCanonicalPath()))
Caused by: java.io.IOException: Cannot run program "e.exe" (in directory ".
\dir"): CreateProcess error=2, The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)
这些不起作用,它们给了我完全相同的错误。还有其他选择吗?
编辑:这就是我的目录的样子:
MyFolder:
|-app.jar
|-folderWithExe
\-e.exe
Run Code Online (Sandbox Code Playgroud) 它抛出了第 3 行的异常。问题是我只有这些行:
package controllers
import play.api._
import play.api.mvc._
import views._
import models._
object Application extends Controller {
def index = Ok(views.html.index("grrr", "blabla"))
}
Run Code Online (Sandbox Code Playgroud)
编辑:index.scala.html
@import helper._
@main("Todo") {
<h1>Hello World</h1>
}
Run Code Online (Sandbox Code Playgroud)
我在 windows xp 上使用 play 2.2.0(带 sbt)