Java help, the following code….?

demonstrates or executes some sort of command its working to get simple instructions like javac, espresso etc.But why it isn’t working with regard to windows exe files after i give the trail in the tactic.

tranfer java.util.*;
tranfer java.io.*;
arrest class Test1

arrest static emptiness main(String args)

try

Runtime rt = Runtime.getRuntime();
Procedure proc = rt.exec(“F:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe”);
InputStream stderr = proc.getInputStream();
InputStreamReader isr = different InputStreamReader(stderr);
BufferedReader br = different BufferedReader(isr);
Stringed line = null;
Procedure.out.println(“”);
although ( (line = br.readLine())! = null)
Procedure.out.println(line);
Procedure.out.println(“”);
int exitVal = proc.waitFor();
Procedure.out.println(“Process exitValue:” + exitVal);
pick up (Throwable t)

t.printStackTrace();

problem is

Exemption in line “main” coffee.lang.Problem:Unresolved compilation problem:
Invalid escape pattern (valid models are \b \t \n \f \r \” \’ \\ )

during Test1.main(Test1.espresso:11)

Exactly for the reason that exception claims:you ought to “escape” your backslashes by simply doubling just about every.
Change “F:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe” to be able to “F:\\Program Files\\Adobe\\Acrobat 6.0\\Reader\\AcroRd32.exe”

There’s the Invalid evade sequence.

As an alternative to “F:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe”

Use “F:\\Program Files\\Adobe\\Acrobat 6.0\\Reader\\AcroRd32.exe”

The code ought to be

tranfer java.util.*;
tranfer java.io.*;
arrest class Test1

arrest static emptiness main(String args)

try

Runtime rt = Runtime.getRuntime();
Procedure proc = rt.exec(“F:\\Program Files\\Acrobat 6.0\\Reader\\AcroRd32.exe”);
InputStream stderr = proc.getInputStream();
InputStreamReader isr = different InputStreamReader(stderr);
BufferedReader br = different BufferedReader(isr);
Stringed line = null;
Procedure.out.println(“”);
although ( (line = br.readLine())! = null)
Procedure.out.println(line);
Procedure.out.println(“”);
int exitVal = proc.waitFor();
Procedure.out.println(“Process exitValue:” + exitVal);
pick up (Throwable t)

t.printStackTrace();

Thank you, Hope them helps

while inputting the path use \\
for example:if you intend to run program that is certainly in n drive then you have available “d:\\programxyz.exe”

give \\ previous to Program Files\Adobe\Acrobat SIX.0\Reader\AcroRd32.exe

it’s going to work.

Leave a Reply