<p>I'm trying to figure out what a Java applet's class file is doing under the hood. Opening it up with Notepad or Textpad just shows a bunch of gobbledy-gook.</p>

<p>Is there any way to wrangle it back into a somewhat-readable format so I can try to figure out what it's doing?</p>

<ul>
<li>Environment == Windows w/ VS 2008 installed.</li>
</ul>

[{'answer_id': 76330, 'author': 'Rasmus Faber', 'author_id': 5542, 'author_profile': 'https://Stackoverflow.com/users/5542', 'pm_score': 2, 'selected': False, 'text': '<p>Using <a href="http://www.javadecompilers.com/jad" rel="nofollow noreferrer">Jad</a> to decompile it is probably your best option. Unless the code has been obfuscated, it will produce an okay result.</p>\n'}, {'answer_id': 76336, 'author': 'cynicalman', 'author_id': 410, 'author_profile': 'https://Stackoverflow.com/users/410', 'pm_score': 1, 'selected': False, 'text': '<p>That\'s compiled code, you\'ll need to use a decompiler like JAD: <a href="http://www.kpdus.com/jad.html" rel="nofollow noreferrer">http://www.kpdus.com/jad.html</a></p>\n'}, {'answer_id': 76351, 'author': 'Drew Frezell', 'author_id': 10954, 'author_profile': 'https://Stackoverflow.com/users/10954', 'pm_score': 3, 'selected': False, 'text': '<p>You want a java decompiler, you can use the command line tool <code>javap</code> to do this.  Also, <a href="http://www.faqs.org/docs/Linux-HOWTO/Java-Decompiler-HOWTO.html" rel="noreferrer">Java Decompiler HOW-TO</a> describes how you can decompile a class file.</p>\n'}, {'answer_id': 76356, 'author': 'David Beleznay', 'author_id': 13359, 'author_profile': 'https://Stackoverflow.com/users/13359', 'pm_score': 2, 'selected': False, 'text': '<p>what you are looking for is a java de-compiler.  I recommend JAD <a href="http://www.kpdus.com/jad.html" rel="nofollow noreferrer">http://www.kpdus.com/jad.html</a>  It\'s free for non commercial use and gets the job done. </p>\n\n<p>Note: this isn\'t going to make the code exactly the same as what was written. i.e. you\'re going to lose comments and possibly variable names, so it\'s going to be a little bit harder than just reading normal source code.    If the developer is really secretive they will have obfuscated their code as well, making it even harder to read. </p>\n'}, {'answer_id': 76371, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>As suggested you can use JAD to decompile it and view the files. To make it easier to read you can use the JADclipse plugin for eclipse to integrate JAD directly to eclipse or use DJ Java Decompiler which is much easier to use than command line JAD</p>\n'}, {'answer_id': 76375, 'author': 'Michael Myers', 'author_id': 13531, 'author_profile': 'https://Stackoverflow.com/users/13531', 'pm_score': 6, 'selected': False, 'text': "<p>If you don't mind reading bytecode, javap should work fine. It's part of the standard JDK installation.</p>\n\n<pre><code>Usage: javap &lt;options&gt; &lt;classes&gt;...\n\nwhere options include:\n   -c                        Disassemble the code\n   -classpath &lt;pathlist&gt;     Specify where to find user class files\n   -extdirs &lt;dirs&gt;           Override location of installed extensions\n   -help                     Print this usage message\n   -J&lt;flag&gt;                  Pass &lt;flag&gt; directly to the runtime system\n   -l                        Print line number and local variable tables\n   -public                   Show only public classes and members\n   -protected                Show protected/public classes and members\n   -package                  Show package/protected/public classes\n                             and members (default)\n   -private                  Show all classes and members\n   -s                        Print internal type signatures\n   -bootclasspath &lt;pathlist&gt; Override location of class files loaded\n                             by the bootstrap class loader\n   -verbose                  Print stack size, number of locals and args for methods\n                             If verifying, print reasons for failure\n</code></pre>\n"}, {'answer_id': 76392, 'author': 'Daniel Spiewak', 'author_id': 9815, 'author_profile': 'https://Stackoverflow.com/users/9815', 'pm_score': 0, 'selected': False, 'text': '<p>JAD is an excellent option if you want readable Java code as a result.  If you really want to dig into the internals of the <code>.class</code> file format though, you\'re going to want <code>javap</code>.  It\'s bundled with the JDK and allows you to "decompile" the hexadecimal bytecode into readable ASCII.  The language it produces is still bytecode (not anything like Java), but it\'s fairly readable and extremely instructive.</p>\n\n<p>Also, if you <em>really</em> want to, you can open up any <code>.class</code> file in a hex editor and read the bytecode directly.  The result is identical to using <code>javap</code>.</p>\n'}, {'answer_id': 76410, 'author': 'DarenW', 'author_id': 10468, 'author_profile': 'https://Stackoverflow.com/users/10468', 'pm_score': 9, 'selected': True, 'text': '<p><a href="http://jd.benow.ca/" rel="noreferrer">jd-gui</a> is the best decompiler at the moment. it can handle newer features in Java, as compared to the getting-dusty JAD.</p>\n'}, {'answer_id': 76419, 'author': 'Zac Gochenour', 'author_id': 1812999, 'author_profile': 'https://Stackoverflow.com/users/1812999', 'pm_score': 1, 'selected': False, 'text': "<p>You need to use a decompiler.  Others have suggested JAD, there are other options, JAD is the best.</p>\n\n<p>I'll echo the comments that you may lose a bit compared to the original source code.  It is going to look especially funny if the code used generics, due to erasure.</p>\n"}, {'answer_id': 76728, 'author': 'John Gardner', 'author_id': 13687, 'author_profile': 'https://Stackoverflow.com/users/13687', 'pm_score': 1, 'selected': False, 'text': '<p>JAD and/or JADclipse Eclipse plugin, for sure.</p>\n'}, {'answer_id': 76848, 'author': 'Arno', 'author_id': 13685, 'author_profile': 'https://Stackoverflow.com/users/13685', 'pm_score': 0, 'selected': False, 'text': '<p>There is no need to decompile Applet.class. The public Java API classes sourcecode comes with the JDK (if you choose to install it), and is better readable than decompiled bytecode. You can find compressed in src.zip (located in your JDK installation folder).</p>\n'}, {'answer_id': 84499, 'author': 'arturh', 'author_id': 4186, 'author_profile': 'https://Stackoverflow.com/users/4186', 'pm_score': 1, 'selected': False, 'text': '<p>If the class file you want to look into is open source, you should not decompile it, but instead attach the source files directly into your IDE. that way, you can just view the code of some library class as if it were your own</p>\n'}, {'answer_id': 389596, 'author': 'Emmanuel Dupuy', 'author_id': 37785, 'author_profile': 'https://Stackoverflow.com/users/37785', 'pm_score': 2, 'selected': False, 'text': '<p>cpuguru, if your applet has been compiled with javac 1.3 (or less), your best option is to use Jad.</p>\n\n<p>Unfortunately, the last JDK supported by JAD 1.5.8 (Apr 14, 2001) is JDK 1.3.</p>\n\n<p>If your applet has been compiled with a more recent compiler, you could try <a href="http://java.decompiler.free.fr" rel="nofollow noreferrer">JD-GUI</a> : this decompiler is under development, nevertheless, it generates correct Java sources, most of time, for classes compiled with the JDKs 1.4, 1.5 or 1.6.</p>\n\n<p>DarenW, thank you for your post. JD-GUI is not the best decompiler yet ... but I\'m working on :)</p>\n'}, {'answer_id': 19048083, 'author': 'Karthikeyan Subramanian', 'author_id': 2606929, 'author_profile': 'https://Stackoverflow.com/users/2606929', 'pm_score': 2, 'selected': False, 'text': '<p>jd-gui "<a href="http://code.google.com/p/innlab/downloads/detail?name=jd-gui-0.3.3.windows.zip&amp;can=2&amp;q=" rel="nofollow">http://code.google.com/p/innlab/downloads/detail?name=jd-gui-0.3.3.windows.zip&amp;can=2&amp;q=</a>" is the best and user friendly option for decompiling .class file....</p>\n'}, {'answer_id': 41721294, 'author': 'tidbeck', 'author_id': 562935, 'author_profile': 'https://Stackoverflow.com/users/562935', 'pm_score': 0, 'selected': False, 'text': '<p><a href="http://www.benf.org/other/cfr/" rel="nofollow noreferrer">CFR - another java decompiler</a> is a great decompiler for modern Java written i Java 6.</p>\n'}, {'answer_id': 48830353, 'author': 'Nilashish C', 'author_id': 9252645, 'author_profile': 'https://Stackoverflow.com/users/9252645', 'pm_score': 4, 'selected': False, 'text': '<p>As pointed out by @MichaelMyers, use </p>\n\n<pre><code>javap -c &lt;name of java class file&gt; \n</code></pre>\n\n<p>to get the JVM assembly code. You may also redirect the output to a text file for better visibility.</p>\n\n<pre><code>javap -c &lt;name of java class file&gt; &gt; decompiled.txt\n</code></pre>\n'}, {'answer_id': 48947226, 'author': 'Prachi Sharma', 'author_id': 8405520, 'author_profile': 'https://Stackoverflow.com/users/8405520', 'pm_score': 2, 'selected': False, 'text': '<p>you can also use the online java decompilers available. For e.g. <a href="http://www.javadecompilers.com" rel="nofollow noreferrer">http://www.javadecompilers.com</a></p>\n'}]
['https://Stackoverflow.com/questions/76314', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2312/']