error: cannot find symbol (using replaceAll ) codenameone

error: cannot find symbol (using replaceAll ) codenameone

我想替换字符串表达式,但收到此错误消息

    error: cannot find symbol
    test1 = testw.replaceAll("/uploads","http://www.anbariloche.com.ar/uploads");
    symbol:   method replaceAll(String,String)
    location: variable testw of type String

这是我的代码

    String testw= String.valueOf(element1);


    String test1;
    test1 =     testw.replaceAll("/uploads","http://www.anbariloche.com.ar/uploads");

我使用 Netbeans 8.1

Product Version: NetBeans IDE 8.1 (Build 201510222201)
Java: 1.7.0_79; Java HotSpot(TM) Client VM 24.79-b02
Runtime: Java(TM) SE Runtime Environment 1.7.0_79-b15
System: Windows 7 version 6.1 running on x86; Cp1252; es_ES (nb)

完整代码已更新

 @Override
protected void beforePortada(Form f) {
    WebBrowser browser=new WebBrowser();
    f.setLayout(new BorderLayout());
    f.addComponent(BorderLayout.CENTER, browser);

    /////Parse
    String URL= "http://www.anbariloche.com.ar/";

    ConnectionRequest req = new ConnectionRequest();
    req.setUrl(URL);
    NetworkManager.getInstance().addToQueueAndWait(req);
    byte[] data = req.getResponseData();
    if (data == null) {

    }



    XMLParser xmlParser=new XMLParser();
    Element element= null;
    try {
        element = xmlParser.parse(new InputStreamReader(new ByteArrayInputStream(data), "UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    Element element1=element.getChildAt(0);


    String testw= String.valueOf(element1);
       ///replace the string
          testw = testw.replaceAll("/uploads/","http://www.anbariloche.com.ar/uploads/");

    browser.setPage(testw,null);
}
 }

那是更新的代码,我可以看到我的错误在哪里 与字符串

使用StringUtil.replaceAll(string, pattern, replace)

在 VM 层中以真正可移植的方式实现这一点要困难得多,因此我们建议您使用更可移植的版本。

netbean在编码时不会有任何错误,它会显示运行时错误,所以应该导入StringUtil并调用它的replaceAll静态方法 例如:StringUtil.replaceAll