Runtime.getRuntime().exec and Lynx

Bulldog13

Golden Member
Jul 18, 2002
1,655
1
81
Hello,

I am trying to run Lynx (text based web browser) from the command line using a simple Java program.

If I use the -dump parameter with lynx it will convert an html file into a text file (ripping out tags and making a best effort at frame placement and what not).




If I were to run it manually from the command line "test5.txt" is the text file converted from html. When I call it using my java program, it is just a blank text file.

The commented out code was my attempt at doing it using an array because I read getRuntime().exec was friendlier with those.
 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
I've never tried this but I'll see if I can be of any help...

First of all: DataInputStream.readLine() is deprecated so I'd replace that first and see if it helps. Wrapping the input stream with an InputStreamReader and that with a BufferedReader is the preferred method.

Next, from the javadocs for Process:
The methods that create processes may not work well for special processes on certain native platforms, such as native windowing processes, daemon processes, Win16/DOS processes on Microsoft Windows, or shell scripts.
Maybe that has something to do with it?

Are you using the 1.5 sdk? If so maybe you could take a peak at java.lang.ProcessBuilder. I'm not sure if it's what you need but it looks handy.