System Call from Java, problem LD_LIBRARY_PATH

I use class Runtime to invoke Operating System Call.
I want to run OS command gpg (gnu program for encrypting/ decrypting files).
What is interesting, when I run my sqlplus script from system user (used for database installation) call ends with success.
Running script from other os users or machines ends with -1 code and error message:
"ld.so.1: gpg: fatal: libiconv.so.2: open failed: No such file or directory"
gpg uses libraries given LD_LIBRARY_PATH (/opt/gnupg/lib:/usr/lib:/usr/local/lib)
I think that is the problem. Is there a workaround for that??
Best regard
Grzegorz

Maybe related to the fact that the PATH environment variable is unset then re-initialized by Oracle to PATH = /usr/local/bin:/bin:/usr/bin. Try using absolute path for the OS commands.
Kuassi
- blog http://db360.blogspot.com/
- book http://db360.blogspot.com/2006/08/oracle-database-programming-using-java_01.html

Similar Messages

  • How to access system calls from java program?

    i am having a doubt regarding accessing system calls from a Java program like accessing unix system calls from a c program.

    Runtime.getRuntime().exec("line command here");
    example:
    Runtime.getRuntime().exec("ls -la");

  • Cross platform operating system calls from Java

    For our application we need to call an external program to perform FTP. We use ncftp as it's available on all the server platforms our clients use (Sun, HP, Linux, Windows). Up to now we've been using a Java program that listens to the Oracle pipe and sends a string to the OS.
    Now we are using 8i we thought it would be better to use Java within Oracle as this should reduce problems due to the external program not running. On Windows it works fine, but on Linux runtime.exec does not seem to take account of the system path. If I send something like '/usr/bin/ncftpput ...' it works, but I can't rely on the executable being in that directory although it should be somewhere in the path. I want to just pass 'ncftpput ...'.
    Ideally I want to be able to make the code OS independent, but would consider doing something in the Java part to detect the OS and adapt accordingly, perhaps by using a shell e.g. '/bin/sh -c ncftpput ...', but I've had problems with that using the whole command line and can I rely on having a specific shell on all *nix systems?
    At some point we'd like to do all the FTP from within Oracle, but that looks like a bigger project.
    Any ideas/suggestions?
    Thanks
    Steve

    Steve,
    To determine the OS, you should be able to check the System properties. As an example, when I run this (quick and dirty) sample code, I can see that os.name=Windows NT on my Windows instance:
    CREATE OR REPLACE JAVA SOURCE NAMED "envTest" AS public class envTest {
    public static void getEnvVar() {
    System.getProperties().list(System.out);
    CREATE OR REPLACE PACKAGE envTest IS
         PROCEDURE getEnvVar;
    END;
    CREATE OR REPLACE PACKAGE BODY envTest IS
         PROCEDURE getEnvVar IS
         LANGUAGE JAVA NAME 'envTest.getEnvVar()';
    END;
    To see the output after executing envTest.getEnvVar, map System.out to DBMS_OUTPUT before running it, as follows:
    set serveroutput on
    begin
    dbms_java.set_output(100000);
    end;
    Hope this helps,
    -Dan
    http://www.compuware.com/products/devpartner/db/oracle.htm
    Debug PL/SQL and Java in the Oracle Database

  • Operating System Calls from APEX with Java and PL/SQL

    Question about operating system calls from apex.
    I created a java file which is wrapped with pl/sql like
    create or replace java source named "ExternalCall" as
    import java.io.*;
    I do the steps from this web page http://www.oracle.com/global/de/community/tipps/oscalls/index.html
    The page is in german, but for experienced users the code on this page says everything.
    In apex i have an application which calls this function with the "move" command in a sql-report region.
    Let's say move c:\work1\file.txt c:\work2\file.txt
    Everything works fine on one host(pc) but if i want to transfer the file from my host to another one then
    i get the messgage "no access" although i have read, write access on the other host.
    By the way, on both hosts i have admin rights.
    Why can't i transfer the file over a network ?
    Thanks in advance for any kind of help.
    Regards
    Stefan

    I guess you are working on a Windows host. In this case Oracle processes are running as Windows services with a build-in MS system account. This account has no access to network ressources. You have two ways to get out of your windows box:
    Assign Oracle services a network enabled account, e.g. domain user with local administrator privileges. (I never tried this and I don't like to recommend it.)
    Use a command script for copying files and use explicite authentication within this script:-
    net use \\myserver\ipc$ tiger /user:scott
    copy c:\temp\xxx1 \\myserver\share\temp
    copy c:\temp\xxx2 \\myserver\share\temp
    Michael

  • Can I source an environment before making a system call from the database

    I can execute system calls from the database like
    Process proc = Runtime.getRuntime().exec("env");
    but I am unable to source an environment before making the call.
    Our goal is to from within the database to execute tkprof on a
    raw trace file then load both files into clobs in a table. We can load
    the raw trace no problem, we just cannot figure out how to execute
    tkrprof on the raw trace then load its output.
    Anyone know if this is possible to hava java get a runtime and then call
    an environment file to source the environment so that path's and other environment variables are set prior to executing another system command.

    Thanks for that...but can I do multiple edits in my Stored Procedure Vaibhav and pass back something that I can then utilize in my SSIS? For example...
    One and Only one Member Span...so I'd be doing a SELECT COUNT(*) based on my match criteria or handle the count accordingly in my Stored Procedure and passing something back via the OLE DB Command and handling it appropriately in SSIS
    Are there "Diabetes" claims...again probably by analyzing a SELECT COUNT(*)
    Am I expecting too much from the SSIS...should I be doing all of this in a Stored Procedure? I was hoping to use the SSIS GUI for everything but maybe that's just not possible. Rather use the Stored Procedure to analyze my stged data, edit accordingly, do
    data stores accordingly...especially the data anomalies...and then use the SSIS to control navigation
    Your thoughts........
    Could you maybe clarify the difference between an OLE DB Command on the Data Flow and the Execute SQL Task on the Control Flow...
    You can get return values from oledb comand if you want to pipeline.
    see this link for more details
    http://josef-richberg.squarespace.com/journal/2011/6/30/ssis-oledb-command-and-procedure-output-params.html
    The procedure should have an output parameter defined for that
    I belive if you've flexibility of using stored procedure you may be better off doing this in execute sql task in control flow. Calling sp in data flow will cause it to execute sp once for each row in dataset whereas in controlflow it will go for set based
    processing
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Duration of an Abap Function call from Java using Jco3

    Hi guys!
    I would like to use this discussion to get some refernces of the duration Timespan of an RFC call from Java to SAP. At the moment, i need at last about 200ms to call the Abap function. I'm just using one simple import and export parameter (so no deep structures). I think that the reason for my poor performance is, that the Java Tool and the SAP instance are not in the same network. So, i hope some of you have some data, how fast an RFC call from Java using Jco can be executed.
    greetings, Hannes

    Hi Hannes,
    I think you have already got the answer to your question - the network set-up you have is probably the bottleneck.  Whenever I've worked with Java <-> ABAP and they are in the same network, I've had no performance problems at all.
    Does your RFC contain any complex logic or business processes?  Are you able to try and call something that does nothing, say it just accepts an input string and returns it straight away as an export.  Do you have any scope for testing with your Java tool on the same network as the SAP system?
    Cheers,
    G.

  • System call fom Java code

    Hi all
    I hope someone over here might answer my problem.
    I need to run a Shell script form my Java code, which does perform some operations like writing/copying files to a specific directory and my Java code then starts reading the files and do necessary stuff like parsing it for some info inside the file.
    If I make a system call from my Java code, how do I know when the shell script is done executing completely? Just to make sure that my Java code execution starts only after the shell script has executed.
    If anyone has come across such a scenario, please reply to this topic. A sample code wud be a bonus for me :)
    Thanks
    -Uday

    If you've never used Runtime.exec, read this carefully first:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    MOD

  • How can i measure BAPI runtime which has called from JAVA

    Hi abapers
    how can i get run time for BAPI called from JAVA through JCO.
    i know that i can use SE30 from ABAP by executing from SAP.
    may be ST05 useful for me i did it but when display trace
    i am getting big list by seeing this list i am not able to find the runtime for that BAPI.
    please any one can explain
    reagdrs
    ramesh

    Hi Ramesh,
       Irrespective of whether the call is from an external system or within sap, the bapi will be executed in R/3 only.
    So, you can safely measure the runtime using se30 only.
    If it is taking more time when called from JCo , then you can be sure that the problem is not with SAP and is actually due to the JCo connectivity with R/3.
    Regards,
    Ravi

  • Operating system calls from apex

    Question about operating system calls from apex.
    I created a java file which is wrapped with pl/sql like
    create or replace java source named "ExternalCall" as
    import java.io.*;
    I do the steps from this web page http://www.oracle.com/global/de/community/tipps/oscalls/index.html
    The page is in german, but for experienced users the code on this page says everything.
    In apex i have an application which calls this function with the "move" command in a sql-report region.
    Let's say move c:\work1\file.txt c:\work2\file.txt
    Everything works fine on one host(pc) but if i want to transfer the file from my host to another one then
    i get the messgage "no access" although i have read, write access on the other host.
    By the way, on both hosts i have admin rights.
    Why can't i transfer the file over a network ?
    Thanks in advance for any kind of help.
    Regards
    Stefan
    null

    You say that "on both hosts i have admin rights".
    Remember that Oracle doesn't log in as "you", so Oracle may not have rights to the remote host.
    There are a lot of different permissions that can be assigned to java stored procedures. This chapter in the documentation might help:
    http://download-east.oracle.com/docs/cd/B19306_01/java.102/b14187/chnine.htm#BABFBDGG
    You might get better help from the JVM forum:
    Java in the Oracle Database

  • How to kill a system process from java code.

    Hi,
    i need to kill or remove windows system process like cmd.exe from java code.
    like removing it from end process in task mgr.
    i tried below code but its not removed.
    is there a better way we can do this.
    killing a system process from java code will create any issues?
       public static void main(String[] args) throws Exception {
       String[] cmd = { "cmd.exe" };
       Process p = Runtime.getRuntime().exec(cmd);
       p.destroy();
    any suggestions or ideas are really appreciated.
    thanks.

    Hi  jtahlborn, mohan
    yes the process is created from my java code. 
    in my code iam creating a process like below and if it is running for a long i need to kill it from java.
    For that " Runtime.getRuntime().exec("taskkill /F /PID " +  7408); " is working fine.
    7408 is my process id in taskmgr created from java and iam manually passing the PID it to kill it.
    But i need to get the PID from java code.
    Thanks for your suggestions.
    Sample Code:
    public static void main(String args[])
            try {
              Process process = Runtime.getRuntime().exec(new String[]{"cmd.exe","/c","start"});        
              Field f = process.getClass().getDeclaredField( "handle");
              f.setAccessible( true);         
              long procHandle = f.getLong( process);
              System.out.println( "prochandle: " + procHandle );
              //Runtime.getRuntime().exec("taskkill /F /PID " +  procHandle);
            } catch( Exception e) {
              e.printStackTrace();

  • Dll call from java using Jbuilder?

    Please?
    Does anyone know how I do dll calls from java (jubuilder).
    I have tried but did not manage to get it wright???
    / thanks carlos

    Research JNI (java native interface)

  • How to run system commands from JAVA

    Hi Friends,
    How to run windows system commands from JAVA
    Runtime r=Runtime.getRuntime();
    r.exec("dir");
    Throwing following Exception
    CreateProcess :dir error=2
    Thanks in advance
    Hamsa

    Hi ,
    in Windows NT this is not possible, you can use the following :
    Runtime r=Runtime.getRuntime();
    StringBuffer sbuf = new StringBuffer();
    String dir = new String();
    java.lang.Process proc = r.exec("cmd /c dir");
    InputStream is = proc.getInputStream();
    int ch ;
    while((ch=is.read() ) != -1)
    sbuf.append((char)ch);
    is.close();
    dir = sbuf.toString();
    System.out.println(dir );

  • Strange problem with procedure calling from Java!!!

    I am using Oracle 8.1.7 Database, Oracle 8i Application server and WInNT platform.
    I am facing a strange problem while inserting a String from Java to Oracle database through Procedure. When i am passing the String containing single quotes(e.g "test' and ' and ' end") and without including any escape charactes for the single quotes I am passing the String by the setString() method then the procedure is inserting the single quotes without any problem.
    Of course when I am independently executing the procedure thru backend and passing the same String containing single quotes then the error message comes as " quoted string not properly terminated" which is justified,
    I have even printed the String in a file through sql on the runtime of the procedure when it is called by Java and then also the String contatins single quotes that is passed through java without any escape characters. This means that procedure is inserting the String into the column without any hassles!!!!!
    Can anyone tell me what may be the reason for the peculiar behaviour of Database?
    Thanks

    Sri Ram wrote:
    No actually in the documentation of oracle database 10g plsql user guide, oracle explains the concept of declaring nested plsql subprograms he gave the example but in the main block he gave NULL, without calling any procedure.Can you provide a link to where in the Oracle documentation you saw this example?
    in order to know which procedure is getting first i added a dbms statement in both the functions and called the function from the main block.
    the original example was
    DECLARE
    PROCEDURE proc1(number1 NUMBER); -- forward declaration
    PROCEDURE proc2(number2 NUMBER) IS
    BEGIN
    proc1(number2); -- calls proc1
    END;
    PROCEDURE proc1(number1 NUMBER) IS
    BEGIN
    proc2 (number1); -- calls proc2
    END;
    BEGIN
    NULL;
    END;
    ---------------------------------------------------------------------------------------------------------The original example is equivalent to:
    BEGIN
       NULL;
    END;That is, the main block never calls anything. Either you are misinterpreting the Oracle documentation, or if the example came from a non-Oracle source as I suspect, the author of that example has a deeply flawed understanding of how programming works.
    John

  • Making system calls in java

    I want to join some split files into one. In command prompt I use COPY /B file.1+file.2 file to join the files. How can i do the same in my java application. Please show the code which I suppose will use getRuntime. Thanks in advance.

    Well if there is a problem with system calls then can
    you tell me if there is a class in java for
    concetanating files. Not directly.
    At present I am joing the files
    by reading each byte from the files and writing them
    to another file which takes hell lot of time. You should read the files in large chunks. Much much faster.
    Thanks
    in advance again. Also if you say about sequential
    file class then please expalin a bit bcs I couldn't
    implement it.Post the code you are having trouble with explaining what it should do and what it actually does.

  • System Call by Java Application - [change path and run of the other progra]

    public class  A {
         public static void main (String[] args)
              System.out.println("Hi");
    }I do have above A.java.
    I am generating A.class from it.
    A.class is in the following directory :
    /home/sachin/work/Sample_Directory/bin/hello_filetest/
    I have another program which makes System call.
    But the problem is B.java is in the different directory :
    /home/sachin/work/Sample_Directory/src/hello_filetest/
    public class  B {
         public static void main (String[] args) {
    Process p1 = Runtime.getRuntime().exec("java A);
                BufferedReader stdInput = new BufferedReader(new
                     InputStreamReader(p1.getInputStream()));
    while ((s = stdInput.readLine()) != null) {
                    System.out.println(s);
    {code}
            So, my question is how to change directory by system calls and execute the program
    which is lying in other directory ????
    Thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The following code will call javac on a .java file, which will compile it into a .class file
         public static void javacTest() {
              JFileChooser jf = new JFileChooser();
              if (jf.showOpenDialog(null) != jf.APPROVE_OPTION) return;
              File file = jf.getSelectedFile();
              File dir = file.getParentFile();
              try {
                   Process p = Runtime.getRuntime().exec("javac " + file.getName(), null, dir);
                   IOUtils.pipe(p.getInputStream(), System.out);
                   IOUtils.pipe(p.getErrorStream(), System.out);
              catch (IOException iox) {
                   iox.printStackTrace();
         }Is that what you're trying to do, or are you trying to run the compiled (.class) file? Running your .class file should be basically the same as the above, assuming that you are not using any non j2se libraries, except that you need to take into account the package (if package is x.y, you must have file in ...src\x\y\foo.class - call "java x.y.foo" from src)

Maybe you are looking for

  • Error with ALBPM 10g / JAX-WS and WebLogic 10g

    Folks/People/Community: I have an application client running over weblogic 10g. This application needs to be integrated with an external WebServices running under ALBPM 10g and implemented using jax-ws. So far our application client running in standa

  • How to do 2:1 transformation using XSLT in ccBPM?

    Hi, We have the following ccBPM defined:       A    A    B   A/C   D    E    F Start---R1---T1---S2---T2---S3---T3---S1---END R1: Receives Synch XML message A via plain HTTP adapter and opens S/A bridge. T1: Transforms A into message B using XSLT S2:

  • Widescreen has black bars top and bottom

    Imported a widescreen DV file into FCP5, rendered it, looks widescreen in the canvas but has black bars which are always exported. But I want to end up with a DVD that is full screen/widescreen when viewed on a widescreen TV or LCD monitor. How to ge

  • [SOLVED]JDBC Dynamic credentials problem

    Hello everyone. I have been trying to implement Steve Muench example 14 about JDBC Dynamic Credentials on my own web app., I am using Jdeveloper 10.1.3.2 and JSF/ADF. The thing is that the JDBC dynamic credential works well but when I enter a non-exi

  • I bought Photoshop CS5 Windows platform. I now own a Mac and want to install it to my new computer. Is this possible?

    I bought Adobe Photoshop CS5 Extended Student and Teacher Edition (Windows,English) a few years ago. I now own a Mac and would like to download and install my photoshop. Is this possible?