我发现,server好像主要优化运算,client主要优化界面,不知各位怎么看。以及我理解是否正确。各位看看啊!

解决方案 »

  1.   


    C:\java练习>java Temp
    1000000000
    4306C:\java练习>java -client Temp
    1000000000
    4407C:\java练习>java -server Temp
    Error: no `server' JVM at `C:\Program Files\Java\j2re1.4.0\bin\server\jvm.dll'.
      

  2.   

    不知道你的意思,我的可以啊。为什么会找不倒的啊?奇怪!:)哦,可能是你的VM问题,他说你没有server VM啊。
      

  3.   

    我也发生了楼上的问题,请教楼主!
    如果先运行Java -server呢?是不是跟cache命中有关呢?
      

  4.   

    你看:C:\>java
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java -jar [-options] jarfile [args...]
               (to execute a jar file)where options include:
        -client       to select the "client" VM
        -server       to select the "server" VM
        -hotspot      is a synonym for the "client" VM  [deprecated]
                      The default VM is client.    -cp -classpath <directories and zip/jar files separated by ;>
                      set search path for application classes and resources
        -D<name>=<value>
                      set a system property
        -verbose[:class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -showversion  print product version and continue
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions
      

  5.   

    这个我也看到了呀!你可以先运行java -server后运行java -client?
    能把这个的结果贴出来么?
      

  6.   

    C:\Program Files\Java2SDK\bin>java -server testapp.Temp
    1000000000
    10C:\Program Files\Java2SDK\bin>java testapp.Temp
    1000000000
    11076
      

  7.   

    对了,我向来把jre装在我的J2SDK\jre的。
      

  8.   

    我想这主要和你选择虚拟机的不同而不同,server vm的性能一定是要高与client vm的,因为server端历来是要承受比较大的运算压力的。
      

  9.   

    C:\Program Files\Java2SDK\bin>java -version
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
      

  10.   

    C:\Program Files\Java2SDK\bin>java -server -version
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Server VM (build 1.4.0-b92, mixed mode)
      

  11.   

    介绍你一个页面吧,那里很多讨论这个方面的问题。
    www.javagaming.org
      

  12.   

    是啊,我用界面时client要比server快1倍啊!还有,有没可能,那个循环被去掉了啊在server上优化时。
      

  13.   

    我发现了,jvm.dll.
    不知道为什么。
      

  14.   

    想问一下,那为什么他(如果我对server和client的猜测对的话)不在server和client时都同时对运算和界面都优化啊?奇怪!
      

  15.   

    C:\java练习>java -version
    java version "1.4.0_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
    Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)好象和版本有关系。
      

  16.   

    所以说,是jvm的不同,导致性能的不同啊,server的一定比client的性能好啊。
      

  17.   

    import java.awt.*;
    import javax.swing.*;public class ShowButton extends JFrame
    {
    JButton f1 = new JButton();
    JButton f2 = new JButton();
    JButton f3 = new JButton();
    JButton f4 = new JButton();
    JButton f5 = new JButton();
    JButton f6 = new JButton();
    JButton f7 = new JButton();
    JButton f8 = new JButton();
    JButton f9 = new JButton(); private JButton[] buttonArray={f1,f2,f3,f4,f5,f6,f7,f8,f9};
    JPanel pane = new JPanel(); public static void main(String args[]){
    long start = System.currentTimeMillis(); new ShowButton(); long time = System.currentTimeMillis() - start;
    System.out.println(time);
    } public ShowButton(){
    try{
    jbInit();
    }catch(Exception e) {
    e.printStackTrace();
    }
    } private void jbInit() throws Exception {
    pane.setLayout(null);
    for(int i=0;i<9;i++) {
    buttonArray[i].setBounds(50,80*i+50,80,40);
    buttonArray[i].setText("Button"+i);
    pane.add(buttonArray[i]);
    }
    pane.setPreferredSize(new Dimension(200,750)); JScrollPane scrollPane=new JScrollPane(pane);// scrollPane.setPreferredSize(new Dimension(200,300));
    this.getContentPane().add(scrollPane, BorderLayout.CENTER); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setBounds(50,50,300,200);
    this.show();
    }
    }结果啊:
    C:\Program Files\Java2SDK\bin>java ShowButton
    1162C:\Program Files\Java2SDK\bin>java -server ShowButton
    1332C:\Program Files\Java2SDK\bin>java ShowButton
    1152C:\Program Files\Java2SDK\bin>java -server ShowButton
    1312