• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use loaded JVM instance?

 
aman shakya
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have made a browser extension for Internet Explorer - a vertical explorer bar. The main code for my program is in Java. I have written some native code in C++ also which loads the JVM and runs the Java classes. The java code runs fine when I run one instance of the internet explorer. But when I open a new window, the JVM cannot be loaded again. How could I use the JVM instance that has aready been loaded?
However, when running a new instance of the internet explorer from the start menu, a new JVM instance is loaded and everything works fine.
Would anybody please help me.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know much about either modern Windows programming or plug-in programming, but the answer in general would be to hold a pointer to the JVM itself in a C static variable; the plug-in code should check the variable and if its non-null, then use it, or otherwise initialize it. I suspect that to do this properly you'd have to protect the static variable with a critical section, and of course you'd want to wrap this all up in a single getJVM() function.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!