Alex Rivera | Logout

Self modifying code in Java

Asked 2009-06-26T10:56:38.590
9

Have you ever created or encountered a self modifying code in Java? If yes, then please post the link or simply post the code.

Edit
Report

3 Answers

1

That should be difficult to realize. But you can create at runtime new classes and load them with a custom classloader. If you want to modify the code again, you have to reload the class.

answered 2009-06-26T10:59:46.293
1

From BCEL:

The Byte Code Engineering Library is intended to give users a convenient possibility to analyze, create, and manipulate (binary) Java class files (those ending with .class). Classes are represented by objects which contain all the symbolic information of the given class: methods, fields and byte code instructions, in particular.

answered 2009-06-26T11:03:11.760
-2

You could always just use a dynamic language...

answered 2009-06-26T11:00:47.333

Your Answer