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?

4
  • possible duplicate of java api to send file through serial port Commented Jun 1, 2011 at 5:22
  • @trashgod, I want send command and RECEIVE responses, not send file Commented Jun 1, 2011 at 5:34
  • @trashgod, but the DLL probably has high level functions specific for his reader which he would be missing in those libraries. Commented Jun 1, 2011 at 5:40
  • Ah, I see; now it makes sense. Commented Jun 1, 2011 at 5:44

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

3 Comments

+1. Can I solve my problem with Java APIs (Javax.comm or RXTX, not using JNI or write some code in C)?
@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.
@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.
2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.