-3

I tried to open outlook on user pc but because the app in the windows server its run the cmd on the server and not in user pc.

this is the code:

ProcessBuilder pb = new ProcessBuilder();
pb.command("cmd.exe", "/C", "start", "outlook.exe",
        "/eml", resultEmail.getCanonicalPath());
Process p = pb.start();

try {
    p.waitFor();
} finally {
    p.getErrorStream().close();
    p.getInputStream().close();
    p.getErrorStream().close();
    p.destroy();
}

and one more thing when i create the eml file like this:

File resultEmail = File.createTempFile("test", ".eml");

its create on temp directory of the server and not of user pc.

what can i do to run outlook with java and open eml file in user pc and not in the server ?

kfir
  • 732
  • 10
  • 22
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. – Marco Salerno Nov 21 '17 at 15:40
  • what wrong with my question? i gave all the details. – kfir Nov 21 '17 at 15:42
  • Avoid asking multiple distinct questions at once – Marco Salerno Nov 21 '17 at 15:42
  • no i did not its the same question but multiple code lines – kfir Nov 21 '17 at 15:43
  • You should give more information. So you have a Java application running on your server machine. Is it a Tomcat for web apps? How do you access the server application from your client machine? Is it per browser or another Java application or what? – vanje Nov 21 '17 at 15:56

1 Answers1

1

Consider jcraft.jsch. Note Windows needs Ssh client (like Putty).

Once you'll be able to ChannelExec.connect on the remote machine, Outlook will take the eml file from there

ShaharT
  • 442
  • 5
  • 13