Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java restart program

// Credit: https://stackoverflow.com/users/246263/veger
public void restartApplication()
{
  final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
  final File currentJar = new File(MyClassInTheJar.class.getProtectionDomain().getCodeSource().getLocation().toURI());

  /* is it a jar file? */
  if(!currentJar.getName().endsWith(".jar"))
    return;

  /* Build command: java -jar application.jar */
  final ArrayList<String> command = new ArrayList<String>();
  command.add(javaBin);
  command.add("-jar");
  command.add(currentJar.getPath());

  final ProcessBuilder builder = new ProcessBuilder(command);
  builder.start();
  System.exit(0);
}
Comment

restart java windows

There is nothing like a JVM running in an OS. 
Instead several independent instances do run. 
Just make sure to stop all running Java
applications (java*.exe) and restart them if necessary.
Comment

restart java windows

The Java process runs on demand as and when you want to run it. 
It's not a daemon. You need to stop the Java process manually 
(kill it) if it doesn't end gracefully.
Comment

PREVIOUS NEXT
Code Example
Java :: stringbuffer in java 
Java :: java what is at 
Java :: how to loop through arraylist of objects in java 
Java :: get index of element java 
Java :: java indexof all occurrences 
Java :: insertion sort in java 
Java :: HOW TO PARSE a string into a number in java 
Java :: how to add string to array in java 
Java :: antialiasing kjava 
Java :: does constructor return any value java 
Java :: synchronized block java 
Java :: pre increment and post increments 
Java :: first character string number java 
Java :: java android development find element by id 
Java :: how to run java files 
Java :: java clear string buffer 
Java :: java types of list 
Java :: in java how to compare two strings 
Java :: java mcq 
Java :: how to compare strings java 
Java :: room library android 
Java :: how to create folder java 
Java :: create a hashmap 
Java :: -3 to string in java 
Java :: reverse negative number 
Java :: tableau deux dimensions java 
Java :: java multithreading 
Java :: codepointat java 
Java :: parcourir un string java 
Java :: iterate over multi array java 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =