• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java agents, invoke methods from other JVM in runtime  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a java agent that accesses an already running JVM and makes it possible to invoke methods inside of certain classes at runtime. However I'm not sure if this is possible since it is translated into bytecode right?

I would like to know if it's possible and maybe a little guide on how to start.

Thanks in advance

With kind regards, Stan
 
Saloon Keeper
Posts: 4488
112
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could expose those methods via JMX, and then invoke them via a JMX client like VisualVM (assuming that you want to do this manually). To do it programmatically, either write the appropriate JMX client code, or run the Jolokia web app on the same server to do it over HTTP (assuming that this is on a servlet container).
 
Stan Gabes
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:You could expose those methods via JMX, and then invoke them via a JMX client like VisualVM (assuming that you want to do this manually). To do it programmatically, either write the appropriate JMX client code, or run the Jolokia web app on the same server to do it over HTTP (assuming that this is on a servlet container).



I am aware of that, but I want it to hook into a program I haven't made myself. Don't worry, it's not for illegal purposes, I want to log the amount of players on a game server.
 
Sheriff
Posts: 21330
87
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Rancher
Posts: 3067
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like there should be a security barrier to prevent one process from looking at the contents of another process without that process's permission.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!