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 :: list of lists java 
Java :: java image draw 
Java :: android studio change title bar text 
Java :: view binding in recyclerview adapter android java 
Java :: convert date to offsetdatetime in java 
Java :: java get number of threads 
Java :: Why should we mention a method throws some exception/s? 
Java :: convert base64 to image png without saving 
Java :: localdate java 
Java :: how to summon lightning in minecraft 
Java :: unprocessed continuation reference(s) remaining name 
Java :: java read directory 
Java :: java string remove character 
Java :: java stream distinct by key 
Java :: max of an array java 
Java :: return the maximum sum of two numbers whose digits add up to an equal sum 
Java :: set ImageView size programmatically android 
Java :: permutation array java 
Java :: convert arraylist to array in java 
Java :: How to determine if a graph contains a cycle, in Java? 
Java :: how to assert that an exception is thrown java 
Java :: Unhandled Exception: PlatformException(error, java.lang.IllegalStateException: Trying to create a platform view of unregistered type: plugins.flutter.io/webview 
Java :: java read next line 
Java :: print list of map java 
Java :: fill two dimensional array column by column java 
Java :: java calendar add minutes 
Java :: abs in java 
Java :: get length of a string java 
Java :: change color of drawable android studio 
Java :: dequeue in java 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =