• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to identify the JVM which your client applicaiton is using?  RSS feed

 
Akhil Jain
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some stuff deployerd on WAS6 server. and i am trying to lookup jndi name from two different clients
1. Application client using IBM jvm
2. Application client using SUN jvm

for jndi lookup both the SUN jvm and IBM jvm uses different Context Factories.

How can i identify the client's JVM at runtime so that i can pass correct Context Factory to lookup jndi names on server.

some thing like:
........
String CLIENT_INFO = getClientInfo();
.......
....

if(CLIENT_INFO.equalsIgnoreCase("IBM"))
this.initialContextFactory=com.ibm.websphere.naming.WsnInitialContextFactory
else
this.initialContextFactory=com.sun.jndi.cosnaming.CNCtxFactory
...

...

public String getClientInfo(){

//Code to identify whether the client is using sun jvm or ibm jvm
//return the string saying that its "SUN" or "IBM"
return "SUN" or "IBM";
}
[ March 24, 2006: Message edited by: Akhil Jain ]
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at System.getProperties() method
 
Akhil Jain
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.i think we can get the type of vendor from these set of system properties...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!