New to Java -- Need to know if something is possible

We have an application in which some complex calculations are being done in MatLab. In order to speed things up, we are converting it to C/C++. But there is also a GUI in the MatLab code. This is all to run on Windows.
We will eventually (2 - 4 months from now, after it has been successfully converted and running) need to also port it to Linux. I am thinking that I would like to write the GUI portion in Java, so that it can be easily transferred from Windows to Linux.
There is also an "embedded" portion running in C/C++. This must remain in C++ in because it is a real-time application where literally each microsecond will matter, Java will be too slow. In addition, some of the calculations will run on a parallel processing board, and the COTS libaries that support running on the card are C/C++ libraries.
So, what I want is, to make a Java GUI that I can move from Windows to Linux, and in this GUI, each of the callbacks will then do nothing but call a C++ routine. I need the C++ routine to run completely independent of the Java Virtual Machine, to preserve the speed of the C++ library.
My questions:
If I write the GUI in Java, and have separate libraries/fucntions in C/C++ that are compiled for both Windows and Linux, can the Java GUI call these, and will they run as fast as they would in a normal C++ app? Or will it be slowed down by the JVM, and run at "interpreter speed"?
How do you call the C++ code from inside a Java interpreter? Do we compile it all in a dll, and the dll is called from Java? Do we make a C++ library, and that can be called from the Java GUI? Or is there something else. This must have been done many times, does anybody have any suggestions or experience to get me going. I think I can glom together a simple Java GUI ( I produced some Java programs several years ago), and I can get the C++ libraries going, it is connecting them that I could use some guidance.
Thanks.
- Martin

georgemc wrote:
DrLaszloJamf wrote:
georgemc wrote:
DrLaszloJamf wrote:
georgemc wrote:
Ignore the myth that Java executes slowly because it's "interpreted". It's notHear, hear. Brian Goetz is a good source of Java myth debunking. Check out his columns:
http://www.ibm.com/developerworks/views/java/libraryview.jsp?search_by=practice:
Indeedie. Here's his article I like to trot out on occasions such as this
http://java.sun.com/developer/technicalArticles/Interviews/goetz_qa.html
I love to point out on some benchmarks, Java can be faster that C. "Faster than C? That's impossible!", people sputter, as if C were a physical constant, like the speed of light -- that's "c", folks!That's borne out of the misconception that any operation in Java is simply translated by the runtime into a similar operation in native code, and, were that the case, they'd probably have a point. It completely ignores runtime optimizationsAnd other things like Java's object allocation/GC being superior to malloc(), ...

