This question already has answers here:
Running a Java process in Windows even after the user is logged out
(5 answers)
Closed 2 years ago.
I execute jar file on double click but it stops running as soon as I log out. What I have to do to make it keep going unless I shut down system?
It might be possible that, in your jar file it is written that on logout system.exit(0) or any other logic will be called.
Related
This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 3 years ago.
I have created a java application to connect to a MySQL database. Once through the program install creator, I created a .exe .
This executable runs, and the first form is login. When he tries to access the database to confirm the details of login gives this error.
java.lang.NullPointerException
Someone can help me solve this? The path is correct because if run the .jar the application runs normally.
I apologize for the inconvenience.
enter image description here
Only have this to try to explain better my question :S
I'm so sorry... I'm running an executable version from my java application.
We will need more information than this, some things that you can provide that would be helpful are...
Your packaging tool (what you use to get from jar to exe)
Code
A stack trace
This question already has answers here:
How to get the current working directory in Java?
(26 answers)
Closed 7 years ago.
I know the title is a bit vague, so let me explain my explanation in more detail:
I have a Java application
I want to access the directory of my application on the clients computer, to store text-files.
My problem:
How can I find the file/directory of my application on the clients computer in the first place? On different platforms, file directories are different, and the client can put the application on which folder they want.
Is there an easy way to do this?
Thanks
I think you are looking for the User's current working directory https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#getProperties()
String dir = System.getProperty("user.dir");
This question already has answers here:
Run a command in a shell and keep running the command when you close the session
(9 answers)
Closed 7 years ago.
I have my spring boot application, I normally work with wars that I deploy on tomcat, but I want to try this way a little bit more.
My problem is that when I deploy it in a server, and I do
java -jar target/myproject.jar
Works pretty fine, but after a time without use, the shell gets disconnected and soon after it (I believe because the shell) the process stops.
Any idea how to deal with this?
I am using Debian.
Thanks.
Basically, create a .sh file and set it on /etc/init.d/YOURFILE.sh with the info of this post
Run a Java Application as a Service on Linux
Later just make a /etc/init.d/YOURFILE.sh start and thats it..
This question already has answers here:
How to force stop my android application programmatically?
(7 answers)
Closed 5 years ago.
Help me!
I need the source code to force stop an Android application programmatically.
I already tried
Process.killProcess(int pid))
but it didn't work
Thank You.
Three ways to stop a process from java
1.kill directly
Process.killProcess(Process.myPid());
2.send SIG_KILL
Process.sendSignal(Process.myPid(), Process.SIGNAL_KILL);
3.the unfriendly way, terminate the vm
System.exit(0);
This question already has answers here:
How to run Java code using Java code?
(4 answers)
Closed 8 years ago.
So I have a java program of a game. I want to have a different program and when you click on a button there that java program closes and starts the program with the game. But I have no idea how I can do that, so can anyone help me?
Using ProcessBuilder.The following is a reference,maybe not work.
ProcessBuilder pb=new ProcessBuilder("java","-jar","Test3.jar");
pb.directory(new File("F:\\dist"));
Map<String,String> map=pb.environment();
Process p=pb.start();
Create a runnable jar.
call the runnable jar on button click.
Exit from the current program.