Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am beginner in Java. I have a USB stick with some information stored.
I want to write Java code on Linux platform. After inserting USB stick in Linux machine, I want to mount USB stick in Java code and read the USB Stick content.
I need help to write Java code to Mount USB Stick and read the USB content.
After spending some time I got to know that Shell Command is the best way to execute in Java.
I need help to write Shell command to identify the Mounting Location in Java.
Thanks,
Manoj
i know this wont be helpful but... WHY?!?!? lol
also i don't know any thing about java, but i did find this:
Want to invoke a linux shell command from Java
i suppose if you're asking how to find the usb device and mount with a linux command... you're going to need to watch DMESG or log/messages or log/syslog depending on distro...
i dont know, i hope this points you in the right direction...
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 months ago.
Improve this question
I have found a Java application repository on GitHub which provides the application in JAR format and in the native binary format for different operating systems such as MacOS, Windows, Linux.
I am able to execute the JAR file using the java -jar command but I would like to run the native binary file so users can execute it without installing the Java in their system.
Can someone please inform me how can I run the binary file on Macos? I tried to search and found the command chmod +x name-of-binary but this command does not do anything.
I am really new to this and do not have much idea about this so any suggestion would be really helpful.
The most simple way would be to either open a terminal and manually running the binary, like so:
./<name-of-file>
This would only work if you are running the file in a user who has execution privileges on that file. if you run into trouble with priviliges, that's where I would use chmod.
If you need any more specific help, I would recommend posting the link to that GitHub repo for us to look at, and telling us what is it that it should do.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I've searched for similar questions, but despite there where a lot with a similar title all have asked something different.
In my case I want that my java program interact with the terminal (Windows) by writing command and reading the response.
I've found the class ProcessBuilder, but does not seem that do what I want
What I' m searching for is something so:
start the cmd at some given position (like C:\Users\federico)
issue a command (dir or cd desktop); this should not open a command prompt window
read any output that command may result in
and so on, up to the user's exit from the program.
I suspect you simply don't know the English terms for this: what you're looking for is a way to execute commands in the OS, which is called "exec" in every programming language I know of, including Java: https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec(java.lang.String)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm writing an application in java. In order to work my code properly, I want to check whether several software are installed. (This should be done in the java code itself.)
How can I do that?
This is a Linux system.
There are similar questions, but not exactly what I want.
Check if a program is installed on a linux machine from a java applet
There is no universal way of doing it.
You can use one of following approaches
Use java bindings for particular package manager for your platform if they exist.
Use one of the system tools like locate, whereis, etc. (which you didn't like)
Implement your own installed package detection, according to your requirements
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Can you program external application from Java app.?
I know this is a wierd question but lately I really need to do it.
So the lets say I have "VLC" player or MPC or whatever it is, I want to be able to create a Java/C++ application or whatever it is to control the application such as play the video, pause the video and stuff.
If it possible please let me know and how.
It's certainly possible with VLC. Look here: http://wiki.videolan.org/Java_bindings as well as here: how to control VLC by java
For MPC, I don't know of any resources that can be used to do so. You can at least launch it to the best of my knowledge.
To start (execute) an external application you should use Runtime.getRuntime().exec(params);
or ProcessBuilder class.
http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html
See Execute external program in java for more information.
To send key strokes to another application you could use the "Robot" class (http://docs.oracle.com/javase/6/docs/api/java/awt/Robot.html).
What is expected is to have access to interface to do these operations, you can get some references from http://caprica.github.io/vlcj/
This is java api for controlling the VLC instance embedded in AWT.
I have found this site that describes how to run external programms from java
http://www.rgagnon.com/javadetails/java-0014.html
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
I'm looking for a programmable remote control for a Windows or Linux host machine. By programmable i mean i have ready to use (preferably Java or .NET) API for receiving key press events from the remote control and being able to write my own custom behavior logic.
Does anybody know if something like that exists and where to obtain one ?
You can find quite a few remotes supporting LIRC/WinLIRC at their site or here.
As for Java API support for LIRC, try here.
Yes, they exist. Just put ssh on your smart phone. You can ssh from your smart phone to the host machine.