如何修复 Netbeans 8.0 未检测到 Java ME

How to fix Netbeans 8.0 not detecting Java ME

我正在尝试设置 NetBeans 8.0 以便在 Java ME 中进行开发(我知道这是遗留软件,但它是我所知道的唯一支持 Java ME 的软件),但是, NetBeans 不会在我尝试加载时在平台管理器中检测到我的 Java ME 平台。您可以查看此错误here。我的版本 Java 是 1.8.0_201。来自 Java ME SDK 的日志显示为:

[2019-02-16 09:20:12.444] 信息 - lkit.bootstrap.DeployerManager - 注册自定义 属性 编辑器 [2019-02-16 09:20:12.463] 信息 - me.toolkit.bootstrap.Namespace - 起始批次,基本模块对象服务器 [2019-02-16 09:20:12.476] 信息 - bootstrap.ObjectGraphProcessor - 合并依赖项... [2019-02-16 09:20:12.476] 信息 - bootstrap.ObjectGraphProcessor - 合并依赖项... [2019-02-16 09:20:12.477] 信息 - bootstrap.ObjectGraphProcessor - 正在计算订单... [2019-02-16 09:20:12.477] 信息 - bootstrap.ObjectGraphProcessor - 计算订单 [2019-02-16 09:20:12.494] 信息 - un.jme.toolkit.bootstrap.Batch - 正在初始化对象... [2019-02-16 09:20:12.495] 信息 - un.jme.toolkit.bootstrap.Batch - 申请 I18N [2019-02-16 09:20:12.495] 信息 - un.jme.toolkit.bootstrap.Batch - 已初始化的对象 [2019-02-16 09:20:12.495] 信息 - un.jme.toolkit.bootstrap.Batch - 调用 create() 方法... [2019-02-16 09:20:12.496] 信息 - un.jme.toolkit.bootstrap.Batch - 调用 start() 方法... [2019-02-16 09:20:12.503] 信息 - un.jme.toolkit.bootstrap.Batch - 对象已启动 [2019-02-16 09:20:12.506] 信息 - me.toolkit.bootstrap.Namespace - 起始批次,基本模块 process/device-manager [2019-02-16 09:20:12.536] 信息 - bootstrap.ObjectGraphProcessor - 合并依赖项... [2019-02-16 09:20:12.537] 信息 - bootstrap.ObjectGraphProcessor - 合并依赖项... [2019-02-16 09:20:12.537] 信息 - bootstrap.ObjectGraphProcessor - 正在计算订单... [2019-02-16 09:20:12.538] 信息 - bootstrap.ObjectGraphProcessor - 计算订单 [2019-02-16 09:20:12.865] 信息 - un.jme.toolkit.bootstrap.Batch - 正在初始化对象... [2019-02-16 09:20:12.914] 信息 - un.jme.toolkit.bootstrap.Batch - 申请 I18N [2019-02-16 09:20:12.915] 信息 - un.jme.toolkit.bootstrap.Batch - 已初始化的对象 [2019-02-16 09:20:12.915] 信息 - un.jme.toolkit.bootstrap.Batch - 调用 create() 方法... [2019-02-16 09:20:12.919] 信息 - un.jme.toolkit.bootstrap.Batch - 调用 start() 方法... [2019-02-16 09:20:12.959] 错误 - sun.kvem.tools.http.HttpServer - java.net.BindException:地址已在使用中:JVM_Bind java.net.BindException:地址已被使用:JVM_Bind 在 java.net.DualStackPlainSocketImpl.bind0(本机方法) 在 java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106) 在 java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387) 在 java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190) 在 java.net.ServerSocket.bind(ServerSocket.java:375) 在 java.net.ServerSocket.bind(ServerSocket.java:329) 在 com.sun.kvem.tools.http.HttpServer.createServerSocket(未知来源) 在 com.sun.kvem.tools.http.HttpServer.运行(未知来源)

我已经在包括这个论坛在内的许多论坛上尝试过许多关于这个问题的答案,但是 none 的答案都奏效了。任何帮助表示赞赏。

你的问题不是很容易解决,这不是解决方案 - 它更像是对你的问题的更新,因为它太大而无法发表评论:

首先请注意,无法将 Java ME 添加为 NetBeans 中的平台的原因显示在堆栈跟踪中:java.net.BindException: Address already in use: JVM_Bind.

Oracle 在其 Java ME 文档中的许多地方都提到了获得此异常的可能性。 For example:

7.2.1 Troubleshooting Device Connection Issues

If the IP address of a device with a running Java ME Embedded runtime instance is not available in the corresponding drop-down list when adding a device connection, see the Device Manager log file. It is located under logs in the Oracle Java ME SDK configuration directory.

The Device Connection log file (device-manager.log) contains errors, warnings, and informational events that you can review in order to find the cause of the problem. The following are some of the common messages that you may encounter:

WARN - .vmagent.proxy.DeviceDetection - UDP device detection failed java.net.BindException: Address already in use: Cannot bind

Cause: The device detection ports are used by another application on the host computer. By default, these ports are 55208 and 55209.

Action: The best solution is to stop the application that uses these ports or configure it to use different ports. Alternatively, you can configure the device and Device Manager to use different ports as follows:

  1. Change the ports specified by the proxy.udp_device_detection_request_port and proxy.udp_device_detection_response_port properties in jwc_properties.ini on the device.

  2. Create a file named proxyOptions.txt under toolkit-lib/lib in the Oracle Java ME SDK installation directory and add the following line to it:

-bcastports <request> <response>

The <request> and <response> port numbers must match those specified in the device properties (see Step > 1).

由于设备管理器使用的默认端口是 55208 和 55209,您可以检查这些端口是否已被使用:

  • 打开一个命令提示符 window。
  • 提交 netstat -aon | findstr 55208netstat -aon | findstr 55209

如果对 netstat return 的两次调用都没有,则端口可用。否则,这些端口已在使用中,您需要通过检查为正在使用的端口显示的 PID 来找出原因。

或者,只需分配不同的端口号,如上面所示的 Oracle 文档中所述。如果您打算这样做,请首先使用 netstat 验证新端口号是否可用。例如,如果要使用端口 55210,则调用 netstat -aon | findstr 55210。如果没有其他进程正在使用该端口,那么 netstat 将 return 什么都没有。


更新:

以下方法对我有用:

  • Select 工具 > Java 平台 > 添加平台...
  • 单击 添加平台... 按钮和 select 单选按钮 自定义 Java ME CLDC 平台仿真器 并单击 下一步 >
  • 单击浏览...按钮并导航到您的 Java ME 文件夹(例如“...\Java_ME_platform_SDK_8.0”)。
  • 单击 下一步 > 然后单击 下一步 > 然后单击 完成.