• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the different between "Different JVM" and "different instance"  RSS feed

 
Varun Selva
Ranch Hand
Posts: 48
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
What I am confusing with "Different JVM" and "different instance".
Please give me the explanation for my questions.
Thanks Advanced.

Let say, I have a java file "HelloWorld.java"


CASE 01

I have two JDK folders
C:\Program Files (x86)\Java\jdk1.6\bin
C:\Program Files (x86)\Java\jdk1.6_copy\bin

Running two HelloWorld class file in the same time.

C:\Program Files (x86)\Java\jdk1.6\bin\java HelloWorld
C:\Program Files (x86)\Java\jdk1.6_copy\bin\java HelloWorld


CASE 02

created a copy of java.exe in below folder
C:\Program Files (x86)\Java\jdk1.6\bin\java.exe
C:\Program Files (x86)\Java\jdk1.6\bin\java_copy.exe

And running like
C:\Program Files (x86)\Java\jdk1.6\bin\java HelloWorld
C:\Program Files (x86)\Java\jdk1.6\bin\java_copy HelloWorld



1.What is the difference between Case 1 ans 2 ?
2.Are both are different JVM concept or not?
3.How about the memory utilization?



 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What was the output you got on the screen? Could you tell from it which program was running? Did you get Hello World twice then a second's wait? Try two slightly different programs. Give Hello World a command‑line argument and print it out
java1 HelloWorld 1
java2 HelloWorld 2

… and see what happens.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you put a & after the instructions to run them in the background as you can on Linux? I don't know about Windows®.
 
Paweł Baczyński
Bartender
Posts: 2083
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Windows:
START /B <your_command>
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it on a Linux box.
Seems an interesting question
 
Varun Selva
Ranch Hand
Posts: 48
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:What was the output you got on the screen? Could you tell from it which program was running? Did you get Hello World twice then a second's wait? Try two slightly different programs. Give Hello World a command‑line argument and print it out
java1 HelloWorld 1
java2 HelloWorld 2

… and see what happens.


@Campbell Ritchie

These command need to run in the different terminals.
Sorry for missing information.

screenshot : https://docs.google.com/file/d/0B40UlkZeIiqjZ0I3WXFSOUJmQXM/edit?usp=sharing&pli=1
Untitled.jpg
[Thumbnail for Untitled.jpg]
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are running on different terminal, you have two JVMs running and it doesn't matter whether you use java or javaCopy or whatever. You would use the same heap space twice, so double the memory requirements.


I think.
 
Varun Selva
Ranch Hand
Posts: 48
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:If you are running on different terminal, you have two JVMs running and it doesn't matter whether you use java or javaCopy or whatever. You would use the same heap space twice, so double the memory requirements.


I think.


So If we have enough system system memory,
will it give any performance improvements?
same heap space twice
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having copies of the JDK executables on disk does not matter at all and makes no difference in running applications. If anything, it would make running Java programs slightly slower (because the OS has to load more from disk), and you're unnecessarily wasting disk space.

So, making copies of the JDK directory or of java.exe has no benefits at all, and it's not necessary to do this for anything.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will probably see no performance differences as long as you don't run out of memory.
I have a slightly different approach to copies of the Java® Runtime. I have two copies, but one is Java7 ad the other Java8 so that doesn't count as unnecessary use of disc space.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!