Pages

Thursday 13 February 2014

How to call the Swing applications from jsp at runtime.?


Hi,

This example will explains you how to call the swing applications from jsp at Runtime.


Source code:

<%
java.io.File path1=new java.io.File("D:/myapp");
Runtime.getRuntime().exec("cmd.exe /c start run.bat",null,path1);
%>

Explanations:

1) In the given code "myapp" is a folder which contains our swing applications and has been stored in the "D" drive.

2) "run.bat" is a batch file of the Swing applications in myapp folder.


When a user runs the applications(jsp file) then the batch file will be called  at runtime and displayed. Since the user could performs the functionality of the swing applications.



2 comments:

  1. I tried this and i called xxx.java intead of bat file .It ended up by opening the file in notepad. What do i do now?

    ReplyDelete