有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在ubuntu操作系统中通过j2me代码打开浏览器?

如何在ubuntu操作系统中通过Java ME代码打开浏览器

我正在使用下面给定的代码

String URL1="any url";
midlet.platformRequest(URL1);

上面这行代码没有在UBUNTU 10.10中打开浏览器,但在windows操作系统上可以正常工作

如果有其他人也面临同样的问题,请帮助我


共 (1) 个答案

  1. # 1 楼答案

    如果您使用emulator(哪个?),检查它是否正确配置(仿真器往往有类似用户指南中的内容)

    • 例如this article提供了WTK/ME SDK的配方:

      ...The J2ME Wireless Toolkit supports the platformRequest() method, but before using the method you must tell the toolkit what to do when it's invoked. You can associate only one platform service with platformRequest(). For instance, if for testing purposes you associate the method with your browser, the browser will be launched every time you call platformRequest(). If you need more flexibility, you can associate platformRequest() with a script that will use the URL scheme to route the request to the right handler.

      To associate a particular platform service with platformRequest(), simply add a com.sun.midp.midlet.platformRequestCommand attribute to the system.config file in the toolkit's lib directory. For example, to invoke the Mozilla browser whenever platformRequest() is called, add the following to system.config:

      # Associate the Mozilla browser with platformRequest() - Windows
      com.sun.midp.midlet.platformRequestCommand: "C:\Program Files\mozilla.org\Mozilla\mozilla.exe" 
      

      Given this setting, the call platformRequest("http://developers.sun.com/mobility") will launch Mozilla, and the browser will navigate to Sun's developer mobility portal...