Runtime.exec()

73 views
Skip to first unread message

Ckl...@gmail.com

unread,
May 14, 2007, 12:26:38 PM5/14/07
to Google Web Toolkit
I develop a Widget with gwt and I need to execute a perl script. To do
this, I see that the Java command is like this : Process proc =
Runtime.getRuntime().exec("commande paramétrée");
But this command needed a call to IoException.
How can I do this with the gwt library ??

Thanks for your help.

krispy

unread,
May 14, 2007, 12:36:13 PM5/14/07
to Google Web Toolkit
Cklaure,

You don't need the GWT library to do this - it happens on the server
and is only limited by the Java Runtime. If you want to run a Perl
script on your server, then run it - GWT's function is to handle
client side javascript along with RPC on the server. If what you mean
is you want to run a CGI script when you click on your Widget or
something, then make a request to that CGI script from the client
(because on the client you can't use Java's Runtime). Did this answer
your question?

-krispy

Ckl...@gmail.com

unread,
May 14, 2007, 1:22:44 PM5/14/07
to Google Web Toolkit
Thanks a lot for your answer and your rapidity. I will try this
solution what means make a request to that CGI script from the client.

Laure

krispy

unread,
May 14, 2007, 1:56:00 PM5/14/07
to Google Web Toolkit
Yeah - to do the client request like that, you could use the
HttpRequest, but people seem to prefer the RequestBuilder class.

http://code.google.com/webtoolkit/documentation/com.google.gwt.http.client.RequestBuilder.html
http://code.google.com/webtoolkit/documentation/com.google.gwt.user.client.HTTPRequest.html

The reason you can't call any Java class in a Widget is because GWT
compiles your Java code to Javascript, and so it limits how much of
the Java API you can use. On the server, though, you can do anything
you want - I don't dabble in the CGI stuff, but if you search this
forum you can probably find more specific instructions on how to do
that. Basically, it seems to me like you should just be able to put
the URL into the RequestBuilder and get the response, then use the
response in your Widget. Glad to help out with what little I can!

-krispy

Ckl...@gmail.com

unread,
May 15, 2007, 11:49:14 AM5/15/07
to Google Web Toolkit
Thanks a lot but I decided to use ajax request to do like I want.

Reply all
Reply to author
Forward
0 new messages