Java collection use within c++ program through CORBA

How I use java.util.collection (i.e. Vector, ArrayList) within c++ program through CORBA (Orbacus 4.xx) with Linux, please help me...

Use CORBA. It's the best way. I had the same dilema and CORBA was my choice. I implemented a server object in C++ that calls existing functions from dlls developed by an other team for a Window based application. The client is represented by a set of servlets that invoke methods on the C++ CORBA implemented server. I preferred to use the Apache + Tomcat combination.
I found JNI difficult to use an not flexible enough.
I did not even planed to try to use Runtime.getRuntime.exec. The overhead and resource usage make this solution impossible for a multiuser web application.
CORBA works fast, is well supported. I found easy to implement both the java client servlets and the C++ servler and I didn't have much knowledge in CORBA.
So my oppinion is to start learning CORBA

Similar Messages

  • How can I call a java class from within my program?

    I was wondering if there's a platform independent way to call a java class from my program.

    Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.

  • I have a program that requires Java 6.  I am running 10.8.2, How do I remove Java 7 to run this program?

    I have a program that requires Java 6.  I am running 10.8.2, How do I remove Java 7 to run this program?

    Try going to the Oracle site - they did have a page showing how to remove Java 7 using the terminal program.
    I followed their instructions and it didn't work for me, but you may have better skills and luck than I.
    This was my starign point;
    http://www.java.com/en/download/help/mac_uninstall_java.xml
    Let us know if this works.

  • One to many relationship using java collections

    I am facing issue on how to store and then retrieve data . In my program which is simple java class i am retrieving data at 3 places from an xml. i need to store this temporarly in particular fashion as data is related and needed to be used later on at end program to generate report.
    first data i am retireving is employee names eg Tom , Reggie, Martha.
    Second data is department (Each employee belongs to 1 or many department ) so in this case
    Tom : Billing
    Reggie : Admin , HR
    Martha : IT
    Third data is Department number (This has 1 : 1 relationship with Department )
    Billing :01
    Admin :02
    HR:03
    IT:04
    So when i am parsing xml first i am getting employee data, then department and lastly department number. I need to store it in collection in such way later on i can retireve and link data and use it.....
    Which java collections i should use....
    Any hints or guidance ....

    Well, the simplest approach is to initially load the employees objects into a List<Employee>. Initially they store the department number only. Then load the departments, probably into a Map<Integer, Department>. Having popluated such a map you then loop through the Employee list, connecting looking up the deparment number in the map and connecting Employee to Department as you wish. (An Employee would probably had a reference to the Department, the Department might contain a List<Employee>).
    The implementations to use depend on how you'll use them. HashMaps are faster than TreeMaps, but a TreeMap orders. LinkedLists are faster to process in sequence than ArrayList, slower to process at random.

  • Running perl programs through java.

    How do i run a perl program through java?
    arg.pl :
    while(<STDIN>)
    print;
    java program that I tried:
    import java.io.*;
    class runtime
        static Process p;
        static BufferedReader stdOutput;
        static BufferedWriter stdInput;
        public static void main(String args[]) throws IOException
            int i = 0;
            try{
                String cmd[] = new String[] {"perl","arg.pl"};
                p = Runtime.getRuntime().exec(cmd,null,new File("./"));
                stdOutput = new BufferedReader(new InputStreamReader(p.getInputStream()));
                stdInput = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
            catch(Exception ex){
                System.out.println("Unable to initiate Process : " + ex);
            stdInput.write("abcd\n");
            stdInput.write("1234\n");
            stdInput.write("efgh\n");
            stdInput.write("5678\n");
            stdInput.close();
            System.out.println(stdOutput.readLine());
            System.out.println(stdOutput.readLine());
            System.out.println(stdOutput.readLine());
            System.out.println(stdOutput.readLine());
    }This works well. But I need to read the output line by line as and when i give the standard input line by line to it.
    I tried the following :
    import java.io.*;
    class runtime
        static Process p;
        static BufferedReader stdOutput;
        static BufferedWriter stdInput;
        public static void main(String args[]) throws IOException
            int i = 0;
            try{
                String cmd[] = new String[] {"perl","arg.pl"};
                p = Runtime.getRuntime().exec(cmd,null,new File("./"));
                stdOutput = new BufferedReader(new InputStreamReader(p.getInputStream()));
                stdInput = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
            catch(Exception ex){
                System.out.println("Unable to initiate Process : " + ex);
            stdInput.write("abcd\n");
            stdInput.flush();
            System.out.println(stdOutput.readLine());
            stdInput.write("1234\n");
            stdInput.flush();
            System.out.println(stdOutput.readLine());
            stdInput.write("efgh\n");
            stdInput.flush();
            System.out.println(stdOutput.readLine());
            stdInput.write("5678\n");
            stdInput.flush();
            System.out.println(stdOutput.readLine());
            stdInput.close();
    }This doesn't work well. It just halts without any output.
    Can anyone help me?
    Edited by: Vijayakrishna on Dec 5, 2007 8:30 AM

    Let me be more specific.
    I want to use a class which will look something like this.
    import java.io.*;
    public class FindAnswer{
        Process p;
        BufferedReader stdOutput;
        BufferedWriter stdInput;
        public FindAnswer()
            try{
                String cmd[] = new String[] {"perl","arg.pl"};
                p = Runtime.getRuntime().exec(cmd,null,new File("./"));
                stdOutput = new BufferedReader(new InputStreamReader(p.getInputStream()));
                stdInput = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
            catch(Exception ex){
                System.out.println("Unable to initiate Process. Error: " + ex);
        public String getAnswer(String question)
            String answer = question;
            try{
                stdInput.write(question + System.getProperty("line.separator"));
                stdInput.flush();
                answer = stdOutput.readLine();
            catch(Exception ex){
                System.out.println("Exception. Error: " + ex);
            return answer;
        public void close()
            if (p != null) {
                try {
                    if (p.getInputStream() != null)
                        p.getInputStream().close();
                    if (p.getOutputStream() != null)
                        p.getOutputStream().close();
                    if (p.getErrorStream() != null)
                        p.getErrorStream().close();
                catch (Exception e) {
                    System.out.println("Exception in Closing Streams - " + e);
    }The perl program takes lot of initialization time. I dont want to run the program foreach question i have. I'll just create an object to this class and find and answer by passing question to the object's getAnswer method. Here, I dont know all the questions in the beginning itself. I'll know one by one only and I should find answer without terminating the process.
    Kindly help me in this.

  • Using palm os emulator through java wireless toolkit!!.....pls help

    I have palm os emulator 3.5 installed.I am trying to integrate it wid d java wireless toolkit 2.2,in addition to d default devices provided by d toolkit.But i hav failed to integrate pose in jwtk.
    i am running midp2.0 and cldc1.1.
    Also i have downloaded d rom files required by d emulator.
    Pls anyone help me!!
    How can i use palm os emulator through java wireless toolkit?
    thanking you
    shivam sahai

    hi,
    I hope that you already have the J2ME Toolkit and that your emulator works okay. In the toolkit you get several examples to show you how to program a MIDlet. One has to do with a HTTP client server connection. Also in the API documentation for the J2ME there is a Connector class that you used to set up this communication and in the description of this class it pretty thoroughly explains how to set up an HTTP protocol client.
    However, if you want to do some other kind of networking then you are pretty much out of luck, as the TCPIP socket protocol has not been fully implemented and is optional to the J2ME specifications, only the HTTP protocol is certain to be available. This means that mobile phone companies can add other networking functionality to their phone's java virtual machine if they feel like it. This is a bummer I know.
    I hope this helps.
    Cheers,
    Mark

  • Possible to keep contents of Java Collection after closing program??

    Hiya
    Is there any classes in the java library that allows you to save contents of a collection such as HashMap/ArrayList etc into a so called offline collection so that next time when start up of program the contents wont disappear? Because i know when you close a program, the contents of the collections is obviously discarded and resetted for next start up of the program.
    Or is there a way to do that?
    In general i want to keep contents that are in a java collection during its use in a program session so that next time starting the program up again the collection content is still there.
    Thanks.

    Also, remember when u serialize a class every element of it should be serializable .What happens if the class elements not all are serializable? Does that mean i cant serialise that class?
    *all i want is to serialise a class which has a HashMap. The hashmap is the object which i want to serialise.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Running Java programs through a GUI

    Hi All.
    I have a Java GUI which compiles and runs other Java programs through the use of JButtons.
    The user clicks one button to compile and another to run. Compile is running fine but Run is slightly odd.
    When I click the Run button the Java program does not run until I minimize the GUI or switch to another window or application.
    So for example I click the Run button, nothing happens, I then alt+tab or minimize to say NetBeans (which I am using to develop it) or an IE window. The program then runs successfully
    My method for running the program is:
    public void clickRunProgram() {
            try {
                Runtime r = Runtime.getRuntime();
                r.exec("cmd /c java Testing");
            catch (IOException ex) {
                Logger.getLogger(ProgrammingEnvironmentGUI.class.getName()).log(Level.SEVERE, null, ex);
        }Any ideas?
    Cheers.
    Edited by: lobrien9 on 25-Mar-2008 12:57

    You must give the process its input and get its output or it won't run. Try something like this:
            // create the process to test
            Process acm = Runtime.getRuntime().exec("cmd /c java Testing");
            // send input
            PrintWriter processOut = new PrintWriter(acm.getOutputStream());
            processOut.print("input");
            processOut.flush();
            processOut.close();
            // get output
            StringBuilder givenOutputBuilder = new StringBuilder();
            BufferedReader processIn = new BufferedReader(
                    new InputStreamReader(acm.getInputStream()));
            String line = processIn.readLine();
            while (line != null) {
                givenOutputBuilder.append(line + "\n");
                line = processIn.readLine();
            }

  • I want to do rpc programming through java how can i do it?

    i want to do rpc programming through java how can i do it? any classes for it? i am not goin to use rmi its an assignment for us in syllabe help is strongly needed

    So, you are in a class. You are a student, your job is to learn something. Unless your instructor has failed horribly in his/her duty, then you are failing in your duty as a student.
    Your lack of even trying hurts me personally as a life-long student, I find your post ill-advised.
    Please, do not post to these forums anymore. Thank you.

  • I am trying to use an education program that needs Java applets to install and use and it will not use Safari. When I download IE from the web it will not install. How can I get a browser that will work on my MacAir for travel use of this program?

    I am trying to use and education program that needs Java applets and it will not run on Safari. IE will not install from the web. How do I get a browser that will work to install so I can use this program when I travel.

    Try using FireFox. IE will only run on a Mac if you run Windows on the Mac.
    Windows on Intel Macs
    There are presently several alternatives for running Windows on Intel Macs.
    Install the Apple Boot Camp software.  Purchase Windows 7 or Windows 8.  Follow instructions in the Boot Camp documentation on installation of Boot Camp, creating Driver CD, and installing Windows.  Boot Camp enables you to boot the computer into OS X or Windows.
    Parallels Desktop for Mac and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  Parallels is software virtualization that enables running Windows concurrently with OS X.
    VM Fusion and Windows XP, Vista Business, Vista Ultimate, or Windows 7.  VM Fusion is software virtualization that enables running Windows concurrently with OS X.
    CrossOver which enables running many Windows applications without having to install Windows.  The Windows applications can run concurrently with OS X.
    VirtualBox is a new Open Source freeware virtual machine such as VM Fusion and Parallels that was developed by Solaris.  It is not as fully developed for the Mac as Parallels and VM Fusion.
    Note that Parallels and VM Fusion can also run other operating systems such as Linux, Unix, OS/2, Solaris, etc.  There are performance differences between dual-boot systems and virtualization.  The latter tend to be a little slower (not much) and do not provide the video performance of the dual-boot system. See MacTech.com's Virtualization Benchmarking for comparisons of Boot Camp, Parallels, and VM Fusion. A more recent comparison of Parallels, VM Fusion, and Virtual Box is found at Virtualization Benchmarks- Parallels 10 vs. Fusion 7 vs. VirtualBox. Boot Camp is only available with Leopard and later. Except for Crossover and a couple of similar alternatives like DarWine you must have a valid installer disc for Windows.
    You must also have an internal optical drive for installing Windows. Windows cannot be installed from an external optical drive.

  • Read from a .db file and use the values within a program

    each account has 3 values.. (password, balance,id_number)
    my .db file contains the following.
    pass201 250 9885 pass202 300 5547 pass203 700 1123
    (this is 3 accounts)
    I need to be able to read from this file and use each attribute within my program... HELP!

    String[][] accounts = null;
    try
         // Open a file input stream
         FileInputStream fileContents = new FileInputStream("filename");
         byte[] data = new byte[fileContents.available()];
         fileContents.read(data);
         fileContents.close();
         String contents = new String(data);
         StringTokenizer values = new StringTokenizer(data); // using space character as delimiter
         // Using 3 values per line
         int lines = (int)(values.countTokens()/3);
         int columns = 3;
         accounts = new String[lines][columns];
         for(int i=0; i<lines; i++)
              for(int j=0; j<columns; j++)
                   accounts[i][j] = values.nextToken();
    catch(Exception error)
         // debug stuff
    }

  • Using Terminal to program and test java.

    I bought a book on java and it says I should not use a JDK when first learning java.
    Right or wrong I would like to know how to use terminal to program and compile simple scripts.
    So my question is:
    How do you go about setting up the computer to use terminal to write and compile a java program?
    I know that’s pretty big question. I just need a link to some info on how to get started using terminal and java.
    If I use a text editor how do I set up a path to it using javac?
    Where can I find or link to this kind of info?

    David Bixler wrote:
    I bought a book on java and it says I should not use a JDK when first learning java.
    I think they mean IDE, considering that Java is the JDK. And I agree with that idea, not just for Java, but for any language.
    How do you go about setting up the computer to use terminal to write and compile a java program?
    There isn't anything to setup. Just run Terminal and type "vi hello.java" or "nano hello.java". To compile, type "javac hello.java".
    I know that’s pretty big question. I just need a link to some info on how to get started using terminal and java.
    That is not necessarily a big question, just fundamental. Try Google. It becomes second nature after a couple of decades so I don't really know where to tell you to look. People do tend to have a big list of links, hopefully they can contribute some.
    If I use a text editor how do I set up a path to it using javac?
    It should already be in your path.
    Where can I find or link to this kind of info?
    Try Google. People like it. You should find many pages similar to this.

  • How to use a Matlab Program within Labview

    Hi
    I saw in this forum that many users are using some matlab program
    executed in Labview program. I have actually Labview 7.1 and would like
    to use some of my matlab program in Labview. Is there an easy way to do
    it ?
    Thanks
    Thomas

    The MATLAB Script function is kinda buried in the function palette, and
    can be found under Functions >> Analyze >> Mathematics
    >> Formula.  Unfortunately this feature is not available in
    the LabVIEW Base package.  Hope this helps!
    Andy F.
    National Instruments

  • Can not locate Java class using JNI within C++ DLL

    I am using trying to use JNI to call a Java class from C++. The Java class uses JMS to send messages to a JMS message queue. At first I coded the C++ in a console application that created the JavaVM and used JNI to access the Java class. All worked fine. Then I called the Java class using JNI from threads and ran into the problem of the Java class not able to locate the JMS related classes. This was solved by placing the following line in the constructor of the Java class.
    Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
    Then I moved the JNI code from a console application to a DLL in specific an extension DLL that is called by SQL Server or Oracle server. The DLL will use JNI to call the Java class and send messages to a JMS message queue.
    The problem I am having now when the DLL code is called by SQL Server the call to
    JNI_CreateJavaVM
    appears to work correctly but the call to find the Java class using
    jvmEnv->FindClass(pName)
    fails. It appears the is a class loading problem which occurs due to the fact JNI is called from a DLL. When the VM is created I pass the class path information using the statement
    -Djava.class.path=
    And as I stated before it all works when running from a console application. I am new to JNI and really need help in the form of some sample code that will solve this problem. I believe I need to somehow load the classpath information from the DLL but I can not find examples on how to do this using JNI. I have tried several ways using URLClassLoader and getSystemClassLoader from JNI and either it does not work or it crashes very badly.
    I used the following code to determine what the existing class path is and the string returns empty.
    jcls = jvmEnv->FindClass("java/lang/System");
    jmid = jvmEnv->GetStaticMethodID(jcls, "getProperty", "(Ljava/lang/String;)Ljava/lang/String;");
    jstrClassPath = jvmEnv->NewStringUTF("java.class.path");
    jstr = (jstring)jvmEnv->CallStaticObjectMethod(jcls, jmid, jstrClassPath);
    m_jstr = (jstring)jvmEnv->NewGlobalRef(jstr);
    pstr = jvmEnv->GetStringUTFChars(m_jstr, 0);
    Can anyone please help with example code that will solve this problem. Thanks in advance for any help.
    Charles�

    I have determined the problem occurs when the application/component is compiled using VC 6.0. The test application was compiled using VC 7.1 and works correctly by locating the class path information. If the test application is compiled using VC 6.0 it has the same problem.
    The jvm.dll I am using is version 1.4.2.80. Currently this is not an option to compile all the applications that use JNI using VC 7.1 so can someone please tell me how to solve this problem.

  • New to JAVA, but old school to programming

    Objects & Classes & Methods, Oh my!
    I'm pretty new to java, but I've been programming in several languages over the years. I thought it was about time to update my skill set, especially with the job market as it is today. I wanted to go JAVA because it's not specific to any environment.
    I picked up a begining JAVA book and was a little confused. When I was learning programming a program was called a program. a peice of code in a program called by a statement was called a subroutine (it was performed then control returned to the calling line and continued).
    Now I'm trying to make sense of everything I have read so far and trying to relate it back to my old school of thinking. I was hoping it would make it easier to retain and I could expand it as I learn and possibly realize that it IS different. I know it's a new way of thinking, but stay with me for minute.
    What I used to call a program is now a CLASS in JAVA (this can be a collection of code or other objects). A sub-routine in a CLASS is a Method. I know that the language part will come as I use it since I understand if's then's and whatever you use to gosub or goto, but I want to make sure I have down the lingo before I go to deep.

    I have no idea how you can compare Java to Cobol.
    DataFlex? How about that! In about '84 I switched to
    DataFlex from dBaseII. In '91 DataFlex changed from
    procedural to OOP. It took most of us at least a year
    to adjust, and then some to write concrete code. It
    was tough. They had bugs and we were limited with DOS.
    BUT, it was a great OOP training experience. Anyhow,
    needless to day Java is miles ahead on all fronts.Small world. I was stuck in the old DataFlex Ver 2.3 at that time. The company I worked for had the newer OOP package. I did get to work with it some, but not enough to become totally familiar with it. We started to move out of DataFlex towards PowerBuilder towards the end of 1995. I did get some OOP from that experience, but again only enough to learn about global variables, instance variables, and a few other items. I hoping that I will be able to get the solid OOP background that I need from JAVA since I hear through the grapevine that it may be a new tool that we will be looking at to enhance our programming. I was looking at PERL but even the PERL programmers we have agree that JAVA is more scalable.

Maybe you are looking for

  • Date format in a tabular form

    I can create a date field (with date picker) in a tabular form created manually. However, I cannot change the format to mm/dd/yyyy. I am using the wwv_flow_item.date_popup package. Thanks!

  • Post Dated Checks

    Hii All, We want to issue PDC through F110 agt vendor invoices in Next Fiscal Year ie 2009 but when we run payment in f110 it issues a message Payment run carried out & do not post any entry.In log it shows a message no ranges for Fy 2009 Now my ques

  • Can I use Firefox Sync on a public computer, as I did with Xmarks?

    I am going to miss Xmarks. How can I use Firefox Sync when I go to an internet cafe?

  • SSRS-Hyperlink to a folder Error messages

    Hi All,  I developed a report with hyperlink on a textbox. When user clicks to this hyperlink it should go to a network folder. I'm able to achieve this functionality using Javascript windows.open functionality. My requirement is need to replace the

  • Lotus Traveler meeting notification time is off on iOS 6

    I had been leaving my time zone adjustment to manual to prevent messing up with Lotus calendar until last week.  I had enough issues due to the wrong time zone that I finally caved in and let my iPhone automatically adjust the time zone wihle on the