• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Java Reflection Code Applet

bigoh5

n00b
Joined
Mar 19, 2009
Messages
12
Hi all,

I ran across an interesting problem:

Write an applet that outputs its own source code in a green box. Do not use reflection to access the applet's code. Anyone have any insight into a problem like this?
 
Reflection isnt going to get you access to the code anyway.

Theres 2 ways i can see to do it, easy and very hard.
Easy: include the source code in the jar along with the class file. Then you just load and display it.

Very Difficult: Decompile the byte code, and display that. Not going to be the same as the source, but should be close enough. You are going to lose the comments and formatting.
Well, i guess its very hard if you write the decompiler yourself. People have done it before, so i suppose you could use their code to do it.
 
...
Theres 2 ways i can see to do it, easy and very hard.
Easy: include the source code in the jar along with the class file. Then you just load and display it.
...

As ambientZ said, this is probably the easist way to do it. You can stick the sources in the jar and them load them as InputStreams via a classloader.
 
Back
Top