I have a Vex ARM Cortex-based Microcontroller and a Raspberry Pi B model, so I had the idea of having the Microcontroller send information through the UART Ports to the Pi. I have everything working on the Microcontroller's end since can easily test that it reads and writes to itself, but my trouble comes in when I try to program the Pi. I am using Java to write the program and I am also using the Java rxtx library. After I got a simple program that would test the ability to send and receive things I tried to run it and got the UnsatisfiedLinkErorr: no rxtxSerial in Java.library.pathwhich I fixed by going in and editing the native library location to the one for mac, as I am writing this on a mac. I then run it on my mac and it gets to the point of it seeing that the tty that I gave it was used or something along those lines, which is good since that means everything ran correctly. However, when I go to Pi it does not work and I get the same error UnsatisfiedLinkErorr: no rxtxSerial in Java.library.path, so I think that it is the native library location not being for linux, but I do not know which machine type I should use since there are three to choose from, if that is even the problem.
Related
for a school project I recently bought an Orange Pi +2 hoping to use it to control a few electronics with the GPIO pins. I have many years of Java experience so I naturally wanted to write my code in that language. When trying to install pi4j which is a java library for raspberry pi I get this error:
mackenzie#OrangePI:~$ sudo java -jar LCD.jar
sudo: unable to resolve host OrangePI
Unable to determine hardware version. I see: Hardware : sun8i,
- expecting BCM2708 or BCM2709. Please report this to projects#drogon.net
I was wondering if anyone had any ports for the Orange Pi and if not I will have to write my program in C. I am running Debian 8 jacer 2 as the os.
Experimental support for OrangePi is now included in the latest Pi4J v1.2-SNAPSHOT builds. Please be aware that this is largely untested at this time. Feel free to try it out and report issues to the project.
I'm afraid that the WiringPi port for OrangePi (WiringOP) may be slightly outdated and may not support the newer/latest OrangePi hardware models, but more testing is needed to confirm which models are working.
I saw this post that may help you : https://groups.google.com/forum/#!topic/pi4j/T30EUL2Z10I
As I do not own this device, so I cannot verify by myself.
For Raspberry Pi there is the well-known wiringPi library, written in C, for GPIO access and control. This library has been ported for the Orange Pi. The port is called wiringPO. I wrote a simple Java class with a native method. The native method gives me access to the wiringPO library, and I use JNI to allow my java application to interact with the native method. Works like a charm.
Add the line:
GpioFactory.setDefaultProvider(new OrangePiGpioProvider());
before getting instance: gpio = GpioFactory.getInstance();
the problem is with every orange pi, the problem is with resolv.conf in /etc/resolv.conf.
do
sudo nano /../etc/resolv.conf
and then add
nameserver 8.8.8.8
to it
and control-o to save it
I'm building a simple gui in Java that has three selections which I'm going to place on the RPI. Depending on the selection, I need the RPI to output differing signals to a separate microcontroller that will
determine the operation of a larger mechanical system.
I can't seem to find anywhere that explains how to get a Java program to send output signals from an RPI based on user selection. Any and all assistance and guidance would be much appreciated.
Java code is run on a virtual machine which in itself will have no interface for controlling Raspberry Pi GP I/O pins. You will have to use a separate Raspberry Pi -specific native library, which you might be able to access through the Java Native Interface. Luckily the work seems to have been done for you, as a Java library like this exists.
Well what I am trying to do, in the long run, is to change some LAN properties when the an ethernet cable is connected to a computer.
I want to run my Java program each time a LAN network is detected. I found a couple questions as to how to do this in C++, but nothing related to Java, specifically. Would this just involve the way I distribute my final application? As in, I could use Jar2Exe Wizard to package my Java program as a Windows service and then just figure out how to run that at startup. But is there any way to do this within the Java program itself?
Don't know what your specific need is but you could try this. This shows how to run windows commands from inside java so you wont have to create an external batch file.
How to Execute Windows Commands Using Java - Change Network Settings
Also check out this answer which talks about retrieving network name in java. then you can combine both!
How to get the wifi network interface name in java
Ultimately I would like to use a Java program to send and receive messages from a phone that I have plugged in via USB. I can do this using a C# program, however the program I want to send and receive messages is written in Java. To do this I am using the Rxtx library (but using the Windows x64 compiled version from Cloudhopper). But whenever I try and send any commands to the phone via USB my computer completely locks up and I have to hard-restart it.
The code I am running is here: Two way communication with the serial port. I think that it successfully establishes a link since it gets to the stage where it accepts input from the console, though when I press enter, and the input is sent, the computer locks up.
I am running Windows 7 x64, using Eclipse. Thank you for any help.
A little hard to tell from the code, but here are some debugging tips:
Try stepping through the code with the debugger line by line, and step in to the library itself to see if you can find the problem.
Instead of reading/writing from the console, try sending character codes programmatically. The console operates very differently from direct access. i.e. instead of System.in.read()) just try passing in a known good String.
Keep in mind that Java works with UCS-16 internally, but that consoles typically work with different character encodings (e.g. cp1252 for Windows). So, your "enter" may be a completely different character from what the system is expecting. If your device is expecting ASCII 13 and your keyboard is generating ASCII 12, that could be enough to confuse things.
The crash makes it seem very likely that there is something going on with the native library. If you find that the Java debugging keeps dropping you into the JNI boundary, you may need to debug with a C/C++ toolset.
Good luck!
I'm having a problem that, at this moment, I don't even know how to investigate properly. Any recommendations on how I can get more information are welcome and appreciated.
My company sells a product with a WinXP PC at its core. One of the product's tasks is being able to start a video player on demand -- VLC, in this case. (To be specific, VLC 0.8.6d; it's several years out of date, but upgrading is problematic for a few reasons.) The application responsible for starting the player and performing many, many other tasks is written in Java.
I have a test rig sitting next to my desk. It used to work just fine. But for some reason, it now gives a "Send Error Report" window when the Java app tries to start VLC: "VLC media player has encountered a problem and needs to close...." You know the one.
Clearly, I've done something that buggered things up. Problem is, I know neither what it could be nor how I would go about fixing it.
Stuff I know:
It's not a code bug. I run the same software on my development desktop machine, and it doesn't have this issue.
It's not the VLC install, nor is it a malformed video file. When I capture the command used to start it from Java and manually enter that command from a "cmd" window, it works fine.
It's not that sneaky bastich bug where Java punishes you if you don't manually drain STDERR and STDOUT when making a system call. I've got that covered.
I'm not getting any error messages or output when it fails; it just fails and gives me that pop-up window.
I'm stumped. Recommendations for either what it could be or how I can figure out what it is are very welcome.
Well, I’m not familiar with java and VLC, but I would do the following things:
Check that you have identical java virtual machines in both of your desktops. Just in case…
Check the process’s environment variables. They depend on parent process. Maybe VLC uses some of them.
Try to debug crashing with native debugger like WinDbg. Perhaps the call stack will give you more ideas.
Good luck!
My suggestions:
Create a simple java app that just launches VLC
Use your app to launch a simple command line windows program
Use your app to launch a complex program
Check to see if there is a memory constraint issue. Is VLC getting too little memory to run?
This really sounds like a memory/environment issue.
A number of things I would try
Make Sure both test and development machines are identical in every respect, the operating syste(if possible installed from same OS Disk), same JVM version, same memory allocation to JVM (you know those -X-ms stuffs). My fear is not with Java/JVM per se, it is with windows.
Make sure you can lunch for example Notepad from a Java app, and then something like Windows Media Player or MS Word.
Try and launch other versions of VLC to see if it is a VLC version problem.
Finally try and wipe the test box and re-install it(with Windows, you can never tell, a fresh installation might just do it!!)