0

嗨,我收到此错误:

加载 win32com 时出错:java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jre1.8.0_60\bin\win32com.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform

运行此程序时:

public static void main(String args[]) {
    Enumeration ports = CommPortIdentifier.getPortIdentifiers();
   System.out.println(ports.hasMoreElements());
    while (ports.hasMoreElements()) {
      CommPortIdentifier port = (CommPortIdentifier) ports.nextElement();
      String type;
      switch (port.getPortType()) {
      case CommPortIdentifier.PORT_PARALLEL:
        type = "Parallel";
        break;
      case CommPortIdentifier.PORT_SERIAL:
        type = "Serial";
        break;
      default: /// Shouldn't happen
        type = "Unknown";
        break;
      }
      System.out.println(port.getName() + ": " + type);

    }
   // System.out.println(port.getName());

  }

我正在使用 java 1.8

提前致谢

4

1 回答 1

0

您可能正在运行 64 位 JVM。首先,通过在 cmd 行中输入以下内容来检查您的 JVM:

java -version

如果它显示“64 位”,则您运行的是 64 位 JVM,无法加载 32 位 .dll。
您可以改用 32 位 JVM。

于 2016-04-26T05:05:17.270 回答