Solved

Java parallel port control

Posted on 2014-02-13
5
1,093 Views
Last Modified: 2014-02-16
I need to set and reset a bit on the parallel port of my computer.  I have been browsing the web but can't seem to come up with anything.  I would like a piece of code that would accomplish that.  Thanks!
0
Comment
Question by:sargent240
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 35

Expert Comment

by:mccarl
ID: 39857918
Unfortunately, this can't be done with *just* a piece of code. Java doesn't support such low-level hardware access as it would be completly dependant on the underlying OS.

However, there seems to be libraries around that (via JNI) can provide that access. I don't have any first hand experience but if you are using Windows, this one looks to be the most promising...

Jnpout32
http://www.hytherion.com/beattidp/comput/pport.htm
(Scroll down past the C/C++ section to find that part applicable to Java)

While I don't have any experience with it, if you do decide to try this and run into problems, post here and I still may be able to assist you further.
0
 

Author Comment

by:sargent240
ID: 39861501
If I write a routine using C could I call the routine from Java?
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 39862141
If I write a routine using C could I call the routine from Java?
Yeah, for sure. If you are comfortable writing in C this would probably be the best. Have a look through a JNI tutorial such as this first...

http://www3.ntu.edu.sg/home/ehchua/programming/java/JavaNativeInterface.html

It will give you the whole story about the JNI process, from writing the Java side interface class, using javah to generate the C headers, writing the C code and compiling to either a DLL for Windows or a .so for Linux.
0
 

Author Closing Comment

by:sargent240
ID: 39862807
Thanks, I've written a lot of C code.  That will work.
0
 
LVL 35

Expert Comment

by:mccarl
ID: 39863561
Cool, glad to help! :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question