Java虚拟机支持多个程序么(不是多个线程)?

解决方案 »

  1.   

    当然支持
      一个程序一个入口
      public static void main(String args[])
      

  2.   

    "运行时环境中"
    '======================
    首先,我想到的是,类变量在整个应用程序中是存在的,并且只有一份,但同时也要认识这个"运行时环境",他并不是你所理解的JVM.
      

  3.   

    那怎么调用呢?你是说在命令行启动两个不同的命令?
    java ClassA
    java ClassB这样不是启动两个java虚拟机么?
      

  4.   

    to:: dragonwind(北风) 很有启发性!
    我看了一下
    每打开一个java程序
    资源管理器中就多个java或javaw进程在运行
      

  5.   

    这是jdk1.5的release notesz中关于class data sharing的一部分,应该有些参考价值Class data sharing (CDS) is a new feature in J2SE 5.0 intended to reduce the startup time for Java programming language applications, in particular smaller applications, as well as reduce footprint. When the JRE is installed on 32-bit platforms using the Sun provided installer, the installer loads a set of classes from the system jar file into a private internal representation, and dumps that representation to a file, called a "shared archive". Class data sharing is not supported in Microsoft Windows 95/98/ME. If the Sun JRE installer is not being used, this can be done manually, as explained below. During subsequent JVM invocations, the shared archive is memory-mapped in, saving the cost of loading those classes and allowing much of the JVM's metadata for these classes to be shared among multiple JVM processes. In J2SE 5.0, class data sharing is supported only with the Java HotSpot Client VM, and only with the serial garbage collector. The primary motivation for including CDS in the 5.0 release is the decrease in startup time it provides. CDS produces better results for smaller applications because it eliminates a fixed cost: that of loading certain core classes. The smaller the application relative to the number of core classes it uses, the larger the saved fraction of startup time. The footprint cost of new JVM instances has been reduced in two ways. First, a portion of the shared archive, currently between five and six megabytes, is mapped read-only and therefore shared among multiple JVM processes. Previously this data was replicated in each JVM instance. Second, since the shared archive contains class data in the form in which the Java Hotspot VM uses it, the memory which would otherwise be required to access the original class information in rt.jar is not needed. These savings allow more applications to be run concurrently on the same machine. On Microsoft Windows, the footprint of a process, as measured by various tools, may appear to increase, because a larger number of pages are being mapped in to the process' address space. This is offset by the reduction in the amount of memory (inside Microsoft Windows) which is needed to hold portions on rt.jar. Reducing footprint remains a high priority. 
      

  6.   


    毫无疑问,你的程序结束后,里面定义的所有东西都没了不管jvm是否在运行