Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Java parallel port control

Posted on 2014-02-13
5
Medium Priority
?
1,150 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 2000 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

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 make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Six Sigma Control Plans
Progress
Suggested Courses

721 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