From 7ecfcad90a3a337c422b1e1e2b3b5c9cd6351305 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Wed, 29 Apr 2015 15:01:45 -0500 Subject: [PATCH] Add batch files to start GUIs under Windows Added a couple of batch files in the java GUI area so they can be used with Windows. Made an addition in TrickApplication.java to add the .bat suffix to script calls when using Windows. Fixes #47 --- bin/java/bat/README | 2 ++ bin/java/bat/sim_control.bat | 2 ++ bin/java/bat/sniffer.bat | 2 ++ bin/java/bat/tv.bat | 2 ++ trick_source/java/src/trick/common/TrickApplication.java | 8 +++++--- 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 bin/java/bat/README create mode 100644 bin/java/bat/sim_control.bat create mode 100644 bin/java/bat/sniffer.bat create mode 100644 bin/java/bat/tv.bat diff --git a/bin/java/bat/README b/bin/java/bat/README new file mode 100644 index 00000000..15b10218 --- /dev/null +++ b/bin/java/bat/README @@ -0,0 +1,2 @@ +The batch files in these directories may be used to start up some Trick GUIs on Windows machines. + diff --git a/bin/java/bat/sim_control.bat b/bin/java/bat/sim_control.bat new file mode 100644 index 00000000..1626253b --- /dev/null +++ b/bin/java/bat/sim_control.bat @@ -0,0 +1,2 @@ +set TRICK_HOME=%~dp0.. +java -cp %TRICK_HOME%\dist\*;%TRICK_HOME%\lib\* trick.simcontrol.SimControlApplication %~1 %~2 \ No newline at end of file diff --git a/bin/java/bat/sniffer.bat b/bin/java/bat/sniffer.bat new file mode 100644 index 00000000..57e54ffa --- /dev/null +++ b/bin/java/bat/sniffer.bat @@ -0,0 +1,2 @@ +set TRICK_HOME=%~dp0.. +java -cp %TRICK_HOME%\dist\*;%TRICK_HOME%\lib\* trick.sniffer.SimSnifferApplication %* \ No newline at end of file diff --git a/bin/java/bat/tv.bat b/bin/java/bat/tv.bat new file mode 100644 index 00000000..7909295a --- /dev/null +++ b/bin/java/bat/tv.bat @@ -0,0 +1,2 @@ +set TRICK_HOME=%~dp0.. +java -cp %TRICK_HOME%\dist\*;%TRICK_HOME%\lib\* trick.tv.TVApplication %~1 %~2 \ No newline at end of file diff --git a/trick_source/java/src/trick/common/TrickApplication.java b/trick_source/java/src/trick/common/TrickApplication.java index d6173a4d..dabfd188 100644 --- a/trick_source/java/src/trick/common/TrickApplication.java +++ b/trick_source/java/src/trick/common/TrickApplication.java @@ -725,12 +725,14 @@ public abstract class TrickApplication extends SingleFrameApplication implements * @param arguments the parameters to pass to the application */ protected static void launchTrickApplication(String executable, String arguments) { + if ( System.getProperty("os.name").startsWith("Windows") ) { + executable = executable + ".bat" ; + } try { ProcessBuilder process = new ProcessBuilder(UIUtils.getTrickBin() + File.separator + executable, arguments); - // TODO: Uncomment these when we move to Java 1.7 again - //process.redirectOutput(ProcessBuilder.Redirect.INHERIT); - //process.redirectError(ProcessBuilder.Redirect.INHERIT); + process.redirectOutput(ProcessBuilder.Redirect.INHERIT); + process.redirectError(ProcessBuilder.Redirect.INHERIT); process.start(); } catch (IOException ioException) { ioException.printStackTrace();