Set Java Object with Java Long Object from JNI

Hi,
i am getting crazy with the jni...
in Java i have the follwoing:
public class blabla{
Object myObject;
i chose Object cause the return value from native is not known
in case for a long value i handle it like this :
//get the Long class
jclass LongCls = env->FindClass("Ljava/lang/Long;");
jmethodID jmid = env->GetMethodID(LongCls, "<init>","(J)V");
//create an Long Object with the long return value
jobject LongObj = env->NewObject(LongCls,jmid,longreturnvalue);
//set Long Objekt - doesnt work!(jclazz is the class of the return Object of the blabla class)
jfid = env->GetFieldID(jclazz, "myObject", "Ljava/lang/Object;");
env->SetObjectField( returnobjectofblabla,jfid,LongObj );
the long value is set fine in the Long Object but i cant set the Long Object with the SetObjectField method into the Object myObject.
Java is shown that the myObject contains a Long Object but the long value of the Long Object is totally wrong and doesnt equal to the long value which has been set.But setting the value works fine- any ideas or solutions?
Thank you!

charliess wrote:
sometimes i really wonder about the answers in this forum - until now i got not one answer that helps me, even i tried to write down the problem very detailed...
Sometimes I wonder about people who jump onto a site and immediately assume that
1. They are the most important person in the world
2. That they deserved the absolute undivided attention of absolute everyone.
3. That everyone should be absolutely polite to them and provide them with perfect answers.
4. Feel free to denigrate and posit their own opinion on everything while ignoring anything else that anyone else says.
5. Expect that everyone else should understand their poorly worded questions.
Myself I find such individuals extremely amusing. Although they seldom stick around long here. At least not under their original alias.
plaz tel me how to realise your error checking?example plz
You start by having at least a basic understanding of C/C++ and java.
Then you read the JNI documents, all of them, for each method that you are using.
Then you write code such that it actually reflects the documents. For example you check return types. And probably deal with the possibility that JNI methods might throw exceptions.
as far as i know the jni methods like getfieldids and so on throw exceptions other like stObject dont do that the just return nothing
i can see all exceptions in my Java console thats not the Problem, setting the Long Object does not throwing a exception btw->
Myself I wouldn't expect that a JNI exception would show in the java console. Could I suppose though.
However nothing so far would suggest that an exception is being thrown. That however doesn't alter the fact that you must still write the code such that it could happen.
is it possible in general to set an java Long Object created in C(native) into a Object type (Object) overgiven as parameter in my JNI function with the setObject method?
Is it possible that you could actually follow my previous request and create some code that actually runs instead of cut and pasting whatever you feel like?
plz answer also with code and examples i did the same for you...No you didn't. You posted something which would not compile and quite possibly doesn't represent your actual code at all.
And please note that we do not get paid to do this. If you want to pay someone to solve your problem then there are sites for that.
Paying someone allows you to make all sorts of demands. The more you pay the more people will put up with.
If you don't want to pay and do in fact want free answers then it will probably be in your interest to
1. Be polite
2. Answer the questions that have been asked of you.

Similar Messages

  • Using Berkeley Java Edition with Java Web Start

    Hi
    Have anyone had any experience using Berkeley Java Edition with Java Web Start?. I need to create an application that will download with the database to a client computer and create the database there

    Thanks for your reply Luca-Sanna,
    This is my jnlp file
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/dist" href="launch.jnlp">
    <information>
    <title>MyApplication</title>
    <vendor>My Company</vendor>
    <homepage href="/test.html"/>
    <description>My Test Application</description>
    <description kind="short">My Application</description>
    <icon href="test.gif" kind="default"/>
    <offline-allowed/>
    </information>
    <security>
    <all-permissions/>
    </security>
    <resources>
    <j2se version="1.5+"/>
    <jar href="myapp.jar" main="true" download="eager"/>
    <jar href="lib/appframework-1.0.3.jar" download="eager"/>
    <jar href="lib/beansbinding-1.2.1.jar" download="eager"/>
    <jar href="lib/commons-beanutils.jar" download="eager"/>
    <jar href="lib/commons-collections.jar" download="eager"/>
    <jar href="lib/commons-digester.jar" download="eager"/>
    <jar href="lib/commons-logging.jar" download="eager"/>
    <jar href="lib/derby.jar" download="eager"/>
    <jar href="lib/derbyclient.jar" download="eager"/>
    <jar href="lib/derbynet.jar" download="eager"/>
    <jar href="lib/itext-1.3.1.jar" download="eager"/>
    <jar href="lib/jasperreports-1.3.0.jar" download="eager"/>
    <jar href="lib/jbossall-client-2004-05-11.jar" download="eager"/>
    <jar href="lib/jdt-compiler-3.1.1.jar" download="eager"/>
    <jar href="lib/poi-2.0-final-20040126.jar" download="eager"/>
    <jar href="lib/swing-worker-1.1.jar" download="eager"/>
    <jar href="lib/toplink-essentials-agent.jar" download="eager"/>
    <jar href="lib/toplink-essentials.jar" download="eager"/>
    </resources>
    <application-desc main-class="mypackage.Login">
    </application-desc>
    </jnlp>
    I have seen many forums with the same above problem with no reply.
    Anyone knows what exactly the problem is?

