private void createSessionWC3270(String sessionParms){ ProcessBuilder p = new ProcessBuilder(); File tempFile = new File("C:\\Program Files\\wc3270\\"); System.out.println("1: " + tempFile.getAbsolutePath()); if (tempFile.exists()){ Thread openConsoleT = new Thread(new Runnable() { @Override public void run() { try { System.out.println("powershell \"& '" + "start cmd.exe /C \"C:\\Program Files\\wc3270\\wc3270.exe\" " + sessionParms + "'\""); Process p = Runtime.getRuntime().exec("powershell \"& '" + "C:\\Program Files\\wc3270\\wc3270.exe " + sessionParms + "'\""); } catch (IOException e) { e.printStackTrace(); } } }); openConsoleT.start(); }else{ tempFile = new File(("C:\\Program Files (x86)\\IBM\\wc3270\\")); if (tempFile.exists()){ Thread openConsoleT = new Thread(new Runnable() { @Override public void run() { try { System.out.println("powershell \"& '" + "C:\\Program Files (x86)\\wc3270\\wc3270.exe " + sessionParms + "'\""); Process p = Runtime.getRuntime().exec("powershell \"& '" + "C:\\Program Files (x86)\\wc3270\\wc3270.exe " + sessionParms + "'\""); } catch (IOException e) { e.printStackTrace(); } } }); openConsoleT.start(); } } // Process p = Runtime.getRuntime().exec("powershell \"& '" + "wc3270.exe" + sessionParms + "'\""); }