Performance of Java math code vs. Python

Hello,
Not to spark a religious war, but I'm curious: The November 2008 issue of Linux Journal has an article about Scientific Computing. In it, the author demonstrates how to use Python for doing number crunching. He compared Python to C. So I want to compare Python to Java.
I did this: created a file called matrix.py . Its contents are:
import numpy
a1=numpy.empty((500,500))
a2=numpy.empty((500,500))
a3=a1*a2Then I ran it, by doing:
time python matrix.py...on multiple occasions. I'm doing this on a Fedora 9 machine and figure it will buffer the disk read of the python interpreter. Anyway, it finishes in about 0.18 seconds (realtime).
Subsequently, I created a similar piece of Java code:
public class Test {
     public static void main(String args[]) {
          long start=System.currentTimeMillis();
          double a1[][]=new double[500][500];
          double a2[][]=new double[500][500];
          double a3[][]=new double[500][500];
          int i, j, k;
          for (i=0; i<500; i++) {
               for (j=0; j<500; j++) {
                    a3[i][j]=0;
                    for (k=0; k<500; k++) {
                         a3[i][j] += a1[i][k] * a2[k][j];
          long end=System.currentTimeMillis();
          end = end - start;
          System.out.println("Duration: " + end);
}...For Java, I didn't use time(1) to time the run, rather I used System.out.println from within the code. This is because I don't use Python so I didn't want to spend the time to learn how to do the time math as I did above, and also I figure that in everyday use the load time of the JVM would incur a startup penalty which I didn't want to measure. In short, I deliberately put Python at a disadvantage because I'm lazy. I figured I could learn a little Python and correct the issue if necessary.
Turns out, it's not necessary, because the Java code takes 1.5 seconds! That's 8-9 times slower than Python on this multiplication problem. What gives? Is Java just that slow? I thought that by this day and age it would be fairly optimized...
Thanks for the cluestick, in advance... :-)
-Hushpuppy

Thanks mlk and sabre150. It turns out, numpy is an optimized math package. To really run a test, I'd have to compare numpy to say JScience (http://jscience.org/). So I'm comparing apples to oranges.
Anyway. Just for fun, I ran the code a few times so the JIT could do its thing. Doesn't seem to be doing a lot of optimization; my guess is there's not a lot more it could do. Here's what I got:
Output:
Duration: 1123
Duration: 1107
Duration: 1086
Duration: 1087
Duration: 1081
Duration: 1083
Duration: 1079
Duration: 1087
Duration: 1079
Duration: 1081Program:
public class Test {
     //double a1[][]=new double[500][500];
     //double a2[][]=new double[500][500];
     //double a3[][]=new double[500][500];
     static int a1[][]=new int[500][500];
     static int a2[][]=new int[500][500];
     static int a3[][]=new int[500][500];
     static long start;
     static long end;
     static int i, j, k;
     public static void multiply() {
          start=System.currentTimeMillis();
          for (i=0; i<500; i++) {
               for (j=0; j<500; j++) {
                    a3[i][j]=0;
                    for (k=0; k<500; k++) {
                         a3[i][j] += a1[i][k] * a2[k][j];
          end=System.currentTimeMillis();
          end = end - start;
          System.out.println("Duration: " + end);
     public static void main(String args[]) {
          int l;
          for (l=0; l<10; l++) {
               multiply();
}

Similar Messages

  • Cast to a literal (ex. "java.math.BigDecimal")

    I have an array with 2 columns like:
    "java.math.BigDecimal", "2"
    "java.lang.String", "Test 01"
    "java.math.BigDecimal","120"
    "java.math.BigDecimal","148"
    "java.lang.String", "Test 02"
    Is there way to cast the second string to the correct object type, using the first string.
    Something like this:
    ("java.math.BigDecimal")("2")
    ("java.lang.String")("Test 01")
    thanks in advance,
    intovoid

    You could do this by reflection for classes which
    have a contructor which takes an single string
    parameter - which I believe all these classes do.
    Lot's of messy expections to field. The sequence
    would be something like:
    private static Object create(String[] columns) throws
    Exception {
    Class clazz = Class.forName(columns[0]);  // get
    the class
    Contstructor cons = clazz.getConstructor(new
    Class[]{String.class}); // get constructor from
    String
    return cons.newInstance(new Object[]{columns[1]});
    // construct object
    code]Except, the problem remains that the OP can still not cast the Object returned by newInstance() by using the String in columns[0] (even though the Object is a BigDecimal). Even if it could be cast "dynamically", what would it be cast into - you can not dynamically declare the variable type.
    The above method could work if all the possible objects returned implemented a common interface. Or maybe instanceof could be used to hard-code the cast to the possible objects.
    In the end, I think this type of code can lead to a brittle design.

  • Issue of Security about Java Source Code

    At most time Java compiler compiles the *.java source code into *.class files and then pack them in *.jar files running in the Java VM or as applet running on web pages.
    Recently I find a tool named cavaj that can decompile *.class files into *.java files. I tried it to decompile my *.class files and unvealed that the decompiled *.java files are the same of my source code!
    How to protect the source code not to be pirated? This is a big problem about the mechanism of Java. Is there any tool to compile *.java to *.exe files? Or is there any tool that can decompile *.exe to *.java in the future?

    This is a common question. If you do a search you will find many answers/solutions.
    But can it affect the performance of the program? Your program mayload slight faster, but the runtime performance is the same. It may effect your performance as it takes some time to get the obsufaction right, especially if you are using reflection.

  • Adding two java.math.BigDecimal values

    Hi,
    I want to add two java.math.BigDecimal values (like a + b).
    This code returns only the a value
    java.math.BigDecimal a = new java.math.BigDecimal(0);
    java.math.BigDecimal a = new java.math.BigDecimal(23);
    a.add(b);How can I add these values?
    Thanks
    Jonny

    For your kind information, the code does not return any value. You are supposed to save the return value from the add() function call. Something like this:
    java.math.BigDecimal c = a.add(b);
    // print the value of c here

  • NUMBER - java.math.BigDecimal

    Dear JDBC writer,
    When I have done a query in my Java program on a table in an Oracle database with a NUMBER or NUMBER(4) or NUMBER(4,2) column,
    and I use the generic method ResultSet.getObject(int column), the method always returns a java.math.BigDecimal instance.
    1. In case of NUMBER(4) I had suspected a java.lang.Integer instance. In case of NUMBER I had suspected a java.lang.Double instance. Why did you return a java.math.BigDecimal instance?
    2. Was it your intention to do further calculations with the BigDecimal instance or should I check the precision and scale of the column and get the int or double out of the BigDecimal instance?

    Thanks for the tip about getNUMBER, that may help with some of my other problems, but I'm trying to get data out of oracle spatial geometry types, and both integers and floats are stored in arrays of numbers. If you do a getarray on these or even process them as a result set, you get bigdecimals. How could I do the equivalent of getNUMBER for an array type? This is a huge performance problem for Oracle spatial and java.

  • Java Graph code explanation

    Hi all,
    im new to java and have some trouble drawing a graph i looked up some code but dont quite understand it
    can someone explain the following code please. I understand swing and painting and basic java.
    Q1) Can please explain the flow of execution ?
    Q2)
    What i would also specifically like to understand about the code
    is how does the graph keep going and looks like it scrolls across and not off the frame and how can i add this to a frame i already have
    without covering over my other objects i have displayed.
    Any help would be greatly appreciated.
    Thanks
    import java.awt.*;*
    *import javax.swing.*;
    import java.awt.event.*;*
    *import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;*
    *import java.math.*;
    import java.util.*;*
    *public class ecg extends JFrame*
    *     myView view = new myView();*
    *     Vector vr   = new Vector();*
    *     int    ho   = 0;*
    *public ecg()* 
    *     addWindowListener(new WindowAdapter()*
        *{     public void windowClosing(WindowEvent ev)*
    *          {     dispose();*
    *               System.exit(0);}});*
    *     for (int i=0; i < 5000; i++)*
    *          int p = (int)(Math.random()*  260);
              vr.add(new Point(0,p-130));
         setBounds(3,10,625,350);
         view.setBounds(10,10,600,300);
         getContentPane().add(view);
         getContentPane().setLayout(null);
         setVisible(true);
         while (ho < 500-300)
              try
                   Thread.sleep(110);
                   ho = ho  +1;+
    +               repaint();+
    +          } catch (InterruptedException e) {}+
    +     }+
    +}+
    +public class myView extends JPanel+
    +{+
    +     BufferedImage I;+
    +     Graphics2D    G;+
    +public myView()+
    +{+ 
    +}+
    +public void paint(Graphics g)+
    +{+
    +     if (I == null)+
    +     {+
    +          I = new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_INT_ARGB);+
    +          G = I.createGraphics();+
    +     }+
    +     G.setColor(Color.white);+
    +     G.fillRect(0,0,getWidth(),getHeight());+
    +     G.setColor(Color.gray);+
    +     Point p1,p2;+
    +     p1 = (Point)vr.get(ho);+
    +     int x = 0;+
    +     for (int y=1; y < 600; y++)
              p2 = (Point)vr.get(y+ho);
              G.drawLine(x,p1.y+150,x+6,p2.y+150);
              p1 = (Point)vr.get(y+ho);
              x = x + 6;
         g.drawImage(I,0,0,null);
    public static void main (String[] args) 
         new ecg();
    }

    Compiling your posted code gives a compiler warning:
    C:\jexp>javac ecg.java
    Note: ecg.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    C:\jexp>javac -Xlint:unchecked ecg.java
    ecg.java:31: warning: [unchecked] unchecked call to add(E) as a member of the raw type jav
    a.util.Vector
                vr.add(new Point(0,p-130));
                      ^
    1 warningWe can eliminate this by changing this
        Vector vr   = new Vector();to this
        Vector<Point> vr   = new Vector<Point>();The best way to understand things like this is to start a new file and slowly build it up so you can see what's going on, step-by-step. I've put in some comments and print statements to give you a start.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;
    import java.math.*;
    import java.util.*;
    public class ECG extends JFrame
        myView view = new myView();
        Vector<Point> vr = new Vector<Point>();
        int    ho   = 0;
        public ECG()
            addWindowListener(new WindowAdapter()
                @Override
                public void windowClosing(WindowEvent ev)
                    dispose();
                    System.exit(0);
            // Initialize data in Vector.
            for (int i=0; i < 5000; i++)
                int p = (int)(Math.random() * 260); // range: (0    - 260]
                vr.add(new Point(0, p-130));        // range: (-130 - 130]
            System.out.println("Total number of data points: " + vr.size());
            setBounds(3,10,625,350);
            // Component drawing space is 600 wide by 300 high.
            view.setBounds(10,10,600,300);
            getContentPane().add(view);
            getContentPane().setLayout(null);
            setVisible(true);
            // Animate up thru the first 200 of 5000 data points.
            int millisPerSecond = 1000;
            long delay = 110;
            long framesPerSecond = millisPerSecond/delay;
            System.out.printf("Frames per second: %d%n", framesPerSecond);
            int paintSteps = 600;
            int dataIndex = 200;
                            //5000 -1 - paintSteps;  // max possible index
            System.out.printf("Expected animation time: %f seconds%n",
                               (double)dataIndex/framesPerSecond);
            long start = System.currentTimeMillis();
            // Animation loop.
            while (ho < dataIndex)
                try
                    Thread.sleep(delay);
                    // Increment "ho" which will step us through the Vector data.
                    // Each new value draws the Vector graph data starting at
                    // index "ho" placed at the left edge of the image/component.
                    ho = ho + 1;
                    long end = System.currentTimeMillis();
                    double elapsedTime = (double)(end - start)/millisPerSecond;
                    if(ho % 100 == 0)
                        System.out.printf("ho: %d  time: %.2f%n", ho, elapsedTime);
                    // Update the image in the paint method.
                    repaint();
                } catch (InterruptedException e) {
                    System.out.println("animation interrupted");
            long end = System.currentTimeMillis();
            double elapsedTime = (double)(end - start)/millisPerSecond;
            System.out.printf("Total animation loop time: %f%n", elapsedTime);
        public class myView extends JPanel
            BufferedImage I;
            Graphics2D    G;
            public void paint(Graphics g)
                if (I == null)  // initializw image
                    I = new BufferedImage(getWidth(),getHeight(),
                                          BufferedImage.TYPE_INT_ARGB);
                    G = I.createGraphics();
                // Update image to show current state of animating graph.
                // Fill Background color.
                G.setColor(Color.white);
                G.fillRect(0,0,getWidth(),getHeight());
                // Set graph line color.
                G.setColor(Color.gray);
                // Draw next data segment to newly-erased image.
                // Get two points in data to draw the next line.
                Point p1,p2;
                // "ho" is a simple counter with range [0 - n-1]
                // [0 - 200-1] in the animation loop above.
                // Get the next data point at "ho" which will be drawn at
                // the beginning, ie, left edge (x = 0), of the image.
                p1 = vr.get(ho);
                int x = 0;
                // Since each frame starts at zero_x relative to the image:
                // x = 0.
                // Draw all graph data for this one 600 by 300 image frame
                // with data beginning at index "ho".
                for (int y=1; y < 600; y++)
                    // Get the next point out ahead.
                    p2 = vr.get(y+ho);
                    // Draw a line from the last point, p1, to the next point, p2,
                    // which will be spaced (x +=) 6 apart along the image/component
                    // width of 600 (setBounds). Translate the y values down onto
                    // the component by 150 pixels (the range of y values from
                    // above is from -129 to 130). The "+150" shifts the y values
                    // to the approximate center of the component.
                    G.drawLine(x, p1.y+150, x+6, p2.y+150);
                    // Save the current point to/in p1 for the next iteration.
                    p1 = vr.get(y+ho);
                    // Move along to the right in the image.
                    x = x + 6;
                // Draw image in component.
                g.drawImage(I,0,0,null);
        public static void main (String[] args)
            new ECG();
    }

  • ADF Mobile : Could not find property inputvalue in class java.math.BigDecimal

    I tried to add an input text item to the list view like below and received an error message while navigating out of the input text field.
    "Could not find property inputvalue in class java.math.BigDecimal".
    Can someone show me some pointers about what is wrong with the below code.
    JDEV Version : 11.1.2.4
    <amx:listView var="row" value="#{bindings.Empdtls.collectionModel}"
                            fetchSize="#{bindings.Empdtls.rangeSize}" styleClass="adfmf-listView-insetList"
                            id="lv1" editMode="true">
                <amx:listItem id="li1">
                  <amx:tableLayout width="100%" id="tl1">
                    <amx:rowLayout id="rl1">
                      <amx:cellFormat width="10px" id="cf3"/>
                      <amx:cellFormat width="60%" height="43px" id="cf2">
                        <amx:outputText value="#{row.ClassCode}" id="ot3"/>
                      </amx:cellFormat>
                      <amx:cellFormat width="10px" id="cf4"/>
                      <amx:cellFormat width="40%" halign="end" id="cf1">
                        <amx:inputText value="#{row.bindings.Salary.inputValue}" simple="true" id="it41"/>
                      </amx:cellFormat>
                    </amx:rowLayout>
                  </amx:tableLayout>
                </amx:listItem>
              </amx:listView>

    Hi,
    #{row.bindings.Salary.inputValue) doesn't access a binding in ADF Mobile. Use #{row.Salary} instead.
    Frank

  • Java.math.BigDecimal Problem!

    Hi all,
    I'm running a webdynpro application, inside it I'm executing a RFC that receives some parameters. Most of them are strings, but just one of them is BigDecimal type. When I run the app, I got the following error...
    java.lang.NullPointerException
    at java.math.BigDecimal.<init>(BigDecimal.java:181)
    I appreciate any help you can give me.
    Thanks in advance.
    Jesus.

    Hi Nibu,
    Here you have the code that I'm using..
    BigDecimal imp = new BigDecimal (
    wdContext.currentContextElement().getImporte());
    wdThis.wdGetVR_ControllerController.executeRFC(imp);
    Then in the VR_Controller, I have created a method call executeRFC like this...
    public void executeRFC (java.math.BigDecimal importe)
    try {
    wdContext.currentZbapi_createVR_InputElement().modelObject.setImp(importe);
    wdContext.currentZbapi_createVR_InputElement().modelObject.execute(),
    catch (Exception e) {
    Thanks.
    Jesus.

  • Performance of Java Swing Vs Ajax ( Java Script )

    We had developed application in swing which displays the data received after querying to web-service in Table and JTrees.
    The current technological move is toward Ajax, It is ok that I can build this application in Ajax but not willing to go for replacment to swing.
    I had following question, why should I go for Ajax over swing considering my type of application only ( beside plugins,JRE.. )?
    And Peformance of Java script ( AJAX ) application over swing on following gorund?
    1. Rendering of components in Swing & HTML ( browser )
    2. Peformance of Java Script over Java ( CPU, Memory usage )
    3. Event model in Java Script over java swing
    4. Multitasking & Multithreading.
    5. Storing data in variables.

    The advantage of AJAX over Swing is clear, no special software is needed on a client computer other than an up to date browser.
    Swing does have some advantages however in that it is much more established and there are many more tools available for developing a front end GUI application in Swing.
    I have yet to find what I consider a "good" IDE for Javascript development on multiple platforms, Eg. IE, Firefox, etc...
    Javascript is also not truly object oriented and that makes organizing your code and your design harder.
    Performance I feel is a moot point between the two as it would hardly be noticeable, however I would guess that Javascript might have less performance than Java.

  • How to get comparable Oracle JDBC performance using Java 1.4 vs 1.1.7?

    Our application makes extensive use of JDBC to access an Oracle database. We wrote it a number of years ago using java 1.1.7 and we have been unable to move to new versions of java because of the performance degradation.
    I traced the problem to JDBC calls. I can reproduce the problem using a simple program that simply connects to the database, executes a simple query and then reads the data. The same program running under java 1.4 is about 60% slower than under java 1.1.7. The query is about 80% slower and getting the data is about 150% slower!
    The program is attached below. Note, I run the steps twice as the first time the times are much larger which I attribute to java doing some initializations. So the second set of values I think are more representative of the actual performance in our application where there are numerous accesses to the database. Specifically, I focus on step 4 which is the execute query command and step 5 which is the data retrieval step. The table being read has 4 columns with 170 tuples in it.
    Here are the timings I get when I run this on a Sparc Ultra 5 running
    SunOs 5.8 using an Oracle database running 8.1.7:
                     java 1.1.7  java 1.4
            overall:    2.1s         3.5s
            step 1:     30           200
            step 2:    886          2009
            step 3:      2             2
            step 4:      9            17
            step 5:    122           187
            step 6:      1             1
            step 1:      0             0
            step 2:    203           161
            step 3:      0             1
            step 4:      8            15   <-   87% slower
            step 5:     48           117   <-  143% slower
            step 6:      1             2I find the same poor performance from java versions 1.2 and 1.3.
    I tried using DataDirect's type 4 JDBC driver which gives a little better performance but overall it is still much slower than using java 1.1.7.
    Why do the newer versions of java have such poor performance when using JDBC?
    What can be done so that we can have performance similar to java 1.1.7
    using java 1.4?
    ========================================================================
    import java.util.*;
    import java.io.*;
    import java.sql.*;
    public class test12 {
        public static void main(String args[]) {
            try {
                    long time1 = System.currentTimeMillis();
    /* step 1 */  DriverManager.registerDriver(
                        new oracle.jdbc.driver.OracleDriver());
                    long time2 = System.currentTimeMillis();
    /* step 2 */  Connection conn = DriverManager.getConnection (
                  "jdbc:oracle:thin:@dbserver1:1521:db1","user1","passwd1");
                    long time3 = System.currentTimeMillis();
    /* step 3 */  Statement stmt = conn.createStatement();
                    long time4 = System.currentTimeMillis();
    /* step 4 */  ResultSet rs = stmt.executeQuery("select * from table1");
                    long time5 = System.currentTimeMillis();
    /* step 5 */  while( rs.next() ) {
                      int message_num = rs.getInt(1);
                      String message = rs.getString(2);
                    long time6 = System.currentTimeMillis();
    /* step 6 */  rs.close(); stmt.close();
                    long time7 = System.currentTimeMillis();
                System.out.println("step 1: " + (time2 - time1) );
                System.out.println("step 2: " + (time3 - time2) );
                System.out.println("step 3: " + (time4 - time3) );
                System.out.println("step 4: " + (time5 - time4) );
                System.out.println("step 5: " + (time6 - time5) );
                System.out.println("step 6: " + (time7 - time6) );
                System.out.flush();
            } catch ( Exception e ) {
                System.out.println( "got exception: " + e.getMessage() );
            ... repeat the same 6 steps again...
    }

    If I run my sample program with the -server option, it
    takes a lot longer (6.8s vs 3.5s).Which has to be expected, as the -server option optimizes for long running programs - so it shoudl go with my second suggestion, more below...
    I am not certain what you mean by "just let the jvm
    running". Our users issue a command (in Unix) which
    invokes one of our java programs to access or update
    data in a database. I think what you are suggesting
    would require that I rewrite our application to have a
    java program always running on the users workstation
    and to also rewrite our
    commands (over a hundred) to some how pass data and
    receive data with this new server java program. That
    does not seem a very reasonable just to move to a new
    version of java. Or are you suggesting something
    else?No I was just suggestion what you descript. But if this is not an option, then maybe you should merge your java-programs to C or another native language. Or you could try the IBM-JDK with the -faststart (or similar) option. If thew Unix you mention is AIX, then there would be the option of a resetable-vm. But I cannot say if this VM would solve your problem. Java is definitly not good for applications which only issue some unqiue commands because the hotspot-compiler can not be efficiently used there. You can only try to get 1.1.7 performance by experimenting with vm-parameters (execute java -X).

  • Bad performance of Java Web Report in BI 7

    We are experiencing poor performance with Java web application(EP)
    comparing to that with ABAP web.
    We migrated our BI reports from the ABAP web interface to the Java web
    interface due to our upgrade to Netweaver2004 environment.
    The problem is that it takes much longer time to load the BI reports in
    Java web than in ABAP web.
    It is the same situation in RSRT. Java web needs more time to execute
    the same query.
    there is no EP logon performance delay, so I think the EP is configured good.
    But the response time of BI Java Web Report is delayed average of 4~5
    seconds in every Query compared in that of ABAP Web report.
    Anyone experience this situation?

    Hi,
    I am facing similar problem. How did you solve it?
    Regards,
    Apurva

  • How to Use the JAVA SCRIPT code in .htm page of the component

    Hi .
    In my requirement i have to use Java Script Function in .htm code ..how to use the java script code and functions in .htm???
    thank you
    B.Mani

    Check this document  [Arun's Blog|http://wiki.sdn.sap.com/wiki/display/CRM/CRMWebClientUI-TalkingwithJava+Script]
    Regards
    Kavindra

  • How to read the Java source code (in Netbeans)

    I use OS X10.5.5, NetBeans 6.1 and JSE 6 on a 64 bit mac.
    When I downloaded NB6.1 it had JSE 5 as it's default (and only) java platform. I ran Software Update to get Java 6 from Apple, used the Java Prefrences utitlity to set JSE6 as default. In NB I added the JDK6 platform, registered the JDK6 javadocs and noticed that I also have the option of registering the Java source code.
    I have three questions:
    1) How do I make JDK6 the default in NetBeans. The JDK5 keeps being default after I did the steps above and I don't see anywhere to change that.
    2) How do I read the Java 6 source code? I can see sun provides [source code| http://download.java.net/jdk6/] for their supported platforms. I dont see Apple doing the same for its JDK port. What would I need to do to get to read the java SE6 sources? or is it actually hiding somewhere in the /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home hierarchy?
    3) Where does the JVM look for the binary code to run when I make a call to, say java.util.ArrayList or any other library. In my naivety I would have assumed it would be a .class file somewhere in the java Home folder, but I don't see anything like it.
    thanks in advance,
    chris

    This is taken from the help included with netbeans. In response to question 1.
    By default, the IDE uses the version of the Java SE platform (JDK) with which the IDE runs as the default Java platform
    for compilation, execution, and debugging. You can view your IDE's JDK version by choosing Help > About and clicking the
    Detail tab. The JDK version is listed in the Java field.
    You can run the IDE with a different JDK version by starting the IDE with the --jdkhome jdk-home-dir switch on the command line
    or in your IDE-HOME/etc/netbeans.conf file. For more information, see IDE Startup Parameters.
    In the IDE, you can register multiple Java platforms and attach Javadoc and source code to each platform. For example, if you
    want to work with the new features introduced in JDK 5.0, you would either run the IDE on JDK 5.0 or register JDK 5.0 as a
    platform and attach the source code and Javadoc to the platform.
    In  , you can switch the target JDK in the Project Properties dialog box. In  , you have to set the target JDK in the Ant script itself,
    then specify the source/binary format in the Project Properties dialog box.
    To register a new Java platform:
    Choose Tools > Java Platforms from the main window.
    Click New Platform and select the directory that contains the Java platform. Java platform directories are marked with a  
    in the file chooser.
    Use the Sources and Javadoc tabs to attach Javadoc documentation and source code for debugging to the platform.
    Click Close.
    To set the default Java platform for a standard project:
    Right-click the project's root node in the Projects window and choose Properties.
    In the Project Properties dialog box, select the Libraries node in the left pane.
    Choose the desired Java platform in the Java Platform combo box.
    Switching the target JDK for a standard project does the following:
    Offers the new target JDK's classes for code completion.
    If available, displays the target JDK's source code and Javadoc documentation.
    Uses the target JDK's executables (javac and java) to compile and execute your application.
    Compiles your source code against the target JDK's libraries.
    If you want to register additional Java platforms with the IDE, you can do so by clicking the Manage Platforms button.
    Then click the Add Platform button and navigate to the desired platform.
    To set the target Java platform for a free-form project:
    In your Ant script, set the target JDK as desired in the javac, java, and javadoc tasks.
    Right-click the project's root node in the Projects window and choose Properties.
    In the Sources panel, set the level of JDK you want your application to be run on in the Source/Binary Format combo box.
    When you access Javadoc or source code for JDK classes, the IDE searches the Java platforms registered in the
    Java Platform Manager for a platform with a matching version number. If no matching platform is found, the IDE's default platform is used instead.
    See Also
    Managing the Classpath
    Declaring the Classpath in a Free-Form Project
    Stepping Through Your Program
    Legal Notices

  • Error while generating java client code from wsdl file

    I am trying to generate a java client code from WSDL file um_workflowSaveCreateProfile.wsdl which includes um_workflowSaveCreateProfile_interface.wsdl file, so I am keeping both the files in the same folder and trying to generate the client code but it is showing me the below error highlighted .
    um_workflowSaveCreateProfile.wsdl
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="E:/DIPPWF/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:oblix="http://www.oblix.com/" xmlns:obinterface="http://www.oblix.com/wsdl/um_workflowSaveCreateProfile_interface" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.oblix.com/wsdl/um_workflowSaveCreateProfile" targetNamespace="http://www.oblix.com/wsdl/um_workflowSaveCreateProfile">
         <import namespace="D:/DIPP/WSDL/um_workflowSaveCreateProfile_interface" location="um_workflowSaveCreateProfile_interface.wsdl"/>
         <service name="OblixIDXML_um_workflowSaveCreateProfile_Service">
              <port name="OblixIDXML_um_workflowSaveCreateProfile_Port" binding="obinterface:OblixIDXML_um_workflowSaveCreateProfile_Binding">
                   <soap:address location="http://localhost:7777/identity/oblix/apps/userservcenter/bin/userservcenter.cgi"/>
              </port>
         </service>
    </definitions>
    um_workflowSaveCreateProfile_interface.wsdl
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:oblix="http://www.oblix.com/" xmlns:oblixxmllocalschema="http://www.oblix.com/OblixXMLLocalSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.oblix.com/wsdl/um_workflowSaveCreateProfile_interface" targetNamespace="http://www.oblix.com/wsdl/um_workflowSaveCreateProfile_interface">
         <types>
              <xsd:schema targetNamespace="http://www.oblix.com/" elementFormDefault="qualified"
                   xmlns="http://www.oblix.com/"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                        <xsd:include schemaLocation="../XMLSchema/common_parameters.xsd" />
                        <xsd:include schemaLocation="../XMLSchema/common_authentication.xsd" />
                        <xsd:include schemaLocation="../XMLSchema/workflowSaveCreateProfile.xsd" />
              </xsd:schema>
              <xsd:schema targetNamespace="http://www.oblix.com/OblixXMLLocalSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                   <xsd:element name="request">
                        <xsd:complexType>
                             <xsd:sequence>
                                  <xsd:element name="params">
                                       <xsd:complexType>
                                            <xsd:sequence>
                                                 <xsd:element ref="oblix:ObWorkflowName"/>
                                                 <xsd:element ref="oblix:ObDomainName"/>
                                                 <xsd:element ref="oblix:ObWfComment" minOccurs="0"/>
                                                 <xsd:element ref="oblix:noOfFields"/>
                                                 <xsd:element ref="oblix:AttributeParams"/>
                                            </xsd:sequence>
                                       </xsd:complexType>
                                  </xsd:element>
                             </xsd:sequence>
                             <xsd:attribute name="version" type="xsd:string" use="optional"/>
                             <xsd:attribute name="application" type="xsd:string" use="required" />
                             <xsd:attribute name="function" type="xsd:string" use="required" />
                             <xsd:attribute name="mode" type="xsd:string" use="optional"/>
                        </xsd:complexType>
                   </xsd:element>
              </xsd:schema>
         </types>
         <message name="OblixIDXMLInput">
              <part name="authentication" element="oblix:authentication"/>
              <part name="request" element="oblixxmllocalschema:request"/>
         </message>
         <message name="OblixIDXMLOutput">
              <part name="body" element="oblix:Oblix"/>
         </message>
         <portType name="OblixIDXMLPortType">
              <operation name="OblixIDXML_um_workflowSaveCreateProfile">
                   <input message="tns:OblixIDXMLInput"/>
                   <output message="tns:OblixIDXMLOutput"/>
              </operation>
         </portType>
         <binding name="OblixIDXML_um_workflowSaveCreateProfile_Binding" type="tns:OblixIDXMLPortType">
              <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
              <operation name="OblixIDXML_um_workflowSaveCreateProfile">
                   <soap:operation soapAction="http://www.oblix.com/"/>
                   <input>
                        <soap:body use="literal"/>
                   </input>
                   <output>
                        <soap:body use="literal"/>
                   </output>
              </operation>
         </binding>
    </definitions>
    I am using WSDL2 Java for generating the client code .
    Please suggest where am I wrong .
    E:\axis2-1.4\bin>WSDL2Java -uri E:\DIPPWF\um_workflowSaveCreateProfile.wsdl -p R
    ND -d adb -s -o build\client--http-proxy-host 10.74.93.35 --http-proxy-port 80
    Using AXIS2_HOME: E:\axis2-1.4
    Using JAVA_HOME: C:\Program Files\Java\jdk1.6.0_02
    Retrieving document at 'E:\DIPPWF\um_workflowSaveCreateProfile.wsdl'.
    Retrieving document at 'um_workflowSaveCreateProfile_interface.wsdl', relative t
    o 'file:/E:/DIPPWF/um_workflowSaveCreateProfile.wsdl'.
    Retrieving schema at 'E:/DIPPWF/XMLSchema/common_parameters.xsd', relative to 'f
    ile:/E:/DIPPWF/um_workflowSaveCreateProfile_interface.wsdl'.
    Retrieving schema at 'E:/DIPPWF/XMLSchema/common_authentication.xsd', relative t
    o 'file:/E:/DIPPWF/um_workflowSaveCreateProfile_interface.wsdl'.
    Retrieving schema at 'E:/DIPPWF/XMLSchema/workflowSaveCreateProfile.xsd', relati
    ve to 'file:/E:/DIPPWF/um_workflowSaveCreateProfile_interface.wsdl'.
    Retrieving schema at 'navbar.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/workfl
    owSaveCreateProfile.xsd'.
    Retrieving schema at 'searchform.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/wo
    rkflowSaveCreateProfile.xsd'.
    Retrieving schema at 'component_basic.xsd', relative to 'file:/E:/DIPPWF/XMLSche
    ma/workflowSaveCreateProfile.xsd'.
    Retrieving schema at 'displaytype.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/c
    omponent_basic.xsd'.
    Retrieving schema at 'error.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/compone
    nt_basic.xsd'.
    Retrieving schema at 'component_workflowTicket.xsd', relative to 'file:/E:/DIPPW
    F/XMLSchema/workflowSaveCreateProfile.xsd'.
    Retrieving document at 'E:\DIPPWF\um_workflowSaveCreateProfile.wsdl'.
    Retrieving document at 'um_workflowSaveCreateProfile_interface.wsdl', relative t
    o 'file:/E:/DIPPWF/um_workflowSaveCreateProfile.wsdl'.
    Retrieving schema at 'E:/DIPPWF/XMLSchema/common_parameters.xsd', relative to 'f
    ile:/E:/DIPPWF/um_workflowSaveCreateProfile_interface.wsdl'.
    Retrieving schema at 'E:/DIPPWF/XMLSchema/common_authentication.xsd', relative t
    o 'file:/E:/DIPPWF/um_workflowSaveCreateProfile_interface.wsdl'.
    Retrieving schema at 'E:/DIPPWF/XMLSchema/workflowSaveCreateProfile.xsd', relati
    ve to 'file:/E:/DIPPWF/um_workflowSaveCreateProfile_interface.wsdl'.
    Retrieving schema at 'navbar.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/workfl
    owSaveCreateProfile.xsd'.
    Retrieving schema at 'searchform.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/wo
    rkflowSaveCreateProfile.xsd'.
    Retrieving schema at 'component_basic.xsd', relative to 'file:/E:/DIPPWF/XMLSche
    ma/workflowSaveCreateProfile.xsd'.
    Retrieving schema at 'displaytype.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/c
    omponent_basic.xsd'.
    Retrieving schema at 'error.xsd', relative to 'file:/E:/DIPPWF/XMLSchema/compone
    nt_basic.xsd'.
    Retrieving schema at 'component_workflowTicket.xsd', relative to 'file:/E:/DIPPW
    F/XMLSchema/workflowSaveCreateProfile.xsd'.
    *[ERROR] More than one part for message OblixIDXMLInput*
    org.apache.axis2.description.WSDL11ToAxisServiceBuilder$WSDLProcessingException:
    More than one part for message OblixIDXMLInput
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.addQNameRefer
    ence(WSDL11ToAxisServiceBuilder.java:1162)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.addQNameRefer
    ence(WSDL11ToAxisServiceBuilder.java:1085)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateBindi
    ng(WSDL11ToAxisServiceBuilder.java:686)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpo
    int(WSDL11ToAxisServiceBuilder.java:538)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpo
    ints(WSDL11ToAxisServiceBuilder.java:489)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateServi
    ce(WSDL11ToAxisServiceBuilder.java:363)
    at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateA
    llServices(WSDL11ToAllAxisServicesBuilder.java:107)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
    ionEngine.java:147)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
    at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
    Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException
    : Error parsing WSDL
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
    ionEngine.java:153)
    at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
    at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
    Caused by: org.apache.axis2.AxisFault: More than one part for message OblixIDXML
    Input
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateServi
    ce(WSDL11ToAxisServiceBuilder.java:397)
    at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateA
    llServices(WSDL11ToAllAxisServicesBuilder.java:107)
    at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerat
    ionEngine.java:147)
    ... 2 more
    Caused by: org.apache.axis2.description.WSDL11ToAxisServiceBuilder$WSDLProcessin
    gException: More than one part for message OblixIDXMLInput
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.addQNameRefer
    ence(WSDL11ToAxisServiceBuilder.java:1162)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.addQNameRefer
    ence(WSDL11ToAxisServiceBuilder.java:1085)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateBindi
    ng(WSDL11ToAxisServiceBuilder.java:686)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpo
    int(WSDL11ToAxisServiceBuilder.java:538)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpo
    ints(WSDL11ToAxisServiceBuilder.java:489)
    at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateServi
    ce(WSDL11ToAxisServiceBuilder.java:363).
    Thanks in advance.
    akshay

    Hello,
    Were you able to resolve this issue ?
    I am seeing the same issue and at my wits end.
    regards
    Amit

  • What are the main things to do when optimizing the performance of Java App

    what are the main things to do when optimizing the performance of Java App

    what are the main things to do when optimizing the performance of Java App

Maybe you are looking for