Can a java app pass values to a c-shell script?

hello everyone,
I'm running a shell script that executes a java app.
I need to pass values from the java app to the shell script, such that I can code
java myapp
echo <value1>
echo <value2>where value1 and value2 have been set in the app.
is there a way to do this?
Thanks for your help.
Tom

Wira, I've tried this, and can't get it to work. The
problem may be that Runtime.getRuntime().exec() is
running the script on a separate process(?), Yep.
and I
never see any output in the same context as the
script that's running the java app.
I've tried this from the command line as well, and I
don't see any output from the script being called
from the java app.
I know the script is being run, because if I change
the script name to a name that doesn't exist, I get
an ioexception, when I change it back everything runs
ok.
Note that I'm testing this under XP with batch files;
eventually it will run on unix.
does that make a difference right now?Forget java for right now.
Start working on a way for the script to hoist the values into itself.
For example if the script calls another script which does the echo what happens?
Or can you call another script, set some env variables, and then see them in the original script?

Similar Messages

  • Accessing concurrent prg parameter values having space in shell script

    Hi, I have a CP that is tied to Host (shell script). One of the parameter values of CP contains spaces. When I print this parameter ($5) in shell script, space is taken as terminator and it parses it in mutiple postions, like if value is "Hello There" then $5 comes as "Hello" and $6 comes as "There"
    How do I access whole values including space as one parameter value?
    Regards,
    Harish

    Hi Ashutoosh,
    OS is SunSolaris 5.9
    My problems was that if I pass a value from concurrent program that has space and wanted to access that value in shell script as one parameter, it won't allow.
    I did anlaysis on this and I think for now, there is no way out. If I pass values from unix to shell script it works, because I will enclose in quotes.
    I removed the spaces while passing value from Concurrent program and was able to achieve what I wanted but its an work around.
    Thanks,
    Harish

  • Is it possible to pass a variable from a shell script back to an Automator action?

    Is it possible to pass a variable from a shell script back to an Automator action?
    For instance, if I assign a value of foo to $var1 in my shell script how would I retrieve/pass that value in the next Automator action. I see that there is a variable called "Shell Script" but I can't any information on how to use it. 

    red_menace,
    Thanks but I still don't understand how to pass a single value that was set in the UNIX scipt back to Automator has a variable. Take the example below, I write 4 varables to STDOUT and all 4 are stored in a variable named "storage".  How do I assign 1 of these values to the Automator "storage" variable? For instance if I wanted to assign the value of $var2 to "storage" , how would I do that?

  • Passing Null Characters from Unix Shell Script to Java Program

    Hi Experts,
    Facing an issue with a shell script....
    The shell script has 10 input parameters....
    1st Parameter is a compiled Java program name(This can keep changing)
    Rest 9 are the parameters of the Java Program...
    The following piece of code is working when Test "a z" "b t" "" "" "" "" "" "" "" "" is hardcoded.
    lv_java_string=`java Test "a z" "b t" "" "" "" "" "" "" "" ""`
    The whole thing being dynamic.....
    But when I dynamically populate the same on to a parameter lv_java_param and then execute the same
    lv_java_string=`java $lv_java_param`
    if i echo $lv_java_param  its giving me Test "a z" "b t" "" "" "" "" "" "" "" ""  correctly
    Im facing some issue...... The issue is " is being treated as a parameter itself and the space between a and z is not taken into consideration and hence z is taken as the 2nd parameter
    Issue seems to be something like the precedence in which the above statement is executed, because of which "s are calculated/manipulated. Is it something like
    a) $lv_java_param is computed  first and then java $lv_java_param
    b) or java $lv_java_param is run on the fly......
    Any help is much appreciated.

    This forum is about Oracle *RDBMS*
    I don't see any question about Oracle RDBMS
    Please find a forum about Java.
    Sybrand Bakker
    Senior Oracle DBA

  • Passing paramter from ANT to shell script doesn't seems to work for me;Help

    Hi,
    what iam "trying" to do is to pass some variables from my ANT script to a shell script. This is what iam doing with my 3 files. Iam getting errors when iam doing this.
    1) build.xml file:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <project name="dev" default="all" basedir=".">
        <!-- (2) Create the class path -->
        <path id="common.class.path">
            <pathelement
    location="/opt/bea/weblogic81/server/lib/weblogic.jar"/>
        </path>
        <!-- create a reference for the class path utilized -->
        <property file="./myAnt.properties"/>
        <property name="common.class.path" refid="common.class.path" />
        <property name="Deploy.scripts.folder" value=
    "/opt/bea/weblogic81/server/bin/applicat
    ions" />
        <property name="1" value="${ANTPATCH}" />
        <property name="2" value="${WEBLOGICJAR}" />
        <property name="3" value="${ADMINPORTNUMBER}" />
        <property name="4" value="${HOSTNAME}" />
        <target name="xyz">
            <echo message="***********deployment**********"/>
            <property name="general.deployment.script.name"
    value="${general.script}" />
        </target>
        <target name="sangitatest">
            <echo message="This is the TESTNET box"/>
            <exec dir="${Deploy.scripts.folder}"
    executable="${Deploy.scripts.folder}/${genera
    l.deployment.script.name}" />
            <arg line="${1}"/>
            <arg line="${2}"/>
            <arg line="${3}"/>
            <arg line="${4}"/>
        </target>
        <target name="all" depends="xyz,sangitatest" />
    </project>---------------------------------------
    2) myAnt.properties file:
    general.script=deployScript.sh
    ANTPATCH=/opt/bea/wlserver6.1/lib/latest_deploy.jar
    WEBLOGICJAR=/opt/bea/wlserver6.1/lib/weblogic.jar
    ADMINPORT-NUMBER1=7001
    HOSTNAME=reliant2-----------------------------------------
    3) deployScript.sh file:
    export ANTPATCH=$1
    export WEBLOGICJAR=$2
    export ADMINPORTNUMBER=$3
    export HOSTNAME=$4
    java -cp "$ANT-PATCH":"$WEBLOGIC-JAR" weblogic.deploy -port
    "$ADMIN-PORT-NUMBER" -host "$HOSTNAME" -component testMon:beamon_biko_s1 deploy
    weblogic testMon /export/home/san5sxs/applications/beamon/myfile.war-------------------
    and the Exception is:
    [echo] This is the TESTNET box
    [exec] /opt/bea/weblogic81/server/bin/applications/deployScript.sh: ANTPATCH=: is not an identifier
    [exec] Result: 1
    BUILD FAILED
    file:/opt/bea/weblogic81/server/bin/build.xml:30: Could not create task or type of type: arg.
    Ant could not find the task or a class this task relies upon.
    any help in this matter ??
    regards,
    sangita

    Have you looked at [url http://ant.apache.org/]ant's website
    That's apache's ant. I'm not sure if there are others or not.
    if so, here is the mailing list [url http://ant.apache.org/mail.html]info

  • Passing variable from sql to shell script

    Usually we can pass arguments from shell script to the sql that us called inside the shell script. But I also want to do the reverse. I have the location of my backup path in a table. I want to run the rman script (shell), read this parameter from the table and use this to construct the "format" path in rman. Anyone has any ideas about this. Thanks.

    To achieve getting the modified value from the table everytime the job runs, I encapsulated this in another job.
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
    JOB_NAME           => 'TEST_LOGS_MAIN',
    JOB_TYPE             => 'PLSQL_BLOCK',
    JOB_ACTION          => 'declare
    v_aname varchar2(32);
    begin
    select aname into v_aname from attr where attrid = 3;
    DBMS_SCHEDULER.CREATE_JOB(
    JOB_NAME        => ''TEST_LOGS'',
    JOB_TYPE        => ''EXECUTABLE'',
    JOB_ACTION      => ''/opt/sql/testy.sh'',
    number_of_arguments => 1,
    COMMENTS        => ''TEST'');
    dbms_scheduler.set_job_argument_value(''TEST_LOGS'',1,v_aname);
    dbms_scheduler.enable(''TEST_LOGS'');
    end;',
    REPEAT_INTERVAL => 'FREQ=MINUTELY',
    ENABLED           => TRUE);
    END;
    /

  • How can i call a Stored Procedure procedure from Unix shell script

    Hi All,
    I want to call a Strored PL-SQL Procedure through Unix shell script.
    Can any body help me with this.
    Regards,
    Saurabh

    I prefer a seperate script like the other poster mentioned. However, most shells can use a 'here' document as well ...
    sqlplus uid/pwd <<END
    exec myproc
    exit
    ENDRichard

  • How to pass arguments to a Unix shell script from PL/SQL?

    We want to run a Linux shell script from PL/SQL (10g). This is our code to run the script only and it works fine.
    dbms_scheduler.create_job
              job_name=>'RUN_LINUX_SCRIPT_' || v_job_name,
              job_type=>'EXECUTABLE',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
              enabled=>TRUE,
              auto_drop=>FALSE
            );Now we have a requirement to pass 2 arguments to the .sh file. In the .sh file the 2 arguments are defined as $1 and $2.
    I used this method.
    dbms_scheduler.create_job
              job_name=>'RUN_LINUX_SCRIPT_' || v_job_name,
              job_type=>'EXECUTABLE',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh',
              --job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt /vol0/FileLoadDir/Bank/DATA_FILES/abcdefghij.txt',
              --job_action=>'#!/bin/bash spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcde.txt',
              number_of_arguments => 2,
              enabled=>FALSE,
              auto_drop=>FALSE,
              comments => 'Testing by Channa'
          DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
            job_name                => 'RUN_LINUX_SCRIPT_' || v_job_name,
            argument_position           => 1,
            argument_value          => '/vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt');
          DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
            job_name                => 'RUN_LINUX_SCRIPT_' || v_job_name,
            argument_position       => 2,
            argument_value          => '/vol0/FileLoadDir/Bank/DATA_FILES/abcdefghij.txt');
          DBMS_SCHEDULER.enable (name => 'RUN_LINUX_SCRIPT_' || v_job_name);But I get an error saying:
    STANDARD_ERROR="/vol0/FileLoadDir/Bank/DATA_FILES/spell_check2.sh: line 4: read: `/vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt': not a valid identifier
    /vol0/FileLoadDir/Bank/DATA_FILES/spell_check2"

    Check this post:
    pass parameter from PL/SQL to Unix "as is"

  • Passing a parameter to a shell script through concurrent program

    Hi All,
    I am trying to pass a runtime parameter from oracle application to a shell script which inturn calls a sql script. The parameter iam passing has a space for example. iam passing something like "Customer 1" so how does the shell script interpret this parameter. Any ideas are appreciated.
    Thanks,

    You may need to read the input parameters first, e.g.:
    set file [lindex $argv 0]
    Then: send "put $file\r"
    There is a good example at http://en.wikipedia.org/wiki/Expect

  • Passing dialog text to a shell script command

    Hi. Newbie here. I got a good book, will learn this sooner or later.
    But right now, I got a problem I can't figure out
    I'd like to display a dialog box that requests some text. I'd then like to use that text as the variable for a shell commmand.
    Let's say for instance that I want to prompt for the asset tag number of the machine and want the result to end up in the ARD Info 1 field. I've got the first and third line, just don't know how to "place" the captured text:
    display dialog "What is this Mac's assett tag number?" default answer ""
    do shell script "defaults write /Library/Preferences/com.apple.RemoteDesktop Text1 <resultfrom_dialoghere>"
    Anyone?
    Darrin

    You use text returned of:
    dialog reply n : Reply record for the ‘display dialog’ command
    properties
    button returned (Unicode text, r/o) : name of button chosen (empty if ‘giving up after’ was supplied and dialog timed out)
    text returned (Unicode text, r/o) : text entered (present only if ‘default answer’ was supplied)
    gave up (boolean, r/o) : Did the dialog time out? (present only if ‘giving up after’ was supplied)
    ex:
    set _result to text returned of (display dialog "What is this Mac's assett tag number?" default answer "")
    do shell script "defaults write /Library/Preferences/com.apple.RemoteDesktop Text1 " & quoted form of _result

  • Passing AppleScript string variable to shell script

    I have a script which uses the md5 command line utility to make convenient-sized hashes of some very long strings. Right now I save each string in a temporary text file which is then referenced in the command line:
    set hash to do shell script "md5 -q" & space & quote & POSIX path of tempFile & quote
    This works well, but I wonder if it isn't a little inefficeint, re-writing the temporary file with each new string. md5 has a -s option, which allows the string data to be placed directly in the command line:
    set myText to "Hello World"
    set hash to do shell script "md5 -q -s" & space & quote & myText & quote
    I know that if I do it this way I have to be careful to "escape" all occurrences of quote characters within myText to avoid command line syntax problems. This would not be difficult (in fact, it has already been done for another reason), but I have two questions:
    (1) Are there any other ASCII characters that would have to be similarly escaped? I've tried strings with line breaks in them: Mac-, Unix-, and Windows-style breaks, and they all seem to work, but are there any hidden dangers to doing this?
    (2) myText can get very long: say, 10,000 characters or more, so the command line would be correspondingly long. Is there any kind of limit on the length of command lines in the particular species of UNIX that is running under the Mac hood?
    Many thanks.
    Dual 1.2 GHz   Mac OS X (10.4.8)  
    Dual 1.2 GHz    

    >(1) Are there any other ASCII characters that would have to be similarly escaped? I've tried strings with line breaks in them: Mac-, Unix-, and Windows-style breaks, and they all seem to work, but are there any hidden dangers to doing this?
    There are many characters that can fall foul of a do shell script command, which is why Apple gave a convenient way of handling it via quoted form of:
    <pre class=command>set myText to "Hello World"
    set hash to do shell script "md5 -q -s "  & quoted form of myText</pre>
    This will take care of escaping various characters that might confound the shell.
    >(2) myText can get very long: say, 10,000 characters or more, so the command line would be correspondingly long. Is there any kind of limit on the length of command lines in the particular species of UNIX that is running under the Mac hood?
    It varies by OS version, but 262,000 bytes is the technical limit.

  • How can a Java prg pass data to a SAP table (TStpo)

    Hi All,
    I created a webservice using JAVA.
    Got WSDL for a SAP Funtional Module(CSAP_MAT_BOM_CREATE) and created Java Classes using (WSDL2Java -t XXX.wsdl ).
    While Invoking the service from Java Client program by Passing all the parameters.
    Error:Deserialisation failed
    Exception in thread "main" AxisFault
    faultCode: Client
    faultSubcode:
    faultString: Deserialisation failed
    faultActor:
    faultNode:
    faultDetail:
            SimpleTransformationFault:<
    MainName>/1BCDWB/WSS0080429093947734000</MainName><ProgName>/1BCDWB/WSS008042909
    3947734000</ProgName><Line>209 </Line><Valid>X</Valid><MatchFault><DescriptionTe
    xt>System expected the end of the element 'TStpo'</DescriptionText><TokenType>S<
    /TokenType><TokenName>ItemCateg</TokenName><TokenNameSpace/><TokenValue/></Match
    Fault><Caller><Class>CL_SRG_RFC_PROXY_CONTEXT</Class><Method>IF_SXML_PART~DECODE
    </Method><Positions>1 </Positions></Caller>
    Thanx ,
    Vijay

    Hi Venkat,
    I am passing the value to ItemCateg.. Pls see the portion of XML Sent below..!
    <TStpo xsi:type="ns2:StpoApi01" xmlns="" xmlns:ns2="urn:sap-com:document:sap:soap:functions:mc-style">
      <ItemCateg xsi:type="xsd:string">L</ItemCateg>
      <ItemNo xsi:type="xsd:string" />
      <Component xsi:type="xsd:string">PART008</Component>
      <CompQty xsi:type="xsd:string">1.0</CompQty>
      <CompUnit xsi:type="xsd:string">EA</CompUnit>
    <FixedQty xsi:type="xsd:string" />
      <ItemText1 xsi:type="xsd:string" />
      <ItemText2 xsi:type="xsd:string" />
      <Sortstring xsi:type="xsd:string" />
      <RelCost xsi:type="xsd:string" />
      <RelEngin xsi:type="xsd:string" />
      <RelPmaint xsi:type="xsd:string" />
    </TStpo>
    Thanx,
    Vijay

  • Can one Java app return String[] to other Java app ?

    I writed 2 applications.
    One can trigger another to run ( System.exec(...) )
    After finish, the second app needs return String[].
    How I return the value ?
    Any suggestion is welcome.

    What are you trying to do?
    Streaming data output as piping? OR
    Two running apps communication? OR
    One app calling another? OR .....

  • How can a Java app validates and accepts a server certificate?

    Hi,
    I got a Java 1.6 client, running on JBoss 6, which is required to make SSL connection to LDAP server.
    The first time when the Java client makes a secure ldap connection to LDAP Server, the server will send a certificate to the client. Once the client receives the certificate, it has to validate if the certificate is signed by a trusted CA. If it is, the client accepts and saves the certificate in a keystore. So, the certificate can be used later on.
    As I known, most Web browsers that support SSL have a list of CAs whose certificates they will automatically accept. If a browser encounters a certificate whose authorizing CA is in the list, the browser will automatically accept the certificate, and establish a SSL connection to the site. Can I borrow from this idea, and implement it in Java world?
    Thank you.

    Actually if the LDAP SSL certificate is signed by a trusted signer the SSL handshake will complete successfully.
    More typically, the LDAP host is either self signed or signed with an corporate internal signing certificate. In which case this needs to be imported as appropriate for the J2EE server (I believe it is just the standard JVM truststore for JBoss). Also note that some J2EE containers (not sure about JBoss) cache the keystore and truststore, so you may need to restart the J2EE server if you add entries to them.

  • Can a Java app run in the background?

    I want to put an app on a server that runs at a certain time of day (probably something like midnight, not sure yet) that just performs a task without any notifications. Is Java suitable for this task?

    You are looking more to run as a service in windows or a damon in Unix. Do a google on "java windows service" and see what comes up. Last I checked there was a JNI structure given to use and step by steps on how to get what you want to happen.

