Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java method Runtime.getRuntime().exec fails on HP-UNIX to start netscape.

Reply
Thread Tools

Java method Runtime.getRuntime().exec fails on HP-UNIX to start netscape.

 
 
Jakir
Guest
Posts: n/a
 
      08-12-2004
Hi

Can any one help me in finding what could be wrong in the following
sample. Its not able to open Netscape on HP-UNIX.

I am new to java programming.

class javaHello {
public static void main(String[] args) {
System.out.println("Hello World.\n");
try
{
Runtime.getRuntime().exec("netscape");
}
catch(Exception e)
{
System.out.println("Failed to execute.\n");
}
}
}


Thanks & Regards
Jakir
 
Reply With Quote
 
 
 
 
Liz
Guest
Posts: n/a
 
      08-12-2004

"Jakir" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Hi
>
> Can any one help me in finding what could be wrong in the following
> sample. Its not able to open Netscape on HP-UNIX.
>
> I am new to java programming.
>
> class javaHello {
> public static void main(String[] args) {
> System.out.println("Hello World.\n");
> try
> {
> Runtime.getRuntime().exec("netscape");
> }
> catch(Exception e)
> {
> System.out.println("Failed to execute.\n");
> }
> }
> }
>
>
> Thanks & Regards
> Jakir


I cut and pasted your program, compiled it, and ran it.
I don't have netscape so I changed "netscape" to "notepad.exe"
and it worked fine. Perhaps you need "netscape.exe" or maybe
netscape.exe is not in your path.


 
Reply With Quote
 
 
 
 
Jakir
Guest
Posts: n/a
 
      08-16-2004
Thanks for the responses.

The command "which netscape" returns "/usr/local/bin" and I had given
that path
but still it dosen't work. Also I don't get any error message. The
output hello is seen and then nothing happens.

Regards
Jakir

Gordon Beaton <(E-Mail Removed)> wrote in message news:<411c6181$(E-Mail Removed)>...
> On 13 Aug 2004 08:10:07 +0200, Tor Iver Wilhelmsen wrote:
> > http://www.velocityreviews.com/forums/(E-Mail Removed) (Jakir) writes:
> >> Runtime.getRuntime().exec("netscape");

> >
> > You need the explicit path to the executable. Runtime.exec() does
> > not see the path.

>
> Looks to me like the PATH _is_ searched:
>
> [foo]$ strace -f java Exec mozilla 2>&1 | grep mozilla
>
> stat64("/home/gordon/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/local/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/local/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/local/X11/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/X11R6/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/local/pgm/j2sdk/bin/mozilla", 0x61d4149c) = -1 ENOENT
> stat64("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",
> {st_mode=S_IFREG|0755, st_size=4253, ...}) = 0
> execve("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",...) = 0
>
> Maybe Jakir's problem is that netscape simply isn't _in_ his PATH.
>
> /gordon

 
Reply With Quote
 
Jakir
Guest
Posts: n/a
 
      08-17-2004
Same sample works on Unix-Solaris...but it fails on HP-Unix(I am
working on version B.11.11).

Regards
Jakir

(E-Mail Removed) (Jakir) wrote in message news:<(E-Mail Removed). com>...
> Thanks for the responses.
>
> The command "which netscape" returns "/usr/local/bin" and I had given
> that path
> but still it dosen't work. Also I don't get any error message. The
> output hello is seen and then nothing happens.
>
> Regards
> Jakir
>
> Gordon Beaton <(E-Mail Removed)> wrote in message news:<411c6181$(E-Mail Removed)>...
> > On 13 Aug 2004 08:10:07 +0200, Tor Iver Wilhelmsen wrote:
> > > (E-Mail Removed) (Jakir) writes:
> > >> Runtime.getRuntime().exec("netscape");
> > >
> > > You need the explicit path to the executable. Runtime.exec() does
> > > not see the path.

> >
> > Looks to me like the PATH _is_ searched:
> >
> > [foo]$ strace -f java Exec mozilla 2>&1 | grep mozilla
> >
> > stat64("/home/gordon/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/local/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/local/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/local/X11/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/X11R6/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/local/pgm/j2sdk/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > stat64("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",
> > {st_mode=S_IFREG|0755, st_size=4253, ...}) = 0
> > execve("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",...) = 0
> >
> > Maybe Jakir's problem is that netscape simply isn't _in_ his PATH.
> >
> > /gordon

 
Reply With Quote
 
Jakir
Guest
Posts: n/a
 
      09-01-2004
Hello

I was finally able to launch Netscape from Java application. Problem
was with the environment variable set by Java. After setting
XFILESEARCHPATH variable to "" I was able to start netscape through
Java application.

Thanks
Jakir

(E-Mail Removed) (Jakir) wrote in message news:<(E-Mail Removed). com>...
> Same sample works on Unix-Solaris...but it fails on HP-Unix(I am
> working on version B.11.11).
>
> Regards
> Jakir
>
> (E-Mail Removed) (Jakir) wrote in message news:<(E-Mail Removed). com>...
> > Thanks for the responses.
> >
> > The command "which netscape" returns "/usr/local/bin" and I had given
> > that path
> > but still it dosen't work. Also I don't get any error message. The
> > output hello is seen and then nothing happens.
> >
> > Regards
> > Jakir
> >
> > Gordon Beaton <(E-Mail Removed)> wrote in message news:<411c6181$(E-Mail Removed)>...
> > > On 13 Aug 2004 08:10:07 +0200, Tor Iver Wilhelmsen wrote:
> > > > (E-Mail Removed) (Jakir) writes:
> > > >> Runtime.getRuntime().exec("netscape");
> > > >
> > > > You need the explicit path to the executable. Runtime.exec() does
> > > > not see the path.
> > >
> > > Looks to me like the PATH _is_ searched:
> > >
> > > [foo]$ strace -f java Exec mozilla 2>&1 | grep mozilla
> > >
> > > stat64("/home/gordon/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/local/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/local/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/sbin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/local/X11/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/X11R6/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/local/pgm/j2sdk/bin/mozilla", 0x61d4149c) = -1 ENOENT
> > > stat64("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",
> > > {st_mode=S_IFREG|0755, st_size=4253, ...}) = 0
> > > execve("/usr/local/pgm/mozilla-1.7.1/bin/mozilla",...) = 0
> > >
> > > Maybe Jakir's problem is that netscape simply isn't _in_ his PATH.
> > >
> > > /gordon

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Poll: Is a Java Method an Instance of the Java Classjava.lang.reflect.Method? Please reply with YES or NO. Paka Small Java 15 02-07-2012 07:04 PM
Use Java web start to start application on the command line by thefile name albert kao Java 3 02-02-2011 11:21 PM
Java Web Start 1.6 fails to load bundle maxmike Java 0 10-01-2007 06:58 PM
slideshow fails, Firefox debugger also fails lkrubner@geocities.com Javascript 2 12-23-2004 06:22 PM
Forms Authentication Fails Between ASP.NET 1.0 and 1.1 Applications (Cookie Decryption Fails) John Saunders ASP .Net 1 11-18-2003 03:25 PM



Advertisments