0

Hi I am getting this error:

Error loading 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

while running this program:

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());

  }

I am using java 1.8

Thanks in advance

Adam Calvet Bohl
  • 1,009
  • 14
  • 29

1 Answers1

0

You are probably running a 64 bit JVM. First, check your JVM by entering this on cmd line:

java -version

If it says "64 bit", you're running 64 bit JVM incapable of loading 32 bit .dll's.
You can use a 32 bit JVM instead.

Adam Calvet Bohl
  • 1,009
  • 14
  • 29
  • I tried on 32 bit also java version "1.6.0_10-ea" Java(TM) SE Runtime Environment (build 1.6.0_10-ea-b10) Java HotSpot(TM) Client VM (build 11.0-b09, mixed mode, sharing) – Pushkar Kumar Apr 26 '16 at 07:23
  • But, are you running on 32 bit JVM version? See this post: http://stackoverflow.com/questions/29394163/cant-load-ia-32-bit-dll-on-a-amd-64-bit-platform – Adam Calvet Bohl Apr 26 '16 at 07:43