How to use JAVA class in C++

Hi people,
is there anyone who knows how I can create and use JAVA class in C++ code. Example I have one JAVA class which works with database.
One of the methods from this class returns XML string that represent result set. How to create instance of this class inside of C++ and have possibility to call this method.

Hi, I'm also curious how to solve this.
My problem is that I call a DLL from C++ that returns several values (e.g. function(a, b, c, &w, &x, &y, &z); )
and I want to create a java class object that can be used to store these values so I can return 1 object
Below I've written an abstract of the code
Can someone help me with the parts in <> ??
Thanks!
Sander
JNIEXPORT jobject JNICALL Java_nativeF(...a,b,c...)
   int w,x;
   float y,z;
   C_DLL_Function(a, b, c, &w, &x, &y, &z);
   //<Create Java Class 'Data' jobject>
   //<Call Data.setvalues(w,x,y,z) >
   return jobject;
...in java...
class Data
  private int jw, jx;
  private float jy, jz;
  public function setvalues(int w, int x, float y, float z)
    jw = w;
    etc... 
[\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to use java class in pl/sql

    Hai Guys,
    here is my java class:
    import java.io.*;
    public class ListFiles
    public static void main (String[] args)
    File file=new File("C:\\");
    File[] files=file.listFiles();
    for(int fileInList=0; fileInList<files.length; fileInList++ )
         System.out.println(files[fileInList].toString() );
    i want to use this class in pl/sql, i am new about this topic my concern are following
    how to load java class
    how to use in pl/sql
    Guys i'll be great-full to you if you could help me out or share link or document .

    First Read https://forums.oracle.com/forums/ann.jspa?annID=432
    Check this link...
    1. http://www.devshed.com/c/a/Oracle/Extending-PLSQL-with-Java-Libraries-concluded/
    2. calling java from pl/sql in oracle 10g?its very urgent.
    3. http://qamarsyed.blogspot.com/2010/07/calling-java-from-plsql-inside-oracle.html
    4. http://home.c2i.net/toreingolf/oracle/java_and_plsql.htm
    Hope this helps...
    If someone response is helpful or correct, please mark it accordingly.

  • How to use java classes of DC1 in DC2

    When I was trying to use a java-class from another DC, I stumbled into an error I didn't expect:
    java.lang.NoClassDefFoundError: com/company/application/utils
    This is what I did to get this far:
    1. Created an empty Web Dynpro DC (DC1), to be used as a utilities library.
    2. Added a Java class to the webdynpro project.
    3. Added the class to a public part of type compilation.
    4. Created a second Web Dynpro DC (DC2), which is supposed to consume the class from DC1.
    5. Added a DC-usage relation, so that DC1 is in DC2's used DCs. In this usage-relation built-time and run-time were checked
    5. Used DC1's class in DC2's component controller
    6. Built both DCs and deployed them
    7. Ran the application in DC2.
    When I run the application, the application dumps a stack trace at the moment that and object is created based on the class in DC1.
    Any idea how to get this working?

    Vincenzo, here is the real error message:
    java.lang.IllegalAccessError: tried to access method nl.phoqus.pataut.Guid.getGuidString()Ljava/lang/String; from class nl.phoqus.pataut.PatientAuthorization
    I have inserted a very simple GUID generator that I used in a previous project. Please find the class file below:
    package nl.phoqus.pataut;
    import java.util.Random;
    public class Guid {
         private static Guid guidFactory = new Guid();
         static Random random = new Random();
          * Allow global replacement of the GUID generator.  Applications
          * wishing to install their own GUID generators should sub-class
          * Guid, override the getGuid() method, and use this method to
          *  install their generator.
         public static void
         setGuidImpl(Guid factory) {
         guidFactory = factory;
          * Return a GUID as a string.
         public static String getString() {
         return guidFactory.getGuidString();
          * Return a GUID as a string.  This is completely arbitrary, and
          * returns the hexification of a random value followed by a
          * timestamp.
         protected String getGuidString() {
            long rand = (random.nextLong() & 0x7FFFFFFFFFFFFFFFL) | 0x4000000000000000L;
            return Long.toString(rand, 32) + Long.toString(System.currentTimeMillis()&0xFFFFFFFFFFFFFL, 32);
    I'm calling the class using the following statements from the component controller of DC2:
    Guid x = new Guid();
    String y = x.getGuidString();
    The component controller resides in package package nl.phoqus.pataut.
    Would that be the problem?

  • How to use java class in jsp page of JSPProvider?

    Hello everybody.
    I created simple JSPProvider channel with portal amconsole and named it "jspprov1". Then I created "jspprov"1 directory under "/ets/opt/SUNWps/desktop/sampleportal". I put "index.jsp" in it. And it worked until I add this line into "index.jsp": <% @page import="jspprov1package.aclass1" %>. Then I created directory "jspprov1package" under "/ets/opt/SUNWps/desktop/classes" and put "aclass1.class" into it and into "/ets/opt/SUNWps/desktop/classes" itself. I created "aclass1.class" on the other machine (with no installed portal) in j2sdk1.4.1_02: "javac aclass1.java". The text of this class is simple:
    "package jspprov1package;
    public class aclass1{
    public int int_field = 10;
    But the page still don't work. It writes on the portal desktop "ERROR: Content is not available".
    Does anybody know why this happened?

    Sorry, there were mistakes in jsp page and java files.
    I maked the channel "show exceptions" and found them out.

  • How to use Java classes to make any query from Ldap? (any sample)

    Where to find at least a brief description?
    I need links,samples
    Thanks in advance.

    Have a look at the JNDI tutorial: http://java.sun.com/products/jndi/tutorial/index.html

  • XI: How To Use JAVA generic Class to  perform SAP data Lookup........

    Hello All,
    I want to create a generic class which is used to perorm SAP data lookup.
    I don't want to use Jco or RFC channel..
    Is there any other way to do this?
    waiting for Reply 
    thank in advance.
    - AKSHAY.

    Hi,
    use RFC channel
    you can wrap it up like this:
    /people/morten.wittrock/blog/2006/03/30/wrapping-your-mapping-lookup-api-code-in-easy-to-use-java-classes
    why do you want to create something diffucult to maintin and non standard if
    you can use the RFC API ?
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to use java source in Oracle when select by sqlplus.

    How to use java source in Oracle when select by sqlplus.
    I can create java source in Oracle
    import java.util.*;
    import java.sql.*;
    import java.util.Date;
    public class TimeDate
         public static void main(String[] args)
    public String setDate(int i){
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(new Date((long)i*1000));
    System.out.println("Dateline: "
    + calendar.get(Calendar.HOUR_OF_DAY) + ":"
    + calendar.get(Calendar.MINUTE) + ":"
    + calendar.get(Calendar.SECOND) + "-"
    + calendar.get(Calendar.YEAR) + "/"
    + (calendar.get(Calendar.MONTH) + 1) + "/"
    + calendar.get(Calendar.DATE));
    String n = calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE);
         System.out.print(n);
         return n;
    I have table name TEST
    ID DATE_IN
    1 942685200
    2 952448400
    When I write jsp I use method setDate in class TimeDate
    The result is
    ID DATE_IN
    1 1999/11/16
    2 2003/7/25
    Thanks you very much.

    It is unclear where you are having a problem.  Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
    Also be aware that you will need to sign your jar and include some new manifest entries.  Refer to the Java 7u51 documentation and blogs that discuss the changes.
    https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
    http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html

  • JNI - how to use java access function in TypeLibrary( .tlb file) HELP ME PL

    Hey All
    I got one project which can be done by calling up functions in xxxx.tlb
    (window type library) file, that is no problem.
    How to use java to access those functions???
    I know there are some classes which can be used to access function in
    DLL file e.g. JAWIN.
    Is the .tlb file related to one DLL file??? if so, how to locate the
    DLL file through .tlb file???
    Thanks a lot.
    Steve

    Use JNI to create a link between Java class and a DLL, then you can load that DLL (or TLB) from that class.
    Read the JNI Tutorials.

  • How to import java Classes in report Builder 10g

    How to import java Classes in report Builder 10g .....
    Arshad

    Hello,
    To import the Java classes:
    Add your jar in the REPORTS_CLASSPATH
    Launch Reports Builder.
    Note:
    You must launch Reports Builder now so that the new REPORTS_CLASSPATH is used.
    Choose Program > Import Java Classes to display the Import Java Classes dialog box.
    Regards

  • How to load java class from jsp page?

    hi all!
    Does anyone know how to load java class from jsp page?
    I try to load java class from jsp page.
    Is it possible to load java class fom jsp page?
    thanks and have a good day!

    What I mean is How to load/open java class file from jsp page?
    I think we can open Applet from jsp page by using
    <applet code=helloApplet.class width=100 height=100>
    </applet>
    but, how to open java class which is an application made by Frame?
    thanks and have a good day

  • How to use TableSorter class with DefaultTableModel

    Hi Friends
    Please tell me how to use TableSorter Class which is in the Java. Tutorials with DefaultTableModel.
    i saw in a thread there it was given that we have to pass the DefaultTableModel to the TableSorter Class.
    I tried to use like that. But i am getting Error Like Exception occurred during event dispatching:
    I am posting the part of Code where i use the DefaultTableModel
         private void displayavailablity(String selectedAuthor)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        rs = st.executeQuery("SELECT BId,BName,BAuthorName,BAuthorandPublisher,BCat FROM Books where BAuthorandPublisher='" +selectedAuthor+"'");     
                        ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"NUMBER","BOOK NAME","AUTHOR","CODE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        TableSorter sorter = new TableSorter((DefaultTableModel)table.getModel());
                        rs.close();
                   catch(SQLException ex)
                        System.out.println("ERROR IS HERE");
                        ex.printStackTrace();
         }Please help me on this issue Otherwise Please give me some Sample coding to implement this sorting. with DefaultTableModel
    Thank you for your service
    Cheers
    Jofin

    I don't know about any TableSorter class, but I suppose you mean javax.swing.table.TableRowSorter.
    The TableRowSorter is to be attached to the JTable, not to the data model. Here's a cut'n'paste from the last time I used it:
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
    myTable.setRowSorter(sorter);
    And heres from the JDK1.6 documentation:
    TableModel myModel = createMyTableModel();
    JTable table = new JTable(myModel);
    table.setRowSorter(new TableRowSorter(myModel));
    Check out http://java.sun.com/javase/6/docs/api/javax/swing/table/TableRowSorter.html. I find it to be good documentation.

  • How to use Java as a Front-end app

    how java application can be used as the Front-end interfaces to Forte based
    applications???
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Rajiv,
    If you have Forte's WebEnterprise product, and Forte version 3.0.G.x or
    later, you have the ability to export an IIOP interface for any Forte
    service object. In fact, you can go one step further and generate a Java
    interface that "hides" the IIOP issues from the developer. The way you do
    this is to do the following:
    1) From the partitioning workshop, double click on the service object you
    wish to expose as an IIOP interface. This will bring up the Service Object
    Properties dialog.
    2) Off the Export tab, set the External Type drop down to IIOP. If IIOP is
    not an available option in the drop down list then you do not have
    WebEnterprise install.
    3) From here you need to set up the necessary IIOP configuration parameters
    (see the documentation for details on the specifics of what the parameters
    control).
    4) If you want to have Forte generate a JavaBean interface and the necessary
    Java classes to be called by your application then make sure you select the
    Java parameter at the bottom of the Configuration dialog. If IDL is
    selected then Forte will generate a generic IDL interface.
    5) When you make your distribution Forte will generate the Java classes for
    you.
    This mechanism works very well for accessing a Forte service object from a
    Java application.
    Good Luck!
    Jeff Wille
    -----Original Message-----
    From: Rajiv Srivastava <[email protected]>
    To: [email protected] <[email protected]>
    Date: Wednesday, December 09, 1998 2:03 PM
    Subject: how to use Java as a Front-end app
    how java application can be used as the Front-end interfaces to Forte based
    applications???
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • How to decode  java class file to java file

    hi
    how to decode java class file into java file
    regards
    kedar

    Its really.......... really BAD.
    Write ur own code... or use open source code..
    Its a bad practice...
    however i am telling u ..there is DJ java decompiler.
    but mind it there are Obfuscator also....like codeshield and others
    take care...
    Alok

  • How to use ArraySequence class???

    Hi ,
    I'm a beginner in programing with java.. I found some troubles with it
    the trouble is HOW TO USE ArraySequence class,
    I need to read a word from the user and broken it down and store each letter in a rank of the ArraySequence,,
    I found an example that breaks a string into words ,,But I never found
    examples that fill an ArraySequence with a built-in types like int or double or char
    Can anybody please help me??!!!!
    some functions of ArraySequence take as parameter OR return (position ) class can you please tell me what does this class do??
    SORRY FOR MY LANGUAGE ,,I'M NOT NATIVE SPEAKER

    There is no ArraySequence class in the API.

  • Help:how to use java.util.jar to zip or unzip a binary file.

    how to use java.util.jar to zip or unzip a binary file or a file contain native code.

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

