I\'m afraid that the answer is no, but maybe one of you surprises me.
Thanks.
Edit 1: I\'m aware that the question doesn\'t make much sens
As other's pointed out: no.
You can access objects of a class, its methods etc. the way the JVM can. This is only possible because every class stores information about itself and its members when being compiled.
If I had to guess, this happens in Object, the rootobject in the inheritance tree. You may decompile the class file using a decompiler and use that one for examination. But you cannot access the sourcecode like a String or anything similar.
Think about it: If you have scala-code compiled for JVM, you cannot get the scala-code back either. And you cannot get java-code.
Is there any special reason you want to do this? May there be any other way you could try to achieve your goal, whatever it might be?
regards
I don't think so. When the .java
is compiled it becomes a .class
; as far as I know Java doesn't have a built-in decompiler to turn that .class
back into a .java
. All that a runnable application knows about is .class
files.
No you can't. Its a little illogical as well.