Request:
This is a very common problem faced by Java devs in my locale. I am really stuck for many days on this. Searched and tried a lot, read the docs. read ALL the stackoverflow questions related to JavaExe. Please only reply if you have done similar thing before and have a comprehensive answer. I would be really grateful to the community!
Senario:
I am using JavaExe to run an application as system service in desktop interactive capability. To be exact I have an application that captures screenshots of desktops. I want it to run (as admin) on any user login so no one can stop it.
I have a myapp.jar, settings.txt and a lib dir.
I have searched alot and found JavaExe works (by watching its examples)
If anyone has a better way. Please state so.
Problem:
According to my research,
you must create a .properties file that has named like the .exe, and write
"RunType = 1"
in this file.you define a static method in your main class :
serviceInit()
Do I need to place any class or reference/import? How?
Edit:
My code below works as stand alone .jar and in javaExe.exe too.
It now does makes a system service and runs by as SYSTEM user. but It is NOT interactive to desktop. i.e its not showing any GUI.
package temp;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
public class Temp {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
serviceInit();
}
public static boolean serviceInit(){
new Thread(){
public void run(){
Integer i = 0;
while(i < 999999999){
JOptionPane.showMessageDialog(null,i);
i++;
}
}
}.start();
return true;
}
}
And I dont think that bundling the .jar, lib directory and settings.txt into one .exe is possible?