I want to write a Java App that can communicate with an Infra-red device. I have a USB infra-red reader that I want to use. Are there any Java Libraries that I can use to make this happen... Ideally I want the program to work on windows and macOS X. Anyone have any sample code or anything they can do to point me in the right direction, I have never worked on such a project but I need to figure it out...
Looks like there is something:
http://www.hpl.hp.com/personal/Jean_Tourrilhes/IrDA/Java.html
http://sourceforge.net/projects/jir/files/
But everything is outdated and has low chances of running on Win or MacOSX.
Related
I have this chess engine i wrote in java. Thing is, I need to make a exe application that can take commands following a certain protocol (UCI). Ive had many problems trying to get this to work, but ill keep this brief and share the most important ones.
Other engines pop up cmd when you click on them, mine is just a basic java CLI (Dont know if this is a problem).
My anti virus keeps stopping me from opening the exe. Launch4j gives me a warning telling me I should sign it to prevent this sort of thing, but I dont know what that means.
So heres the deal, I know this post is word vomit, but Im truly at a loss right now. Id like general order advice on how I should approach the problem and maybe some advice on wether i should be using launch4j in the first place.
UPDATE: The reason i wanted to make an exe in the first place is because thats the format that was suggested in the lichess documentation (I wanted to upload my bot to lichess). I wrote a bat file that executes the jar file and it worked fine. Thanks to everyone for the suggestions.
I'm trying open this application: http://www1.icsi.berkeley.edu/~lucag/
(It's a research tool might might be great for my work so I really want to access it).
I'm running big sur on a 2014 mac book pro. It has Java 8 (I'm assuming that this is the 'Java Virtual Machine' which is specified in the instructions).
When I try and open the app I get the message:
"You do not have permission to open the application "ECGWorkbench'.
Contact your computer or network administrator for assistance."
I've tried everything on these two threads:
Can't run app because of permission in Big Sur
https://developer.apple.com/forums/thread/666611?page=3
I've tried opening the app on a mac which hadn't been upgraded to big sur. I can't get hold of a Windows or Linux computer.
I have two questions:
Is there a work around? I'm not a programer so bear with this question but if the app is written in Java and I had the code could I execute it? The folder with the app in had lots of other files. Or if I installed Linux in a virtual environment on my mac could I then open the Linux version of the app?
If it can't be fixed I'm going to try to contact the developers. The project doesn't seem to be very active so I'm not convinced they'd be interested in updating the app. If I could suggest what amendment they need to make or at least say why it's not working they might be more willing to help me out. Can anyone suggest what I could say to them? Something along the lines of 'I can't open the app because of XYZ, could you change the ABC' would be perfect. The NTL (neural theory of language) project created the app but they are part of the ICSI (international computer science institute) at berkley so I'm assuming they know what code is etc.
Thank you.
Rachel
I've been a little late with my reply, but I hope my solution will help you.
I had the same issue with eclipse (i need it for study things), so i opened my terminal and typed the following command...
codesign --force --deep --sign -/Application/Eclipse.app
After a reasign everything works fine for me.
I'm looking to write a Linux/Windows/Mac Java HID controller for a simple wireless HID interface device. I've tinkered around with the USB4Java LibUsb library to no avail, and I've been steered in the direction of the JavaHIDAPI.
Unfortunately for me, I really have no idea what I'm doing beyond a pretty decent higher level programming skill set (C#/VB.Net), and switching over to this is killing me.
The directions that I found said that I would first need to compile the HIDAPI library found here. It said it would build something called hidapi-jni.dll (which it didn't).
Anyway, I think this is where I need to go since the HID does nothing but simply sends and receives signals to and from a wireless control (and responds to signals received).
Is there any step-by-step tutorial for using the JavaHIDAPI for this? Or is there a better library? (I noticed that this is a bit... dated).
I tried myself with the following:
static{ System.loadLibrary("hidapi"); }
.
.
.
public static void main(string[] Args) throws . . . {
ClassPathLibraryLoader.loadNativeHIDLibrary();
HIDDevice dev = HIDManager.getInstance().openById(VEND_ID, PROD_ID, null);
.
.
.
}
The issue into which I am running is that (besides the fact that the HIDAPI doesnt seem to be building into HIDAPI-jni.dll) is that the HIDManager.openById(. . .) always returns null. Also, I moved the hidapi.dll that was built into the C:...\Java...\bin directory... or something, I'm sure it's right because there wasn't any unsatisfied link error. It's really frustrating because there doesn't seem to be any newbies guide to Java and HID anywhere.
What am I doing wrong here?
I'm a bit late to answer this question, but I've written a library called hid4java that might solve your problem.
It's based on Java Native Access (JNA) which is a lot simpler than faffing about with complex JNI incantations.
I had to write it because javahidapi is out of date and the underlying signal11/hidapi code has moved on considerably. The older versions of the hidapi library had problems on OS X with attach/detach events which have now been fixed so an upgrade is necessary.
Also I found it impossible to claim a USB HID device through usb4java on OS X so I ended up writing this library to solve that problem.
Hope it helps.
So the issue, I discovered, was with native libraries.
I was able to get the application to work by copying the .dll from the .jar file and referencing it, but more important, I'm going to rebuild the .java class file responsible for loading the library and add the
System.loadLibrary();
call. When the JavaHidApi ClassPathLibraryLoader.loadNativeHIDLibrary(); method is called it doesn't load the library upon successfully writing it out to the temp file which is mildly annoying. Doing this will eliminate the necessity for manually loading the library from a static location...
Thank you for pointing me in the correct direction.
I want to develop a Java application, hoping that the system never goes to hibernate when my application running.
The application will be deployed in Windows.
Is there any way to realize this?
There is nothing in java for this.
There are windows API to prevent hibernation. See this thread Prevent windows from going into sleep when my program is running?
You could all call them via JNI or JNA
There are two ways to avoid your system going into Hibernate mode when your application is running:
1) I don't know which Windows operating system you are talking about; but we can disable or enable Hibernation at an operating system level. The enabling/disabling method might differ for different Window versions.
2) Another way would be to write a C++ program that uses Win32 API to interact at system level. After writing the code, you can export it as a DLL library and then use it in the Java program. Below link provides a sample code that will help you achieve similar functionality.
http://www.codeguru.com/cpp/w-p/system/messagehandling/article.php/c6907/JavaC-PC-Standby-Detect-and-Prevent.htm
I had similar problems when i wanted to connect via RDP to my pc, i left teamviewer on, but my pc went to hibernate/sleep and this is my solution how i keep my pc "active".
Try this, go to Control Panel->Power Options:
and there u can select power plan, click on "Change plan settings" and u will get to this screen:
Hope that this will help u.
If u need some programmatic solution, try with this link:
How do you keep the machine awake?
I'm currently developing a programm with Java to interact with an Arduino module. Now in Windows, it's running pretty well so far (I receive what I expect; I can work with the data), but in Linux (Ubuntu in my case); it's like the opposite. I installed Arduino and rxtx-java packages.
When I tried to use the Arduino program to connect to the Arduino board, I had to set a softlink on the ACM module to some serial or USB module. For example,
ln -s /dev/ttyACM0 /dev/ttyS99
Otherwise it won't even show up in the list in the Arduino program. So what I did then was starting the serial monitor tool (Ctrl + Shift + M) and sent it my start sequence waiting for an answer. It worked without a problem there (it was binary data so I couldn't verify if it was correct, but I got an answer at least).
The next thing I did was trying to do the same with my program, so the Arduino was connected to the PC, the softlink was set correctly, the device listed along with two normal COM-ports I have in my PC in my program, and I tried to connect, but it didn't work.
No error, no nothing, simply no answer of the board. After I waited a couple of minutes, it still didn't do anything, so I disconnected it from the PC, and then I got an array of zero-bytes as the answer.
What could cause this kind of problems and how would I fix it?
Thanks for your help
Volker
PS: the program is a jar file with all libraries/dependencies included
EDIT:
Hardware is an Arduino UNO Board Model R3,and on windows i'm using Arduino 1.0 to program it
Your symlink to /dev/ttyACM0 is double dubious:
Disconnecting+reconnecting or powering off+on might change the number of the dev.
ttyACM usually refers to modems, not to plain USB-serial converters like that used by Arduino (at least those with the FT232 chip). I would expect something like ttyUSB0. For those you also would not need a symlink.
If you installed from the Ubuntu packages you're bound to have problems. I tried this first myself only to find that there are serious issues. I would recommend downloading the most recent version of the IDE arduino-1.0-src.tar.gz.
You'll notice it's the source, I think you'll like it better that way. Or you can get the repository from Git, you'll find that information plus how to build the IDE in Building Arduino, Steps for First Time Setup. Besides the fact that the Ubuntu distribution version is buggy, it's also like old, big time.