GWT - 用Eclipse找不到工作目录是不可能的

use*_*709 1 java gwt

我需要在我的面板上显示工作目录.

我用String value = System.getProperty("user.dir").之后我把这个字符串放在标签上,但是我在控制台上收到了这条消息:

The method getProperty(String, String) in the type System is not applicable for the arguments (String).
Run Code Online (Sandbox Code Playgroud)

我用eclipse.

app*_*tup 6

问题

我猜你没有通过GWT 101 - 你不能盲目地在客户端使用JAVA CODE.

说明

您可以从JAVA中找到GWT支持的类和方法列表. https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation

仅限系统,仅支持以下内容.

err, out,
System(), 
arraycopy(Object, int, Object, int, int), 
currentTimeMillis(), 
gc(), 
identityHashCode(Object), 
setErr(PrintStream),
setOut(PrintStream)
Run Code Online (Sandbox Code Playgroud)

在您的情况下,在服务器端代码中执行System.getProperty("user.dir")并使用RPC或任何其他服务器端gwt通信技术访问它.