Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I'm trying to write a java application that accesses the usb ports to read from and write to a device connected through usb. The problem I face is that I don't know what exactly to use in java to do such a thing. I searched online and found something called JUSB but all the posts seem fairly old.
Currently I'm using the RXTX libraries but I sometimes run into some sync error. When I use C# to do the equivalent it requires far less code and I don't face any of the same sync error.
My question is, is there anything built into the latest version of the JRE I can use to access the usb ports (that is just as easy as the equivalent C# code)?
Been using usb4java for a year on cross platfom (Linux and Windows) and it works great.
See:
http://usb4java.org/
They are very active and have a very good javax USB front.
There is nothing equivalent to C#'s USB support in Java. Both jUSB and Java-USB are severely out-of-date and likely unusable for any serious application development.
If you want to implement a cross-platform USB application, really your best bet is to write an abstract JNI interface that talks to Linux, Mac and Windows native libraries that you'll have to write yourself. I'd look at LibUSB to handle Mac and Linux. Windows, as you've seen, is pretty straightforward. I just came off a year-long project that did just this, and unfortunately this is the only serious cross-platform solution. If you don't have to implement on Windows and your needs are limited, you may get by with one of the older Java libs (jUSB or Java-USB). Anything that needs to deploy on Win32/Win64 will need a native component.
You might want to have a look at usb4java - http://usb4java.org/index.html it appears to support Windows, Linux and Mac OS's and appears to be reasonably current at the time of posting. Is unfortunately under the LGPL so may not be suitable for commercial development.
See the jUSB or usb4java libraries.
The Java Communications API. This should provide similar functionality to the C# System.IO.Ports namespace.
If you're on a mac, USB's can be accessed with the /Volumes/ directory.
Example:
You want to write to a file in "Drive", so the filepath would be:
/Volumes/Drive/file.whatever
Not sure how it's accomplished on other platforms, but this is the simplest way I've found on a mac
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I know that Android uses Java but not a fully compatible runtime library. Creating UIs in Android is done completely different than for normal Desktop Java. Nevertheless that's a really stupid thing in my opinion, very much Java applications out there have to be rewritten for Android (instead of modified only slightly).
So my question: is there some kind of (3rd party) Swing-library available for Android? Means a Java-package that contains Swing-compatible classes so that an existing Swing-Application has to be modified only slightly? It of course can't be 100% compatible but modifying some things that do not exist on Android is much less work than rewriting the whole GUI-part...
There is no way you can use swing in android, because android is not based on JavaSE, while swing is. android uses a special java that is designed to run on DVM .
Even if their is no compatibility issue. Swing is used for desktop apps which differ in their UI completely from mobile apps.
So given the above points unfortunately you will have to rewrite the UI again for your software. but on the bright side, android's UI is very simple and fun to work with.
give it sometime and good luck!
Edit:
Comparison between Java SE and Android's Java
CodeNameOne?
Supposed to be very similar to Swing.
Also, in my experience, GWT is somewhat similar to Swing.
Either of these will require a rewrite from Swing though.
There is no Swing on Android. You can always develop a JME application and run it via emulation, but that's as close as it gets. Unfortunately, in technology, things change all the time, so for programmers, it's a case of "adapt or die."
Unfortunately, as far as I know, Java Swing Desktop Apps can't run on Android (Dalvik VM), but the good news is: JavaFX as a successor to Swing GUI technology has already been ported to mobile and embedded platform (e.g. Android). If you're interested in this, go http://gluonhq.com/products/mobile/javafxports/ for details.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there any active Java remote desktop application including sourcecode or a library for integrating into Java applictions?
The problem is that ultravnc, realvnc and tightvnc are not available (opensource) for Java, just sometimes a viewer.
It should be in plain Java code so it runs on all platforms.
edit: It might not be possible to make it just with Java, but in times of better GPUs and CPUs it might be better to use some libraries which add support for multithreading, like CUDA, OpenCL and Rootbeer (https://github.com/pcpratts/rootbeer1)
Nobody ever tried to implement a VNC server in Java because Java has no (fast) API to examine the desktop for changes. If you can live with 1 fps or less, you can use the Robot API :-)
So all you can get is a VNC client/viewer. I experimented a bit with TightVNC because it's free and the sources are available.
I remember on a Java-Applet connectable to RealVNC, but it wasnt opensource, the compiled sources are obfuscated so i cant uncompile.
You may be able to ask for the Source.
Take a look at http://www.realvnc.com/products/vnc/documentation/4.0/win/java
Java is an high level programming language, VNC is programmed in Low-Level Programming language. You may be able to find a Solution with jni-combination of Java and any other low-level Programm!
But not in plain java.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
i was just wondering if anyone knew of a portable java IDE/Compiler? Something like an iPod but not so advanced, that let's you work with and compile java?
Just thought it would be a cool idea :P
This serves the purpose. We can compile the programs without requiring Java compiler on our machine.
There is an IDE for Android which supports this, see AIDE
Search for drJava. Is a pretty complex editor and includes a(n Eclipse) compiler.
Unfortunatelly, the project seems to be dead.
If you have an iOS device (iPhone, iPod touch or iPad) at hand, you can jailbreak it and install Java from Cydia. This gives you the compiler and the VM. However, it's old and limited to command line functionality.
You can use http://ideone.com/. This is a website for compiling and running java applications Here you can create an account and save all your example programs, which you can later refer from different location or even share it with others.
You can also practice other computer languages in it. It supports more than 40 programming languages.
Have you given any thought about using codenameone platform? http://www.codenameone.com/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
I need simple modbus Java library with source code. I found on google but there is .jar file and doesn't have strong using manual. Can anybody suggest me modbus library with using manual or source code ?
You can try Jamod. I never used it, but a colleague of mine used it sometime ago and he was pleased with it.
Try this one:
http://sourceforge.net/projects/jamod/files/jamod/1.2/
By the way, you can use JDGUI to see the sources of any jar file.
FieldKit is paid and open source, and haves support for several languages including Java
jModbus Project
j2mod is a fork of jamod
If you are using Modbus RTU (Serial) Java Communications API is needed; stolen from FieldKit documentation:
The Java Communication API is available from different sources:
Sun Microsystems is publishing versions for the Solaris and the Windows platform at http://java.sun.com/products/javacomm/.
Keane Jarvi publishes a LGPL licensed Linux and cross-platform COMM API at http://www.rxtx.org/.
An excellently performing package for a large variety of platforms is the SerialPort package from Solutions Consulting at http://www.serialio.com. Using this package, poll cycles of less than 10 ms can be achieved!
Perhaps jSSC is a good javax.comm implementation too.
There is another one recent solution modbus4j.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Java process control is notoriously bad - primarily due to inadequate support by the Java VM/JDK classes (e.g. java.lang.Process).
I am wondering, are there any good open source libraries out there that are reliable.
The requirements would be:
OSS
Start/Stop processes
Manage STDIN and STDOUT
cross platform (at least Linux,
Windows, Solaris, HP, and IBM in
that order)
(optional) restartable
(desirable) mature
How about Apache Commons Exec?
Java Service Wrapper might be what you're looking for. It's cross-platform, can be used to start things as a Windows service, capture IO, and generally completely manage any java app. It's very light weight and well designed. Atlassian uses it to wrap their products (Jira, Bamboo, etc), so it's battle tested.
One more requirement... cross platform support for killing of an orphaned process. With java.lang.Process (and Apache Commons Exec), there is no way to kill external processes when the Java application does a hard stop (kill -9). I'd really like to find a library that can handle the problem better.
One solution may be to store PIDs in some resource on disk, and then kill the processes on restart of the Java application. Of course, this would be platform dependent, so good a cross platform library would be fantastic.