|
 |
j2ee thread: Runtime
Message #1 by "Aling Yu" <ayu@d...> on Mon, 14 Jan 2002 17:38:27
|
|
Ah, sorry. I presumed since this was a J2EE list that you were talking about
server-side java. My bad. I'll have to leave it to others to address this
idea of using the java runtime to determine the status of other opened
netscape windows.
/charlie
-----Original Message-----
From: Aling Yu [mailto:ayu@d...]
Sent: Monday, January 14, 2002 10:18 PM
To: Java 2 Enterprise Edition
Subject: [j2ee] RE: Runtime
Thanks for the reply. But I am not talking about popup another window from
existing netscape.
What I am trying to do is calling a shell script, which check if there is
an exsiting netscape window:
if yes, go to it and open a new URL, -- this is OK
if no, open a new netscape window with the URL -- this failed.
I found my workstation launched "netscape", tried to open a child process
for netscape window and failed. I am running my java prog on my
workstattion and apprently my java prog get all my environment variables
from the Runtime. I can call any other programs but netscape.
Any new idear will be appreciated.
Process prcs = rt.exec("wp 123456789012");
#!/bin/csh
#csh file wp
set
URL="http://nos40el/cgi-bin/devtec/welldata/WP.cgi?api=${1}&format=FRAME&sor
t=api_num&prof=Default&rptName=Sct)"
if ( -e "$lock_file" ) then
echo "remote OpenURL"
$exe -remote "OpenURL($URL)"
if ( $status == 0 ) then
exit 8
endif
endif
/bin/rm -f $lock_file
/usr/local/apps/bin/netscape "$URL"
exit 9
> You're trying to control client-side behavior from a server-side runtime
> instance. To quote Mr. Spock, "That's not logical". There are many ways
to
> get a window to pop up in the browser, depending on your intention for
the
> window. While JavaScript is one obvious choice, you can also have a FORM
tag
> open its action in a new window using the TARGET attribute. There are
many
> other possibilities (A HREF also supports a TARGET, for instance).
>
> /charlie
>
>
> netscape window does not popup.
>
> Runtime rt = Runtime.getRuntime();
> Process prcs = rt.exec("/usr/local/apps/bin/netscape
> -direct");
> prcs.waitFor();
> System.out.println("\nreturn code: "+ prcs.exitValue());
>
|
|
 |