Similar Messages

  • I need to know if it is possible to...

    I bought a new computer...
    and i am NOT creating a home network between the two...
    It is possible for me to have internet on both computers at the same time to accomplish the following objective, but the internet on my orignal computer will not be permanent.
    I need to know if it is possible to transfer my entire iTunes library exactly as is from one computer to another...
    either by internet, or by transfering by DVDs or anything.
    Again this has to be more than sharing, it has to be a complete transfer as the internet on the computer with iTunes already set up is not permanent.
    If anyone could help me i would be extremely grateful
    The original computer is a an HP pavilion PC, the second computer is a Notebook HP pavilion.
    THANK YOU.

    You can burn data CD's or DVD's of the content of your library, use those data discs to make the transfer to the second system. If all of the content is on an iPod, you can use your iPod to make the tranfer. see the following. Post back if you have any questions.
    http://docs.info.apple.com/article.html?artnum=300173

  • Very New to Jave, need to do totals/subtotals

    Hi, (I hope this is the right place)
    I'm VERY new to Java (I mainly do wourk with php interfaces for MyAQL databases).
    Up until now, there hasn't been anything I couldn't do with PHP that I needed to...
    My boss recently requested subtotals/totals at various points on an input sheet. The sheet inputs numbers of people, so I'm not worried about rounding (The php already takes care of people trying to input parts of people....) or tax.
    It's a rather large form (~144 lines) and the math is already in place to do the subtotaling (among other things) before entering the information into the database.
    How would I go about writing script that would display sub totals, and recalculate them every time one of the boxes value's is modified?
    Is this something javascript is designed to do? Is there a better language out there for this task?
    I've found sites out there that have canned subtotal/total scripts, but I don't want something pre-made unless it comes with a detailed explaination of what everything does; if I'm going to maintain it, I have to understand it.
    Thanks

    Is this a web form? e.g. a html form with input fields?
    You can add onchange or onblur events to your input fields to detect changes. Then you can use javascript to retrieve the values from the form and do the calculation.
    -S

  • New to java needs advice

    Hi,
    I'm completely new to java and after a few days search found Studio Creator and decided to use it. Happily developing for a week in JSC, I reached the deployment to Tomcat stage.
    Mybe I'm missing something but I find this stage ruining the ease-of-use feeling which I got when I started using JSC.
    Am I right that JSC doesn't have a built-in functionality to deploy to Tomcat whithout my intervention, considering my total unfamiliarity with xml, jsp, mysql, etc.?
    If so do you guys know of another easy-to-use IDE like JSC?
    Any pointers are greatly appreciated.
    Thanks, Abraham

    Hi,
    Try this FAQ on
    How do I deploy web applications developed with Java Studio Creator to the Tomcat Servlet/JSP Container?
    at http://developers.sun.com/prodtech/javatools/jscreator/reference/faqs/technical.jsp
    MJ

  • Hi, i'm new to java. need help setting the path in win XP

    hi all,
    i'm new to java technology. i've just downloaded the JDK and ran my first java program (hello world). i love it. java's gr8. i need help. i run win XP and how can i setup the path sothat i can execute my programs from the root dir??? any help in this direction will be greatly appreciated. please email me @ [email protected]
    Best regards
    Mrinal

    Go to Start menu and select Control Panel. In the Control Panel, double click on System. In the System dialogue, choose the Advanced tab. Then click on Environmental Variables. Select Path and Edit. Put ;c:\j2sdk1.4.0\bin at the end of the Path (or c:\j2sdk1.4.0\bin;) at the start of the Path. That's it.

  • New to java(need help on access specifier)

    hi! i am new to java.plzzzzz help me i have to make a project on access specifier's i know all theroy.but
    i am unable to understand how i can define all specifiers practicly.i mean in a program.
    thanks.plzzzzzzzz help me

    the most common project i can think of is a payroll system..
    you can have real implementation of all the access specifiers
    good luck

  • Need to know if this is possible...

    It has been a while since I've worked in Java, so I'm not even sure what I'm wanting to do is possible. The basic principle behind what I'm trying to do is a print queue, here are the specifics:
    1> Files in either PDF or .xlsx should be loaded into a folder called DailyPrint on a network drive. (We'll call it's path Z:\Invoices\Dailyprint)
    2> at the end of the day someone in the office who is not tech savvy needs to be able to print 3 copies of every file in the folder.
    3> The paper in the tray is loaded in the following color scheme : White, Yellow, Red (3 part invoice paper)
    4> The print job needs to print out the files in the following order so that we get a white, yellow and red copy of each file: 0001.pdf (first copy); 0001.pdf (second copy); 0001.pdf (third copy); 0002.pdf (first copy); etc; etc.
    5> The printer that these will print to is a network printer, not hooked to any particular station.
    The following information is static, and would have no reason to let people change it:
    The printer to be used
    The paper tray to be used
    The path to the Folder
    The number of copies (hard coded to 3)
    The order in which the files/copies are printed
    I know that printing from PDFs has been called difficult in other discussions, and I know that I would probably have to use a DocFlavor line to make sure that it printed them correctly, but I need to know if what I am trying to do on this project is possible or if I'm going in a completely wrong direction. Any help would be appreciated.
    Thank you in advance.

    The biggest concern for us is the batch aspect, due to the fact this is not a dedicated printer, so it is better for us to tie it up for 20 minutes at the end of the day rather than constantly put 3-part paper into the printer for each invoice. We only have one computer with the full Adobe Acrobat, the rest have Microsoft's "Save as PDF" plug-in for Excel/Word, so we can make each file into a PDF but at the end of the day when we want to batch print all of the invoices for the day we could only come up with 3 possible senarios:
    1> Stop producing invoices 1 hour before end of day, and have one user go into the "dailyprint" folder from the computer with Acrobat, compile all of the individual PDFs into one massive PDF and then do a group print of three copies.
    2> Stop producing invoices 1 hour before end of day, separate the invoices into several groups and have the 3 people in our department (it's a very small office, I'm both the technical lead and an underwriting assistant.) print them out, doing three copies of each (and hoping that someone doesn't forget to change the "copies" setting to 3)
    3> Write a program or find a program that would allow us to batch print 3 grouped copies of each file in the "dailyprint" folder.
    Because I used to program a lot in Java I figured I would look into #3 and see if it would be a time saver or if option #1 would be better. I think our next biggest concern would be to make sure that it printed to the correct printer, which is why I was wondering about hardcoding the specific printer in the program. After looking through the Print Service API guide and seeing people's responses it does look like a program would be possible, but hard coding the printer, or even giving a drop down box to select which printer, is going to be the hard part of this whole thing.

  • New to Java need to parse a page on HTTPS server

    Greetings:
    I am writing a "widget" on Macintosh that goes out and gets a simple piece of information from a page within a secure sever (HTTPS).
    The big picture is: I need to send login information which is stored in a JavaScript form to a java application that would go to the https site and login and then go to a page and parse it for a number. This has been done in Perl originally but the Perl requires a specific library added to your system. My java application needs to pass the number back to JavaScript and hence a number will show up in my widget's window. There will be no browser involved... the widgets are JavaScript/XML based.
    I would need a good example of code to do this as I am VERY new. If anyone can help please let me know.

    http://onesearch.sun.com/search/developers/index.jsp?charset=UTF-8&qt=%2Bparse+%2Bhttps&col=javadoc&col=devforums&col=javatecharticles&col=javatutorials&col=devarchive&col=javasc&col=devall

  • New to Java, need assistance

    First, I'd like to apologize in case this post is in the wrong place.
    Now I'm new to Jcreator and I missed about a month from my computer programming class in school, and am far behind. My assignment right now is this problem p5.12 from Computing Concepts with Java Essentials it says:
    "A year with 366 days is called a leap year. A year is a leap year if it is divisible by 4 (for ex.,1980). However, since the introduction of the Gregorian calender on October 15, 1582, a year is not a leap year if it is divisible by 100 (for ex., 1900); however, it is a leap year if it is divisible by 400 (for ex., 2000). Write a program that asks the user for a year and computes whether that year is a leap year., Implement a class *Year* with the method *boolean isLeapYear*
    This is the code that I came up with:
    import javax.swing.JOptionPane;
    public class LeapYear {
         public static void main(String[] args) {
              String input = JOptionPane.showInputDialog("Enter Year");
              double year = Double.parseDouble(input);
              LeapYear newYear = new LeapYear(year);
              System.out.println(newYear.boolean isLeapYear()); //line 11
    public class LeapYear {
         private double year;     
         public LeapYear(double year)
                   a = year;
              public boolean isLeapYear(){
                   if(a % 4 == 0)
                             if(a % 100 != 0) System.out.println("Leap Year");
                   else if (a % 400 == 0) System.out.println("Leap Year");
                   else System.out.println("Not Leap Year");
    The error I am receiving is on the 11th line of the test class. I know if there is something wrong besides that. I'm not asking for someone to fix this for me but I would like if somebody could give me advice on what to do, hints, explain where I went wrong, or know of any good tutorials I could read that could help me with this it would be much appreciated.

    Year           Is Leab Year?
    1           no      
    4            yes
    1580            yes
    1582           no      
    1584            yes      
    1600            yes      
    1700            no      
    1800            no      
    1900            no      
    1996            yes      
    1997           no      
    1999            no      
    2000            yes      
    2100            no      
    2200            no      
    2300            no      
    2400            yes      
    2800            yes      
    2900            no      
    3200            yes      
    3300            no      
    3600            yes      
    3800            no      
    4000            yes      
    4200            no      
    4400            yes      
    4700            no      
    4800            yes      
    5100            no      
    5200            yes      
    6400            yes      
    6500            no      
    6800            yes      
    6900            no      
    7200            yes      
    7400            no      
    7600            yes      
    7800            no           

  • New to java, need a applet loop

    Hello, I am trying to create a simple double buffering tile drawing applet based on a two dimensional map array. I have it working fine, however I would like to create a main loop which will keep calling pain() until the escape key is pressed. Can someone please show me how I can do this? Would I need to call repaint() in paint() until escape is pressed? Here is my code.
    import java.awt.Graphics;
    import java.awt.Image;
    import javax.swing.ImageIcon;
    import javax.swing.JApplet;
    public class Tile_engine extends JApplet {
      private final int TILE_MAX = 4;
      private final int TILE_SIZE = 32;
      private final int APPLET_WIDTH = 640;
      private final int APPLET_HEIGHT = 480;
      private final int SKY = 0;
      private final int CLOUD_1 = 1;
      private final int CLOUD_2 = 2;
      private final int RED_BRICKS = 3;
      private final int MAP_ROWS = 15;
      private final int MAP_COLS = 20;
      private Image buffer = null;
      private Graphics bufferg;
      private Image[] tile = new Image[TILE_MAX];
      private final int map[][] =
        {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0},
         {0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0},
         {0,0,0,0,0,0,3,3,0,0,3,0,0,0,0,0,0,0,0,0},
         {3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3},
         {3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3}};
      public void init( ) {
        tile[SKY] = getImage(getDocumentBase(), "sky.png");
        tile[CLOUD_1] = getImage(getDocumentBase(), "cloud_1.png");
        tile[CLOUD_2] = getImage(getDocumentBase(), "cloud_2.png");
        tile[RED_BRICKS] = getImage(getDocumentBase(), "red_bricks.png");
        buffer = createImage(APPLET_WIDTH, APPLET_HEIGHT);
        bufferg = buffer.getGraphics();
      public void paint(Graphics g) {
        if(buffer != null) {
          int tile_id;
          for(int y=0;y<MAP_ROWS;y++) {
            for(int x=0;x<MAP_COLS;x++) {
              tile_id = map[y][x];
              bufferg.drawImage(tile[tile_id], x * TILE_SIZE, y * TILE_SIZE, this);
        g.drawImage(buffer, 0, 0, this);
    }

    Isn't %d an integer? You are passing a double. You need to use the correct formatting type for a double.
    When posting code, please use code tags (see button above posting box). It makes the code much easier to read.

  • New to DAQ, need to know if it will do what I need before I spend

    I am looking at Labview and a DAQ board for my aplication. Starting from scratch.
    I need to make an automated life cycle tester.
    My test routine sequence:
    1) Switch circuit board on (120VAC source)
    2) Square wave (Pic) out at 20hz for 10 seconds (200 pulses)
    3) Switch the circuit board off for 3 seconds
    4) goto 1)
    I would like to count the number of cycles completed on my display(1-4 above)
    During the cycle I would like to indicate the number of missing output pulses from my square wave at 2 or 3 points and display that number missed.
    Later I might like to add a thermistor and drive a heat source to monitor test under extreme temp conditions.
    What I'd like to know is if Labview and something like the NI DAQPad-6016 meet my needs to accomplish this?
    My needs are pretty modest. Nothing we make is running very fast.
    I'd like to drive a relay from the DAC board to power the circuit board.
    Evetually I'd like to make some multi-head automated exercisers for my circuit boards for pre-packaging test purposes. I want o monitor voltages in a few key places as well.
    Will Labview and DAQ boards get me there?
    Appreciate any help

    a digital out will not have the current sink rating to drive a relay directly, unless it is a very special relay, so you need to look at options there, like the use of a solid state relay or a transistor driver for the relay.
    Other than that, you can set up those things in MAX, either as tasks or global channels, and call them from LabVIEW, and it should be quick to get going.

  • New to java-need help for debugging

    hey there
    i just wanted my first program in java and here it is below with the error when i'm compiling it, i cant understand whats wrong:
    public class SquareArea {
    public static void main(String[] args); {
    float length;
    float width;
    float SquareArea;
    System.out.println ("Please enter length"+ length);
    System.out.println ("Please enter width"+ width);
    SquareArea= length*width;
    System.out.println ("The area of the square is" + SquareArea);
    The error is:C:\Documents and Settings\User\Desktop\SquareArea.java:5: missing method body, or declare abstract
    public static void main(String[] args); {
    ^
    1 error
    Tool completed with exit code 1

    Reading inputs from the command line is a bit complicated in java, here is how it is done:
    first add the line:
    import java.io.*;to the beginning of your program.
              float length;
              float width;
              float SquareArea;
              BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
              try
                   System.out.println ("Please enter length:");
                   String lengthStr = reader.readLine();
                   length = Float.parseFloat(lengthStr);
                   System.out.println ("Please enter width");
                   String widthStr = reader.readLine();
                   width = Float.parseFloat(widthStr);
                   SquareArea= length*width;
                   System.out.println ("The area of the square is" + SquareArea);
              catch (IOException ioe)
                   System.out.println("Error reading values.");
                   ioe.printStackTrace();
              }

  • HT201401 have damaged iphone 6 that I replaced with a new one and need to know how to transfer from the old to the new phone.

    I dropped my original iPhone 6 and thus crushed the glass cover. I purchased a replacement, same model iPhone 6 128mg, and I've restored from my backup in iTunes and iCloud but now after updating the new phone it displays an error that the states can't restore because 'find my iphone" is on. I disabled this on the new phone as well as the damaged one, is it possible I'm missing something?
    Thomas
    <Personal Information Edited by Host>

    What exactly are you doing when you get that message?  That should only occur if you are trying to restore it via iTunes (and you can only restore from iCloud or iTunes, not both).
    Also, don't post your personal information like your email address on this forum.  That's not only a violation of the Terms of Use of this forum, but also an unwise idea to give out your email address (and possibly Apple ID) to complete strangers.

  • New to Java-Need book that explains OOP concepts

    Hi-
    This as a great forum!
    I have been programming in VB for a while and now I'm trying to learn Java. Can someone please tell me which book is best for learning concepts like objects, classes, visibility etc; Most of the books I have seen go too fast or do not cover enough detail. I would like to find something that has lots of examples (diagrams are nice) and covers OOP thoroughly.
    Thanks!
    Ken

    The "Head First" books might be a good, gentle intro:
    http://www.amazon.com/Head-First-Object-Oriented-Analysis-Design/dp/0596008678/ref=pd_bbs_sr_1/104-1237750-7651950?ie=UTF8&s=books&qid=1184865003&sr=8-1
    %

  • Lost Bridge when hard drive crashed.  Restored bridge on new computer. Recovered hard disk using DiskWarrior but cannot rebuild directory due to critical errors. Now need to restore just photos to new computer.  Need to know which file in Bridge photos re

    After multiple recovery attempts I finally used DiskWarrior to download saved files/folder/applicatiions to external hard drive.  I cannot get old version (5.0) of bridge to run.  Redownload Bridge (5.1) but still need to recover my photos.
    Any advise on how this can be accomplished.

    Bridge is only a browser. It does not contain any files. You need to find out where you saved your photos, and hope they are still accessible on the crashed drive... Just copy them over to your new drive.

Maybe you are looking for

  • Error in my tabular form

    Hello I'm getting an error on my tabular form, it is layed out as so:   [ ]  Title      Lastname   Firstname   Company   Email [ ]  Mr/Ms/Mrs  [       ]  [        ]  [      ]  [        ]-first column is a checkbox -'title' is a select list default va

  • Adding text to javascript pop up window

    I am opening a pop up windows with javascript from my Flash movie that works fine. Each opening window has a video in it. Now what I'd like to do is add text under/above the quick time movie inside the pop up windows. I'm not very savvy with programm

  • Search option in tracklist/playlist in nokia 5310 ...

    Hi, I am having nokia 5310 xpress music. I am looking for the search option in playlist. sometimes playlist is too long and you are looking for a particular song to be player then I need to scroll down the whole list to find the related song. I am ha

  • F-47 Configuration

    Hi All, "Due on" feild has been set as mandatory in transaction F-47. Can any one please let me know on where to check for the configuration settings for the same. Help would be really appreciated. Regards Prashant

  • Upgrading from trial version

    I currently have a trial version of photoshop elements 11 and have been given a present of the full version on disc. Should I uninstall the trial version before uploading the disc or what is the best way to do it.