diff --git a/pom.xml b/pom.xml
index 624f4a3..b264cb5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
info.istlab.IoTP
IoTP
jar
- 0.225
+ 0.226
IoTP
http://maven.apache.org
diff --git a/src/main/java/info/istlab/IoTP/App.java b/src/main/java/info/istlab/IoTP/App.java
index b42ba5d..16daa1e 100644
--- a/src/main/java/info/istlab/IoTP/App.java
+++ b/src/main/java/info/istlab/IoTP/App.java
@@ -22,7 +22,7 @@
* Hello world!
*
*/
-public class App {
+public class App implements Runnable {
static String userhome;
static ArrayList iotDirs;
@@ -157,10 +157,11 @@
System.out.println(com);
try {
processBuilder.start();
- System.exit(0);
} catch (Exception ex) {
-
}
+ Thread t = new Thread(Launcher.theapp);
+ t.start();
}
+
}
diff --git a/src/main/java/info/istlab/IoTP/Launcher.java b/src/main/java/info/istlab/IoTP/Launcher.java
index c2178bf..f9ef197 100644
--- a/src/main/java/info/istlab/IoTP/Launcher.java
+++ b/src/main/java/info/istlab/IoTP/Launcher.java
@@ -23,10 +23,11 @@
import javax.swing.event.MouseInputListener;
import javax.swing.tree.TreePath;
-public class Launcher extends JFrame implements MouseInputListener, KeyListener {
+public class Launcher extends JFrame implements MouseInputListener, KeyListener, Runnable {
public static Launcher theapp;
- public static String version = "0.225";
+ public static String version = "0.226";
+ static int reboot_msec = 5000;
// JPanel mainP;
File root;
JTree tree;
@@ -86,6 +87,10 @@
mi.addActionListener(ae -> openExecPath());
menu.add(mi);
+ mi = new JMenuItem("このプログラムを再起動する");
+ mi.addActionListener(ae -> restart());
+ menu.add(mi);
+
mi = new JMenuItem("終了");
mi.addActionListener(ae -> System.exit(0));
menu.add(mi);
@@ -216,6 +221,11 @@
openFolder(App.execPath.getParent().toFile());
}
+ public void restart(){
+ reboot_msec = 0;
+ App.reboot(App.execPath.toString());
+ }
+
public void openFolder(File path) {
try {
Desktop.getDesktop().open(path);
@@ -328,4 +338,15 @@
}
+ @Override
+ public void run() {
+ // wait 5sec and shutdown
+ try {
+ Thread.sleep(reboot_msec);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.exit(0);
+ }
+
}