1

I want to connect magnetic card reader, send commands and get responses with Java (COM Port) in Windows XP. I have .h file & dll. I want use dll functions. How can I connect or send device?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
totali
  • 260
  • 6
  • 22

2 Answers2

3

You will need to use JNI (Java Native Interface), google it for details. You probably will have to write some wrappers around the DLL in C first before JNI can use it.

Eelke
  • 20,897
  • 4
  • 50
  • 76
  • +1. Can I solve my problem with Java APIs (Javax.comm or RXTX, not using JNI or write some code in C)? – totali Jun 01 '11 at 05:50
  • @totali: I found @Eelke's comment and answer very helpful; I've clarified your question and up-voted the answer accordingly. When you have sufficient reputation, I urge you to do likewise. You may also want to review the [faq](http://stackoverflow.com/faq). – trashgod Jun 01 '11 at 06:00
  • @totali: using JNA as trashgod suggest in his answer shouldn't require any C but I have no experience with it. If you know the full serial protocol you can use any serial java communication library, see trashgods earlier comments. – Eelke Jun 01 '11 at 08:57
2

As an alternative, you may be able to bind to the dll using JNA.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045