Maybe you are looking for

  • Capture FPM Event in another WDC

    Hello Friends, I trying to capture the name of event liek EDIT,CLOSE,NEXT etc.. that are defined in FPM in a std WDC. I need this because based on the ID of the button , i need to process some information. Could you pls let me know how to handle this

  • Cloning (Time Machine) a hardrive from an older Macbook to a new One

    I'm looking to purchase a new Macbook Pro. My current one is about 3 years old.  I'm set up with Logic, lot's of other plugins and software as well as a offloaded sample library on an external drive. Do not want to reinstall software and figure out a

  • VGA over RGBHV, external display not detected

    Hi guys, I have a presentation to make in a couple of days' time on my Macbook, but while at the venue testing the projector, I encountered a problem. At the lectern, the VGA input is not in the form of the normal DB15 VGA connector, but RGBHV - so t

  • Upgrading LabVIEW drivers from 5.1.1 to 10.0 (or compatible version)

    Hello! I can't read the files in the attachment (CCD drivers), because they are written in a LabVIEW version (5.1.1) not compatible with mine (10.0). Do anyone know how to make them readable by my version? Thank you very much, Eleonora  Solved! Go to

  • Casting in JTree

    I am trying to respong to a JTree selection. I have the following lines... DefaultMutableTreeNode node = DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); Object nodeInfo = node.getUserObject(); I get an Exception when I try and cast the O