Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Java parallel port control

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Make the most of your online learning experience.
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses

971 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