Rohit Elayathu
Rohit Elayathu

Reputation: 639

Is there any difference between "2 instances of JVM" and "2 different JVMs"?

I have been told to make an EJB and plain Java program (client), and try to run both these in two different JVMs, and get them executed. What is meant by "two different JVMs"?

Upvotes: 1

Views: 970

Answers (3)

Shariq
Shariq

Reputation: 1

Set your class path to one JVM for the EJB; Set the class path to another JVM for the client.

Upvotes: 0

ring bearer
ring bearer

Reputation: 20783

Your requirement :

  1. EJB
  2. Plain Java client for (1)

Run in different JVMs - it is as simple as it can get.

Normally EJBs are hosted in an Application server ( Such as Weblogic,Websphere, Jboss,Glassfish, etc etc) - when you deploy your EJB to one such server and start that server - server process is a "JVM"- meaning your server process that hosts your EJB is running in a JVM.

Now, you have written and compiled your Client application. For laughs, let us call it MyBigClient.java

when you run java MyBigClient on command line or run it through the "Run" button of your favorite IDE, it is executed by a JVM - that is your second JVM instance

Voila - you have EJB and Client running in two different JVMs

Now if you use a different "java.exe"(Say, C:\JDK1.6\bin\java.exe) to run the client than the java.exe (Say, C:\JDK1.5\bin\java.exe) used by your application server, you are using "two different JVMs"

It is all how you want to define "two different" - I do not think there is any hard and fast rule around this.

Upvotes: 6

Makoto
Makoto

Reputation: 106430

In this context, I can't discern a difference between the two. For the record, two different JVMs would be, in my mind, two JVMs with different versions (JRE 6 and JRE 7), and two instances implies that it's one JVM version being used twice (i.e. two separate Java applications).

Upvotes: 0

Related Questions