Convert .class to .java

前端 未结 3 663
野性不改
野性不改 2020-12-03 02:54

I have some .class files that I need to convert to .java so I did:

javap -c ClassName.class

and all the time I have the same error

相关标签:
3条回答
  • 2020-12-03 03:01

    Invoking javap to read the bytecode

    The javap command takes class-names without the .class extension. Try

    javap -c ClassName
    

    Converting .class files back to .java files

    javap will however not give you the implementations of the methods in java-syntax. It will at most give it to you in JVM bytecode format.

    To actually decompile (i.e., do the reverse of javac) you will have to use proper decompiler. See for instance the following related question:

    • How do I "decompile" Java class files?
    0 讨论(0)
  • 2020-12-03 03:04

    I'm guessing that either the class name is wrong - be sure to use the fully-resolved class name, with all packages - or it's not in the CLASSPATH so javap can't find it.

    0 讨论(0)
  • 2020-12-03 03:20

    This is for Mac users:

    first of all you have to clarify where the class file is... so for example, in 'Terminal' (A Mac Application) you would type:

    cd
    

    then wherever you file is e.g:

    cd /Users/CollarBlast/Desktop/JavaFiles/
    

    then you would hit enter. After that you would do the command. e.g:

    cd /Users/CollarBlast/Desktop/JavaFiles/ (then i would press enter...)

    Then i would type the command:

    javap -c JavaTestClassFile.class (then i would press enter again...)

    and hopefully it should work!

    0 讨论(0)
提交回复
热议问题