How do i Call an a method on and object that is a parameter

I have thee code as below.
I want to call the method setValue and set the value and pass it a String. i want it called on the jobject param1.
What do i need to call todo that given the below code.
JNIEXPORT jobject JNICALL
Java_PassObjectAndDoSomething_nativeMethod(JNIEnv *env, jobject obj, jobject param1) {
    jstring jstr;
    jclass cls2 = (*env)->GetObjectClass(env, param1);
    jmethodID mid3 = (*env)->GetMethodID(env, cls2, "setValue", "(Ljava/lang/String;)V");
    if (mid3 == NULL) {
        return NULL;
    jstr = (*env)->NewStringUTF(env, "My brand new JString");
    if (jstr == NULL) {
         return NULL;
    /*This causes errors when called*/
    (*env)->CallObjectMethod(*env, param1, mid3, jstr);
    return param1;
}

daniel_p wrote:
/*This causes errors when called*/Presumably you mean a system exception and not java exception of some sort.
(*env)->CallObjectMethod(*env, param1, mid3, jstr);Why is the asterisk in front of the env parameter in CallObjectMethod()?
return param1;Since you passed that in it is obviously pointless to return it. But that has nothing to do with your problem.

Similar Messages

  • How can I call the create method in BO from Application Service

    Hello!
    When I create a Business Object, CAF generates some methods automatically.
    How can I call the create method in the BO from Application Service logic?
    When i call the method then the entityManager and the sessionContext is NULL.
    How can I initialize this?
    Can anybody help me?
    Thanks, Thomas

    If you are using CE 7.11...
    1) In the Application Services, add the BO as dependant object in dependencies tab.
    2) In the implemention, add the following codes to call create method of the BO:
    this.get<BO>.createMethod();
    julius

  • HT1711 How do I delete music from my Iphone and iTunes that is duplicated ?

    How do I delete music from my Iphone and iTunes that wais duplicated, All songs shows up twice?

    See Here...
    iPhone User Guide
    and here
    http://www.apple.com/support/iphone/syncing/

  • How to save change in 3D text and Object that being made in photoshop cs6..

    I  was  wondering  how do I save change for 3D text and objects.
    let said the first text i type is Adobe but i want to change it to Microsoft.
    how can I  save that change in 3D  from Adobe to Microsoft.
    thank in advantace.

    You haven't said what version of Pages you are referring to.
    Hold down the option key when you go to the File menu and Save As… appears.
    It was Apple stiff necked response to users complaint about its removal. They couldn't just put it back.
    Once you do do this it is pretty much what it was before.
    Peter

  • How can i call a main method  from a different class???

    Plzz help...
    i have 2 classes.., T1 and T2.. Tt2 is a class with a main method....i want to call the main method in T2......fromT1..is it possibl..plz help

    T2.main(args);

  • How can i call a taskflow methode from backing bean ??

    Build JDEVADF_11.1.1.3.PS2_GENERIC_100408.2356.5660
    i like to call a Methode (taskflow) from backing bean!
    my bean code :
        public void imageLinkActionListner(ActionEvent actionEvent) {
            String              id      = actionEvent.getComponent().getId();
            int                 linkID  = Integer.parseInt(id.substring(4));
            DCBindingContainer  bc      = (DCBindingContainer)ADFUtils.getBindingContainer();
            DCTaskFlowBinding   tf      = null;
            System.out.println("Region Change...."+id+" INT "+linkID);
            switch (linkID) {
                case LINK_CALENDAR_REGION:
                    tf = (DCTaskFlowBinding)bc.findExecutableBinding("calendartaskflowPage");                   
                break;
                case LINK_MAIL_REGION:
                    tf = (DCTaskFlowBinding)bc.findExecutableBinding("mailtaskflowPage");                   
                break;
              case LINK_ADDRESS_REGION:
                  tf = (DCTaskFlowBinding)bc.findExecutableBinding("addresstaskflowPage");                   
              break;
              case LINK_BLOGS_REGION:
                  tf = (DCTaskFlowBinding)bc.findExecutableBinding("blogstaskflowPage");                   
              break;
              case LINK_MAPS_REGION:
                  tf = (DCTaskFlowBinding)bc.findExecutableBinding("mapstaskflowPage");                   
              break;
            default:
                return;
            if (tf != null){
                uiMainRegion.setRegionModel(tf.getRegionModel());
                uiMainRegion.setValue(tf.getRegionModel());
                tf.getExecutableBindings();
                AdfFacesContext.getCurrentInstance().addPartialTarget(uiMainRegion);
        }i like to call *#{backingBeanScope.mapBean.initMap}*
    my taskflow source
    <?xml version="1.0" encoding="windows-1252" ?>
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <task-flow-definition id="map-task-flow">
        <default-activity id="__1">map</default-activity>
        <view id="map">
          <page>/map/map.jsff</page>
        </view>
        <method-call id="initMap">
          <method>#{backingBeanScope.mapBean.initMap}</method>
          <outcome id="__7">
            <fixed-outcome>init</fixed-outcome>
          </outcome>
        </method-call>
        <control-flow-rule id="__2">
          <from-activity-id id="__3">initMap</from-activity-id>
          <control-flow-case id="__5">
            <from-outcome id="__6">init</from-outcome>
            <to-activity-id id="__4">map</to-activity-id>
          </control-flow-case>
        </control-flow-rule>
        <use-page-fragments/>
      </task-flow-definition>
    </adfc-config>

    Hi,
    to call the bean, use the EL in Java and reference #{backingBeanScope.mapBean.initMap} as a method expression. If you try and access the bean directly then chances are that the instance is not available. Using EL from Java always guarantees this
    Frank

  • How can I call a method of an object that is stored in an ArrayList?

    Hello,
    I am working on a simple game.
    I have my own collection class that can contain some Brick objects.
    That class looks like this:
    class MyCollection<Brick>
          ArrayList<Brick> list = new ArrayList<Brick>();
          public void add(Brick obj)
                list.add(obj);
         public int get(int i)
                return list.get(i);
         public int length()
               return list.size();
    }My Brick class is abstract and contains this method:
    public abstract int getXpos();That method is overridden by the subclass Brick_type1 (which, of course, extends Brick) and returns an int.
    In my main class I try to call the getXpos() method but I cannot call if for an unknown reason:
    MyCollection mc = new MyCollection<Brick>();
    Brick_type1 bt = new Brick_type1(10);
    mc.add(bt);
    for(int i = 0; i<mc.length(); i++)
                System.out.println(bc.get(i).getXpos());   // getXpos() does not exist, says the compilatorbc.get(i) should return a Brick that contains the getXpos() method, so why can´t I call it?

    Roxxor wrote:
    Sorry, it should be:
    public Brick get(int i)
    return list.get(i);
    }...so it actually returns a Brick, but I still cannot call the getXpos() method for some reason.Is this also just a typo?
    MyCollection mc = new MyCollection<Brick>();

  • How to write call specs for a java stored procedure that takes a nested obj

    Example Class :
    public class B {
    int number;
    String str;
    public class A {
    private B[] _childern;
    public B[] getChildern(){
    return _children
    public static void saveAll(A a) throws SQLException {
    B[] children = a.getChildern();
    for(int i=0; i<children.length; i++){
    saveChild(children);
    public static void saveChild(B ch)throws SQLException {
    // do something
    What would be the call specification for the method A.saveAll(A)? Your help will be apprecited.
    Thank you
    Ajmal

    In other words, How to pass a Java Object from a Java stored procedure to a Java client ???
    Hello,
    I don't know to deal with a Vector object that has been generated from a stored procedure.
    Should I create first in the JDBC client and pass it as argument to the procedure ?
    Thanks in advance. Here is an extract ...
    On the client side :
    <<
    Vector buffer = new Vector();
    CallableStatement call =
    con.prepareCall ("{call my_procedure_run (?, ?)}");
    call.registerOutParameter(2, java.sql.Types.JAVA_OBJECT );
    call.setString (1, "bla bla bla");
    call.setObject (2, buffer);
    call.execute ();
    buffer = (Vector)call.getObject (2);
    >On the Java stored procedure
    <<
    public class my_procedure
    public static void Run(String input_value, Vector buffer)
    // ??? Vector buffer = new Vector();
    try
    while ( true )
    buffer.addElement(...) ;
    catch(Exception ex) { }

  • How can I calling LabView DLL within LabView and pass similar Data Types?

    I am trying to use an Instrument Driver, which is created in LabView6.1 as a DLL. At this point I have only LabView to test this DLL. I was wondering, is there easy way to find out what sort of Parameter or Data Type I should be using.
    How can I pass the following data with in LabView:
    LVRefnum as Type?
    LVBoolean as Type?
    TD1 (a structure) as Type?
    It is funny to see that I am able to create a DLL in labview but having trouble calling it within LabView. I thought, it would be easier to test the DLL within the same environment.
    Basically, I am more worried about the VISA calls that are used in the driver to communicate with instrument. Because, there is no link to �VISA32.dll� in
    the header file, is that handled by the LV Run-time engine? I guess more details are needed on using the LabView DLL within LabView from National Instrument Technical Support.
    Attachments:
    RL5000.h ‏1 KB

    A LVRefNum seems to be an unsigned long data type (32bit). You can cast it
    in LV then use that as a parameter to call the DLL. (an Occurrence type
    seems to be a Ulong32)
    When you created the DLL what was the resulting type for the LVRefNum?
    Happy Holidays
    "Enrique" wrote in message
    news:[email protected]..
    > I see...
    >
    > After doing some research, it seems to me that there is no easy way to
    > find out the type of data, other than looking at the header file and
    > have documents like Using External Code in LabVIEW handy. The
    > following information is from that document:
    >
    > LVBoolean is an 8-bit integer. 1 if TRUE, 0 if FALSE.
    >
    > LabVIEW specifies file refnums using t
    he LVRefNum data type, the
    > exact structure of which is private to the file manager. To pass
    > references to open files into or out of a CIN, convert file refnums to
    > file descriptors, and convert file descriptors to file refnums using
    > the functions described in Chapter 6, Function Descriptions.
    >
    > I know you are creating a dll in LabVIEW, but I am pretty sure the
    > information applies as well and is useful. For your dll this can be
    > interpreted that, rather than passing a LVRefnum, try passing the file
    > descriptor.
    >
    > From the header file, is can be deduced that TD1 is a cluster in
    > LabVIEW.
    >
    > You are right in saying that "more details are needed on using the
    > LabView DLL within LabView from National Instrument Technical
    > Support.".
    >
    > Enrique

  • Calling an Oracle stored procedure and retrieving result from OUT parameter

    Hello,
    I have a stored procedure that returns a string in an OUT parameter after receiving 6 IN parameters. I have tested the procedure in PL/SQL and it's producing the right output there. The problem is when I call the stored procedure from my Java method. I then get an error message telling me that I have the wrong number or types of arguments in my procedure call. I have checked that the method receives and sends the correct data in the correct order and I'm not sure what else the error message can relate to...?
    The exception is called on my second try statement but I haven't been able to find out what I have done wrong there. Does anyone have any suggestions? Thanks.
    the error message
    java.sql.SQLException: ORA-06550: line 1, column 13: PLS-00306: wrong number or types of arguments in call to 'P_SET_GIVEN_ANSWER' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
    the procedure
    CREATE OR REPLACE PROCEDURE p_set_given_answer(
    strfeedback OUT VARCHAR2,
    intpi_id IN INTEGER,
    intquestion_id IN INTEGER,
    intgivenanswer IN INTEGER,
    strgivenprefix IN VARCHAR2,
    strgivenunit IN VARCHAR2,
    strgu_id IN VARCHAR2) AS
    -- some declarations
    BEGIN
    -- some processing and then returns the string below indicating the outcome
    strfeedback = 'result';
    END
    the java method (the class is called dbUtil and the database connection is created in the method called getDbConnection() )
    public void setGivenAnswer(int intPi_id, int intQuestion_id, int intGivenAnswer, String strGu_id, String strGivenPrefix, String strGivenUnit) {
    java.sql.Connection con = null;
    String query = "{call ? := p_set_given_answer(?,?,?,?,?,?)}";
    try {
    con = dbUtil.getDbConnection();
    } catch(Exception e) {
    dbConnectionExceptionMessage = "error 1:"+e.toString();
    try{
    CallableStatement stmt = con.prepareCall(query);
    // register the type of the out param - an Oracle specific type
    stmt.registerOutParameter(1, OracleTypes.VARCHAR);
    // set the in params
    stmt.setInt(2, intPi_id);
    stmt.setInt(3, intQuestion_id);
    stmt.setInt(4, intGivenAnswer);
    stmt.setString(5, strGivenPrefix);
    stmt.setString(6, strGivenUnit);
    stmt.setString(7, strGu_id);
    // execute the stored procedure
    stmt.execute();
    // retrieve the results
    strFeedback = stmt.getString(1);
    } catch (java.sql.SQLException e) {
    dbConnectionExceptionMessage = "error 2:"+e.toString();
    try {
    con.close();
    } catch (java.sql.SQLException e) {
    dbConnectionExceptionMessage = "error 3:"+e.toString();
    ----------------------------------------

    Looks like you are declaring a procedure, but you are calling it like a function. A procedure has no return value, it has only parameters: "{call p_set_given_answer(?,?,?,?,?,?,?)}"

  • Methods of OLE-objects with IN OUT parameter

    How can I invoke a method of an OLE-object with IN OUT parameter?
    Trying
    obj := CREATE_OLEOBJ(localobject VARCHAR2, TRUE);
    INIT_OLEARGS (n+1);
    ADD_OLEARG (newvar_1 NUMBER/VARCHAR2, vtype VT_TYPE := VT_R8/VT_BSTR);
    ADD_OLEARG (newvar_n NUMBER/VARCHAR2, vtype VT_TYPE := VT_R8/VT_BSTR);
    CALL_OLE(obj OLEOBJ, memberid PLS_INTEGER);
    newvar_x := GET_OLEARG_<type>(x);
    I get the old value of newvar_x, but it must be changed
    Methods with only IN parameter work fine.
    I've tried this with OLE2-package, but it hasn't worked too
    Can somebody help
    Thanks

    Hi Gurus
    I know this is very old post.
    but dose anybody know the answer.
    thanks

  • How do I stop Genius from recommending songs and albums that are already in my iTunes music library?

    With greater and greater frequency, Genius is recommending songs and albums that are already in my music library. Up to 80% of the recommendations!. I am hesitant to give these suggestions a thumbs down, as I like the songs (afterall, I own them) and don't want to give the impression that I don't like the artist, genre, etc. as I appreciate how Genius works, when it does work.
    I have updated Genius and updated iTunes Match, to no avail.
    This quirk -- recommending music already in my library -- used to be a rare event. Now, most of the recommendations I get are for music I already own.
    How can I fix this?

    To be a little bit more accurate the said book sits in my Documents on my Macbook,  purchased through iTune for free in iTunes Store>Books. I can find it with Finder on my Macbook. It says it is in my Documents but it does not appear in the Documents folder in my Dock. Great! Even the iTunes Store says it is downloaded already. And why when I search for it with Finder on my Mac and click on the result does a window open up full of comoter language? I need some help.

  • How can i get list of all monitors and rules that assigned to a node ?

    Hello,
    We r using the scom 2012 sp1
    i need to get list of monitors and rules that have assigned to nodes.
    for example :
    nodename - type - name
    node1 - monitor - montiorname1
    node1 - monitor - monitorname2
    node1 - rule - rule1
    node1 - rule - rule2
    can i get this list by using sql or powershell script ?
    thanks

    Hi,
    Please refer to the link below:
    How to View All Rules and Monitors Running on an Agent-Managed Computer
    https://technet.microsoft.com/en-us/library/hh212748.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How do I give a letter a value and use that letter as a code througout a spredsheet?

    Hi I am trying to write a spread sheet to calculate the cost of repairing stock items. I cant figure out how to make the code = the cost, so that if somone types Hx3+Tx2+rx1 it would  = £8
    Which would mean: 3 x Hooks need replacing 2 x Tabs need replacing and 1 5cm rip needs repairing.
    SO I have made one table with the codes and the values and one table for the items and their various panels that may need repairing but I cant figure out how to make it work...?
    Can any of you help...?

    HI Mich,
    Here's an idea of the complexity of the issue, using the example in line 41:
    Issue 1: determining what is code, what is quantity, and how many items are in each cell.
    In the first cell, the formula has to determine, from the text string "Rx1 rx3" that:
    There are two items. Possible to do this by counting the spaces and adding 1, or, assuming ALL parts in the cell will contain a x sign, by counting the "x" characters..
    The first letter is code. But the code could also be the first two letters, or the first two letters plus a number (eg. WP5) or the first two letters plus the next two characters (eg. WP11). Other code lengths may also be possible. The length of the (first) could be determined using SEARCH to find the first x. Subtract 1 from that to determine the number of characters in the code, then use LEFT to extract the code from the formula.
    =LEFT(B2,SEARCH("x",B2,)-1)
    Now that the code has been extracted, that formula becomes the first argument of the VLOOKUP formula from the previous post, used to find the price of that item:
    VLOOKUP(LEFT(B2,SEARCH("x",B2,)-1),Price List :: B:C,2,FALSE)
    Next, the price must be multiplied by the number following the x. That number must be extracted. Assumption: The number is a single digit, between 1 and 9, inclusive. We can use MID:
    MID(B2,SEARCH("x",B2,)+1,1)
    =VLOOKUP(LEFT(B2,SEARCH("x",B2,)-1),Price List :: B:C,2,FALSE)*MID(B2,SEARCH("x",B2,)+1,1)
    The result above gives the cost for repairing the large rip in B2
    Next, if there is more than one type of repair to be done, the process above must be repeated with a new twist: This time we're looking for the second repair item in B2. The marker is a space, so we'll need to add a SEARCH for the first space, and use that as the starting point for both SEARCH functions in this section.
    Then the whole process (with another SEARCH added to each set) must be repeated for the third (possible) code and number in the cell.
    Repeat 7 for as many items as could be included in this cell.
    We don't know how many items will be recorded in each cell, so we have to allow for a maximum and provide some means of making the formula quit when there's nothing more to be done. This could be an IF, depending on the count of "x" or " " in the cell, or an IFERROR that would trap the error caused by searching beyond the last space. Whatever we used would need to be added to each iteration of the last formula shown above.
    As you can see, this quickly becomes a bit unwieldy, and a reason for my earlier suggestion to set up pairs of columns for each repair item.
    Regards,
    Barry

  • How can I call  a component method from OCAP ?

    I'll try to invoke Cold Fusion Component from Xlet (OCAP App), specifically I wan to invoke a query from Component(CFC) method.
    Somebody knows how to... or any idea or comments.
    Thank you so much!

    Actually, as long as the servlet returns valid javascript, you can indeed "call it" from the client. It will initiate a request and return the result to the browser.
    This example uses Perl, but it could be easily modified to go to a servlet instead.
    Note that it is only supported in DOM browsers (IE6+/NN6+/etc)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    <title> Test server-side JS </title>
    </head>
    <body>
    <script type="text/javascript">
    function checkIt(variable, value)
    var newScript = "cgi-bin/validateJS.cgi?"+variable+"="+value;
    var body = document.getElementsByTagName('body').item(0)
    var scriptTag = document.getElementById('loadScript');
    if(scriptTag) body.removeChild(scriptTag);
    script = document.createElement('script');
    script.src = newScript;
         script.type = 'text/javascript';
         script.id = 'loadScript';
         body.appendChild(script)
    </script>
    <p>Test.</p>
    <form id="f1" action="">
    <input type="text" name="t1" id="t1" onChange="checkIt(this.name, this.value)">
    </body>
    </html>
    validateJS.cgi
    #!/opt/x11r6/bin/perl
    use CGI qw(:all);
    my @valArray = split(/=/,$ENV{QUERY_STRING});
    print "Content-type: text/javascript\n\n";
    # myPass is the password
    $myPass = "foobar";
    if ("$valArray[1]" eq "$myPass")
    print "alert(\"Success!!\")";
    else
    print "alert(\"Failure!!\")";

Maybe you are looking for