  • Possible?Multi-Entity View Object with one Entity Object that is Read-only.

    I know this sounds crazy, but I would like to create a multi-entity view object, where one entity object is based on a table in my application (we'll call it "Users", which basically stores the primary key for the person from the institutional people database), and the other table is a entity object based on a view of the institutional people database table (read only access), which we can call "People".
    I know that since no updates will be done to the People table, it really should be a read-only View Object, but I would lose the ability to sort on attributes like Last Name, Hire date, etc, since those would be transient attributes in my ViewObject for the Users. By having People as an entity object, I can then create a multi entity view object and have the ability to join Users to People and be able to sort on the above mentioned fields (like Last Name).
    The problem is that when I use the JDev (I'm currently using 10.1.2.1) AppModule BC4J tester, when I click on the multi-entity view object that I added to the AppModule it gives me an error:
    oracle.jbo.RowCreateException) JBO-25017: Error while creating a new entity row for People.
    ----- LEVEL 1: DETAIL 0 -----
    (java.lang.InstantiationException) null
    I have tried to change all the attributes to updateable in my entity object, but no create method, and I have tried to make them all read-only, but no effect, I get the same error (probably because the People view is read-only in my schema).
    Is there a way to change the entity object so that it will not try to create a new row when it runs the Tester? So that the multi entity view object behaves more like a view link, but gives me the added bonus of being able to sort on the Last Name column from the People table?
    Thanks for any help on this subject...at worst, I will have to use the view link method to get the job accomplished, but it would be "cooler" if this would work!
    Jeremy.

    Steve, thanks for your quick response to my question.
    To answer your questions, I was trying to create the Multi-entity View Object to give me more flexibility when working with my User table, and my People view. The flexibility I desired was that I would be able to sort my Users based on attributes in the People view. This is not possible when the there is only one Entity in my VO, and the People view data are all transient attributes, because they are not in the SQL statement.
    Ultimately, after working with one of my colleagues, we decided to use the approach that you mentioned by creating a read-only VO with the SQL query we want to display to the user (contains both User and People data fields), and then use a different ViewObject when performing other actions on the User Table (such as inserts/updates/deletes). By using the setWhereClauseParam() method in the handleLifeCycle() for the JSP page, we should be able to navigate between the different View Objects, so that the user does not see any difference.
    Thanks! Oh, and by the way, I have read your article you included before, and I have used it many times before to tune my View Objects! Thanks!

  • BC4J: problems creating view object with multiple entity objects

    Hi,
    I working with a view object which contains two entity objects with parent-child relationship like this:
    ViewObject - ParentEntityObject - PId
    PAttribute
    CId (FK)
    (- ParentChildAssociation)
    - ChildEntityObject - CId
    - CAttribute
    The 'Read Only' and 'References' options are checked for the association in the view object.
    I'm creating a new row using this view object. The parent object should be created new and the child object already exists in the database, so I'm setting only the attributes of the parent object (including foreign key).
    After creating the row I display it in a jbo:DataTable and only those attributes coming from the parent object are displayed. The attributes of the child object are not set. After a commit all attributes appear.
    The problem is, that I want to display the new row with all attributes to the users BEFORE they commit.
    I tried to set the child attributes, but they are read only by definition and even when I unchecked the 'Read Only' option and set the attributes to 'Always Updateable' in the view object it is giving me
    JBO-27008: Attribute set for CAttribute in view object ViewObject failed.
    Is there a way to make all attributes of the child object visible in the view object without committing changes?
    (JDev 9.0.2.822)
    Any help would be appreciated.
    Regards,
    Christian

    Once again the structure, sorry.
    ViewObject
    |-ParentEntityObject
    ..|-PId
    ..|-PAttribute
    ..|-CId (FK)
    |-ParentChildAssociation
    |-ChildEntityObject
    ..|-CId
    ..|-CAttribute
    Christian

  • Crystal Reports 2008 - can't see Salesforce objects with 2 parent objects

    I am running CR 2008 SP 1 and accessing Salesforce to create reports.  I just discovered that 2008 does not make available any Salesforce objects that have more than one parent.  This is only an issue if you define multiple relationships in Salesforce as Parent/Child.  Lookup relationships are not an issue.
    I am using CR XI for another client and it can see these objects without problem.  Is this a design issue or is it a bug with CR 2008?
    Hs anyone else encountered this issue?  Thoughts on ways to access these object short of redesigning my Salesforce data?
    BTW, I and using 2008 SP1 because SP2 does not work when accessing Salesforce.
    Thanks, John

    It turns out that the ability to access Salesforce objects with multiple parents was included in release 11 of the Salesforce API.  CR 2008 SP1 used release 9 of the API.  CR SP2 uses release 13 of the API.  Once they get SP2 fixed for the Salesforce interface, this issue will go away.
    John

  • Implement a View Object with multiple entity objects

    Hi
    In 'How to' section on the 'otn.oracle.com' (Jdeveloper) web site is tutorial how to implement a View Object with multiple updateable dependent entity objects.
    It allows user to insert an employee and a department at the same time.
    But I would like to change this example to insert a new department only if it does not already exist. How to change this sample?
    Is there any other way to this?
    Thanks
    Regards
    Gorazd

    Once again the structure, sorry.
    ViewObject
    |-ParentEntityObject
    ..|-PId
    ..|-PAttribute
    ..|-CId (FK)
    |-ParentChildAssociation
    |-ChildEntityObject
    ..|-CId
    ..|-CAttribute
    Christian

  • Multiplayer Java Game with java networking ???

    Hi everybody. I responsed a new university finising project. I will create a new game that multiplayer on a server. I am in a simple level on java. I have no java networking or no jdbc info. I belive I can success but I have no idea about which map i should follow. I will wait for your suggestions.
    (Or can I find a muliplayer game sample with java networking?)

    Maybe you could use RMI if you haven't got latency problems (that u will encounter certainly if you intend to use it with 56k modem).
    It's quite flexible and in java 5 also more usable.

  • Setting up printer with pc, printing wirelessly from macbook...

    ok so my new canon pixma mp530 printer just arrived and i want to set it up with my mom's desktop computer that is running windows xp... but since the desktop has the router hooked up i want to be able to print to it using my macbook.
    i looked in the system preferences and noticed that the printer's drivers are not on my macbook so what EXACTLY should i do to make this work the way i want it?

    BUMP...
    please help i need this

  • 3 Levels Master Detail View Object with Java class interface

    Hi Developers,
    I've created 3 tables with one to many relations as below
    BOARD ------<- APPLICANT ------<- QUALIFICATION
    a board includes many applicants and an applicant includes many qualifications.
    When I add these tables to a Fusion Project, JDeveloper 11g helps me to add the Entity Links and View Associations automatically.
    Then, I defined these relations in an ApplicantModule's Data Model as below.
    [+] BoardVO1
          |
          |--[+] ApplicantVO1
                   |
                   |--[+] QualificationVO1The problem is: I cannot write any function in QualificationVO and publish it by client interface.
    I created a simple function with a single line (System.out.println(...) ) in QualificationVOImpl.java. and selected it in Client Interface. But when I execute it from the ApplicantionModel for testing, an oracle.jbo.NoObjException JBO-25003 is raised. with message: Object ... ApplicantVO1 of type ApplicationModule not found.
    Has anyone tried to implement some coding in the third level of a master details view structure as my example? How do you make it works?
    I'm using JDeveloper 11.1.1.3 with ADF BC.
    Regards,
    Samson Fu

    Samson,
    Looks like a bug (probably with the application module tester). I created your tables:
    create table board(board_id number primary key not null);
    create table applicant(applicant_id number primary key not null, board_id number not null);
    create table qualification(qualification_id number primary key not null, aplicant_id number not null);
    alter table applicant add a_fk foreign key(board_id) references board;
    alter table qualification add q_fk foreign key(aplicant_id) references applicant;I created a JDev project and got the same results. I've e-mailed a test case off to Frank.
    Frank - the method is indeed exposed on the VO instance, and I tried testing that way, but the AM tester gives the error as if it is looking for an AM instance with the VO's name.
    John

  • Having problem setting system property with java -D name = value

    I want some clarification. Consider the statement below
    java -Djava.rmi.server.codebase=file:/c:\public_html\classes/
    -Djava.rmi.server.hostname=xyz.com
    -Djava.security.policy=java.policy engine.ComputeEngine
    1. Is the syntax right for specifying a file directory as codebase?
    -Djava.rmi.server.codebase=file:/c:\public_html\classes/
    2. What does this hostname property imply? Does this mean that the program which is started can be accesed by xyz.com?
    -Djava.rmi.server.hostname=xyz.com

    Kurt,
    I modified some of my directory structure as shown below and tried to execute. But I have got the same error again. Could you tell how to correct this error?
    Under c:\home\ann\public_html\classes directory, I have the Following:
    Sub-directory compute [Contains Compute.class and Task.class File]
    Sub-directory engine [Contains ComputeEngine_Skel.class and ComputeEngine_Stub.class Files]
    Sub-directory Meta-inf [Contains Manifest.mf file]
    File compute.jar
    Under c:\home\ann\src directory, I have the following:
    Sub-directory engine [Contains ComputeEngine.java, ComputeEngine.class]
    File java.policy
    Under c:\home\jones\public_html\classes directory, I have the Following:
    Sub-directory client [Contains Pi.class File]
    Current working directory is c:\home\ann\src
    The output from echo %CLASSPATH% was c:\home\ann\src; c:\home\ann\public_html\classes\compute.jar
    When executing the command:
    java -Djava.rmi.server.codebase=file:/c:\home\ann\public_html\classes
    -Djava.rmi.server.hostname=bwing2
    -Djava.security.policy=java.policy engine.ComputeEngine
    I am getting the error,
    ComputeEngine Exception: Stub class not found: engine.ComputeEngine_Stub; nested exception
    is : java.lang.ClassNotFoundException: engine.ComputeEngine_Stub
    java.rmi.StubNotFoundException: Stub class not found:
    Sridhar

  • How i can set environment variable with java?

    i'm tring to set it using System.setProperty("java.class.path") but it dosen't work any body help?

    you will have to find out the EXACT verbage, but it's
    something like this I suppose:
    Runtime runtime = System.getRuntime();
    runtime.exec("cmd set MY_VAR=blahhhhhhh");Yes... this creates a new process, then sets the MY_VAR environment variable for that process to "blahhhhhhh", then terminates that process.
    However I think you are asking the wrong question, since your post suggests you are trying to change your classpath programatically. Ask the question you thought that was the answer to instead.

  • Using Java Resources with Java Stored Procedures

    Hi folks,
    Hope someone can help out with this one.
    I have a java source file called PdfFormExtractor.sql. In that file I have a definition similar to.
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "PdfFormExtractor" as
    import com.adobe.pdf.FormDataFormat;
    import com.adobe.pdf.FormType;
    import com.adobe.pdf.PDFDocument;
    import com.adobe.pdf.PDFFactory;
    etc, etc.
    };I have loaded a number of Java jar files into the DB with the following command:
       CALL loadjava -v -s -r -u db_user_name/db_password@SID -jarasresource name_of_jar_file.jarMy PdfFormExtractor class compiles with errors as it does not seem to detect the class files located in the jar files which located in the schema.
    I have used the following query and determined that the JAR files are valid and present in the schema.
    SELECT object_name, object_type, status, timestamp
      FROM user_objects
    WHERE (object_name NOT LIKE 'SYS_%'
             AND object_name NOT LIKE 'CREATE$%'
             AND object_name NOT LIKE 'JAVA$%'
             AND object_name NOT LIKE 'LOADLOB%')
       AND object_type LIKE 'JAVA %'
    ORDER BY object_type, object_name;One solution appears to be to omit the "-jarasresource". This appears to cause loadjava to unpack the jar files. Unfortunately this means that you must drop any java objects from the same path as which they were created. Ideally I'd like to just load the java files and leave them as resources.
    My question then is how do I get my source code to recognize that the files are in the schema. I thought this would be picked up when I do @PdfFormExtractor.sql from a sqlplus prompt (assuming the jars have been loaded and unpacked in the schema)
    because I specified RESOLVE in the source definition
    If anyone has any ideas they are most welcome as I've been stuck on this for the past couple of hours.
    Regards
    Kris
    -- http://kristianjones.blogspot.com

