0

I developed a Java program that open specific files when the user clicks on a Jlabel. The click event worked very well on my computer but after I package it to Jar distributable and install the software on another computer the program installs perfectly but does not open the linked videos when I click on the Jlabel. Below is the code I used after adding a Jlabel and a mouse click event on Netbeans . . { . . . try . . { . . . Runtime. getRuntime(). exec ("rundll32 url . dll, FileProtocolHandler "+" C:\users\abj\netbeans \lessons \src\vidz\vid1.mp4"); . . } catch (Exception e ) . . { JOptionPane. ShowMessageDailog (null, "Error" );

With the above code the program runs perfectly in my computer but after packaging to jar distributable and install in another computer the click and open video function when does not open the file and does not return any form of error either.

Please what can I do to resolve this issue. I need all the help you can give.

Thanks Goddy.

Goddy
  • 11

1 Answers1

0

https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exec%28java.lang.String%29

exec

...

Throws: SecurityException - If a security manager exists and its checkExec method doesn't allow creation of the subprocess

IOException - If an I/O error occurs

NullPointerException - If command is null

IllegalArgumentException - If command is empty

So just because the string that you pass fails (on the os) you don't get an error. You have to work with the returned process object to see result and things like that

user3252497
  • 121
  • 4
  • Am sorry your answer did not solve the problem... How will what you posted make the softwares run properly on other computer aside mine. – Goddy May 01 '16 at 16:53
  • get the output of the process and check it against expected, http://stackoverflow.com/questions/5711084/java-runtime-getruntime-getting-output-from-executing-a-command-line-program don't use hardcoded paths either might be good – user3252497 May 01 '16 at 18:20