Maybe you are looking for

  • FLV Playback Component - specifying an image before it plays

    I am using the FLV Playback Component to play a video. Instead of playing automatically, I want to be able to set an image (or a frame of the movie) to display and only play the movie after the user clicks the play button. I can't find anything anywh

  • Screen sharing over the net. Is it possible.

    I was wondering if someone with screen sharing abilities could help out. I was wondering. Is it possible to share screens over the net. For example, my mom is like a 100 miles away. Running Leopard. How could I access her screen so that I could show

  • HT201272 connection with itunes is not possible

    hello, because my device was dead, i got a new one. and i want with my old account to download my purchased apps. i go on device app store, purchased, but when i add my password i get a message that connection with itunes is not possible?? how to sol

  • Is Oracle JDeveloper 12c Studio is an all-encompassing SOA suite?

    Hello, Need some clarification on this whole SOA puzzle.   Turns out there are more than one "current" version of Jdevelopers. Oracle SOA's latest release is 11g.   Jdeveloper Suite latest release is 12c.    When you download SOA Suite from OTN, you

  • Error on script execution

    I have just tried to execute the script from this site: http://hax.by/3ds/index.html With this script I want to make my own Nintendo Zone with Mac address scwitchig to get the most possible contacts. But everytime I try to execute this script I got a