    I advise you to post this thread on the Java forum JDeveloper and ADF
    Regards.

  • [JAVA] problems with java and mysql

    Hi, i have already installed php + mysql and work's them fine, but i want to install java + mysql. I have downloaded eclipse and installed its, that's ok. I have download tomcat and, that's ok. I have download module jconnector and have copied the file .jar in the java home and set classpath. Run and compiled this source that's ok. At runtime the program ask: Impossible connection at the database, why ? It's the source of program:
    [JAVA]
    import java.sql.*;
    public class connessione {
    private String nomeDB; // Nome del Database a cui connettersi
    private String nomeUtente; // Nome utente utilizzato per la connessione al Database
    private String pwdUtente; // Password usata per la connessione al Database
    private String errore; // Raccoglie informazioni riguardo l'ultima eccezione sollevata
    private Connection db; // La connessione col Database
    private boolean connesso; // Flag che indica se la connessione � attiva o meno
    public connessione(String nomeDB) { this(nomeDB, "", ""); }
    public connessione(String nomeDB, String nomeUtente, String pwdUtente) {
    this.nomeDB = nomeDB;
    this.nomeUtente = nomeUtente;
    this.pwdUtente = pwdUtente;
    connesso = false;
    errore = "";
    // Apre la connessione con il Database
    public boolean connetti() {
    connesso = false;
    try {
    // Carico il driver JDBC per la connessione con il database MySQL
    Class.forName("com.mysql.jdbc.Driver");
    // Controllo che il nome del Database non sia nulla
    if (!nomeDB.equals("")) {
    // Controllo se il nome utente va usato o meno per la connessione
    if (nomeUtente.equals("")) {
    // La connessione non richiede nome utente e password
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB);
    } else {
    // La connessione richiede nome utente, controllo se necessita anche della password
    if (pwdUtente.equals("")) {
    // La connessione non necessita di password
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB + "?user=" + nomeUtente);
    } else {
    // La connessione necessita della password
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB + "?user=" + nomeUtente + "&password=" + pwdUtente);
    // La connessione � avvenuta con successo
    connesso = true;
    } else {
    System.out.println("Manca il nome del database!!");
    System.out.println("Scrivere il nome del database da utilizzare all'interno del file \"config.xml\"");
    System.exit(0);
    } catch (Exception e) { errore = e.getMessage(); }
    return connesso;
    public static void main(String [] args) {
    connessione a=new connessione("asta","root","");
    if(a.connetti())
    System.out.println("Connessione al database riuscita");
    else
    System.out.println("Connessione al database non riuscita");
    [JAVA]

    With this line I always pass the username and password also:
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB);
    db = DriverManager.getConnection("jdbc:mysql://localhost/" + nomeDB, useName, Password);
    Make sure you create your users in MySQL with the correct permissions

  • Can you replace embedded smart object with linked smart object?

    Hi,
    I'd like to update some document to reflet the new workflow that linked smart object provide. I have made some transformation on those embedded smart object and would like to not have to redo all those so is there anyway way to replace those SO with the linked version of the same SO?
    TIA
    Jeff

    Hi,
    I'd like to update some document to reflet the new workflow that linked smart object provide. I have made some transformation on those embedded smart object and would like to not have to redo all those so is there anyway way to replace those SO with the linked version of the same SO?
    TIA
    Jeff

  • Java script with java

    sir i have seen that java 1.6 mustang version is supporrting java script
    if it is so please any one can help me on how to make my JEditorPane
    to support java script
    not only to jEditorPane but to any other swings component
    i tried in all ways please can any one give me this help

    Hello Farhan,
    The OP stated that there is no condition on the process. In this case, I believe only 'SUBMIT' will cause the process to be fired.
    "you can put anything in the string of the doSubmit."Well, you can do that, but it will have an effect only if you are using the REQUEST variable to condition a process. Otherwise, nothing will happen, and you want even receive an error message, because no error actually exist (as I believe happened with the OP case).
    Regards,
    Arie.

Maybe you are looking for