Solved

Java parallel port control

Posted on 2014-02-13
5
1,116 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 36

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 36

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 36

Expert Comment

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

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project
Suggested Courses

622 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