This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to determine if a screensaver is running in Java?
is there any way you can find out if the screensaver is active with java? I've searched the web but the only things I found was very complicated native code... My program is made for windows only.
Java cannot handle system tasks directly.
You should use JNI (Java Native Interface) or JNA (Java Native Access) to do it.
I haven't tried this code, but they claim to answer your question with JNA as Ammar suggested: Screen Saver State.
Related
This question already has answers here:
How can a program control another program?
(11 answers)
Closed 8 years ago.
I wonder is possible to make a bot writen in JAVA, which will open some program(program is under windows), click on the button in this program and type some data, check status of this program(login or logout, this is client for online game).
Which JAVA tools I need ? I think that java robot lib is not enough for this.
Thanks in advance.
You cannot do this using JAVA.
JAVA is a language which is loosely coupled with operating systems, so it can only receive mouse/key messages from underlying OS. Among all the tasks you mentioned , it can only start the program by using Runtime.execute.
If you want to implement a software like this ,you should use Visual Studio and use Microsoft technologies.
This question already has answers here:
How Do I Eject a Volume in Java?
(2 answers)
Closed 3 years ago.
I know that questions like this have been asked before, but I couldn't find any more recent ones and I have a twist to my question.
I've developed an application in Java that is designed to run on removable media, and work on both Windows and Mac. I would like to add a button to safely remove/eject the device, if it is supported (i.e a USB drive). Is there a command line for each operating system that would allow me to do this?
I know that it can be done by an application running on the device to be ejected, because I've seen one that does it, but obviously I understand there are certain limitations to Java.
Thanks in advance
This is something that you will have to do by invoking an auxiliary application. These applications are not platform independent as you wish. So, to do that, find out which OS you are on by using System.getProperty("os.name") and invoke the appropriate command for the detected OS. Invoking applications is done with Runtime.getRuntime().exec(). Search for the commands you need for each OS.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Reading and Writing to a DVD/CD - Java
Is possible to build/code a burner software like Nero in JAVA Only ? ... How do that ?
That's will be great if it's possible !!
Thank you
No. Java does not have direct access to the hardware from pure Java code. You'd have to use native code loaded via JNI calls.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
how to call java function from c++?
Can C++ call Java code?
I have a native application on Linux (i.e. main() is in C++) and I want to reuse some of my Java code.
Can I load JVM libraries and somehow call Java classes?
Thank you!
You can load the JVM in your native application and invoke stuff using the Invocation API
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Using a java class from Delphi
I wrote a program in Delphi 5 years ago and I am now revisiting it. Is it possible to write a class in Java and then use it as a component in the Delphi 5 program? If so what is the best way to approach the problem?
The only way I can think that might work is creating an Applet in java and showing it on a web browser component from Delphi. But I don't know how can you access properties from this applet.