I am opening a minecraft class folder with notepad++. But whenever I open it, it just has a bunch of boxes that say Nul, DC1, SO, SOH, FF, STX, ect... On guides I see that the class file opens just fine, what am I doing wrong?
3 Answers
you cannot view the source of the file if it is still compiled, you have to decompile the class file to a java file and then you can read the file with notepad/eclipse, there is a program that people have made to decompile the minecraft source so you can edit it, its called mcp
http://mcp.ocean-labs.de/index.php/MCP_Releases
Just download this and continue as you're meant to, then you can freely edit the code
You are trying to edit a compiled Java class.
It's not a text file, so you can't edit it with a text editor. You want a .java
file, and I don't believe Minecraft is open source.
Check your guides again, you've likely strayed from the path on which they were intending to lead you.

- 95,191
- 9
- 106
- 122
-
I used a modding program to decompile the classes. It says File type: CLASS file. is it supposed to be a java file then? – Madison Young Feb 05 '12 at 07:44
-
1@MadisonYoung You should edit the `.java` file you got from the decompiler. – Borealid Feb 05 '12 at 07:45
If you want to open class file as is, use any binary editor. ghex is a good one. You can do:
ghex MyClass.class
javap is a built in tool to disassemble java class files. Here is an example:
javap -v MyClass.class
This will provide you with lots of information about your class, its byte code and even explanation to what it is doing
Another awesome tool for java class file decompilation is CFR: http://www.benf.org/other/cfr/ Example:
java -jar cfr.jar MyClass.class
Source:
import java.math.BigInteger;
import java.util.stream.Stream;
public class MyClass {
public static void main(String[] args) {
System.out.println(
Stream.iterate(
new BigInteger[]{BigInteger.ZERO, BigInteger.ONE},
n -> new BigInteger[]{n[1], n[0].add(n[1])}
)
.limit(1001)
.skip(1000)
.findFirst()
.get()[1]
);
}
}
CFR output:
import java.io.PrintStream;
import java.math.BigInteger;
import java.util.Optional;
import java.util.stream.Stream;
public class MyClass {
public static void main(String[] arrstring) {
System.out.println(Stream.iterate(new BigInteger[]{BigInteger.ZERO, BigInteger.ONE}, arrbigInteger -> new BigInteger[]{arrbigInteger[1], arrbigInteger[0].add(arrbigInteger[1])}).limit(1001L).skip(1000L).findFirst().get()[1]);
}
}

- 373
- 3
- 9