I'm creating a tool for importing and exporting configurations for the Non-Sucking Service Manager (nssm). The tool itself will unfortunately be proprietary, so I can't show you the full code, but the problem I'm facing is showing in the short program below.
Set-up
Windows 7, java 7, java 8, nssm.exe (ver 2.24) in the same folder as you're executing from.
The Problem
When running nssm.exe from powershell it prints the help output to the shell. If nssm.exe is double-clicked it will instead show a window with the same output. If I run the code below with java 7 it will seem as it will do nothing, but it will actually print the output to stdErr (this is the wanted behaviour, I can then use it in the full version of the code). The problem is: when the exact same code is run with java 8, it will start nssm.exe as if it was double clicked (and in that case not do any output to stdErr).
Clarification
Since the only thing I'm doing is swapping java version I assume that there problem lies in there. Nssm is just used here because it's where I encountered the problem. Even though nssm might do something funky or I'm not using it as intended, it is not meant to be discussed here.
The Question(s)
1. What causes this difference?
2. How can I make java 8 behave like java 7 in this case?
The Code
package mypackage;
import java.io.*;
/**
*
*
*/
public class App
{
public static void main(String[] args) {
String execString = ".\\nssm.exe";
Process process = null;
try {
process = Runtime.getRuntime().exec(execString);
process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
process.destroy();
}
}
Best Regards,