AnthonyGeorge
Technical User
The aim of this application is to translate a en Var such as $PATH into its path such as /usr/bin.
Before I give the code listing and environment can anyone think of any UNIX reason that given echo $PATH, the application will output back $PATH and not the path /usr/bin.
My java code works as a standalone application, it is when it is called from a Oracle Store procedure that it outputs back what was inputed in.
As a stand alone if I input $TONY it will throw an exception as there is no envar mapped to $TONY.
If I input TONY then it will output TONY, this is the same resault as from the application called the Oracle database.
Is there a problem with unix commands and Oracle.
Code listing below:
import java.io.*;
import java.util.*;
class translate
{
public static String translatePath(String envar)
{
Runtime rt = Runtime.getRuntime();
Process p = null;
String echoOutput = null;
int len = 0;
try
{
System.out.println("Calling echo "+envar);
p = rt.exec(new String[]{"/bin/echo",envar});
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
echoOutput = br.readLine();
br.close();
isr.close();
return echoOutput;
}
catch(Exception e)
{
System.out.println("Exception "+e);
return "ProcessProblem";
}
//path = "/rims/live/log";
}
}
Thanks for any advice or help
Tony
Before I give the code listing and environment can anyone think of any UNIX reason that given echo $PATH, the application will output back $PATH and not the path /usr/bin.
My java code works as a standalone application, it is when it is called from a Oracle Store procedure that it outputs back what was inputed in.
As a stand alone if I input $TONY it will throw an exception as there is no envar mapped to $TONY.
If I input TONY then it will output TONY, this is the same resault as from the application called the Oracle database.
Is there a problem with unix commands and Oracle.
Code listing below:
import java.io.*;
import java.util.*;
class translate
{
public static String translatePath(String envar)
{
Runtime rt = Runtime.getRuntime();
Process p = null;
String echoOutput = null;
int len = 0;
try
{
System.out.println("Calling echo "+envar);
p = rt.exec(new String[]{"/bin/echo",envar});
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
echoOutput = br.readLine();
br.close();
isr.close();
return echoOutput;
}
catch(Exception e)
{
System.out.println("Exception "+e);
return "ProcessProblem";
}
//path = "/rims/live/log";
}
}
Thanks for any advice or help
Tony