I wanna modify remote runtime class file(Already loaded in JVM at remote server).
How many steps should I do? I know some APIs, such as Instrumentation, classfiletransformer, ASM, etc. I can modify a class file loacted at local hard disk, using ASM. I can get all names of current loaded classes in locate JVM, by attach JVM's PID. But, what's the next? Does it need to do socket programming to transfer remote classfile to local machine? And I am confusing about this. Any references or advices. thx for ur consideration.
Asked
Active
Viewed 437 times
1

Jens Björnhager
- 5,632
- 3
- 27
- 47

Nick Dong
- 3,638
- 8
- 47
- 84
1 Answers
0
Get the file from the remote server, modify it locally and push it back to the remote server. Getting the file from the remote server can be using FTP, HTTP or may be write a small socket server running on the reomte machine and a client on your machine.
About how will the class be reloaded in the JVM(since you said its already loaded), I have no idea :)

yogiam
- 168
- 7
-
Then how to get bytestream of class file which already loaded into JVM? I only get there are names now. – Nick Dong Aug 22 '13 at 11:13
-
1See this SO question. http://stackoverflow.com/questions/17321039/get-bytecode-from-loaded-class – yogiam Aug 27 '13 at 14:07
-
[http://stackoverflow.com/questions/2737285/is-there-a-way-to-obtain-the-bytecode-for-a-class-at-runtime](http://stackoverflow.com/questions/2737285/is-there-a-way-to-obtain-the-bytecode-for-a-class-at-runtime) [http://stackoverflow.com/questions/4130903/java-getting-bytecode-of-class-at-runtime-from-within-the-same-jvm](http://stackoverflow.com/questions/4130903/java-getting-bytecode-of-class-at-runtime-from-within-the-same-jvm) – Nick Dong Aug 29 '13 at 07:09