diff --git a/src/com/jhe/hexed/JHexEditorASCII.java b/src/com/jhe/hexed/JHexEditorASCII.java index 064088a3..b69c1fbf 100644 --- a/src/com/jhe/hexed/JHexEditorASCII.java +++ b/src/com/jhe/hexed/JHexEditorASCII.java @@ -69,9 +69,9 @@ public class JHexEditorASCII extends JComponent implements MouseListener, g.setColor(Color.black); } - String s = "" + new Character((char) he.buff[n]); + String s = String.valueOf((char) (he.buff[n] & 0xFF));//"" + new Character((char) he.buff[n]); if ((he.buff[n] < 20) || (he.buff[n] > 126)) - s = "" + (char) 16; + s = ".";//"" + (char) 16; he.printString(g, s, (x++), y); if (x == 16) { x = 0; diff --git a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index d569f615..cbfcf9f3 100644 --- a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -122,7 +122,7 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager; public class BytecodeViewer { /*per version*/ - public static String version = "2.9.15"; + public static String version = "2.9.16"; public static boolean previewCopy = false; public static boolean fatJar = true; //could be automatic by checking if it's loaded a class named whatever for a library /*the rest*/ @@ -620,7 +620,7 @@ public class BytecodeViewer boolean empty = java.isEmpty(); while (empty) { showMessage("You need to set your Java path, this requires the JRE to be downloaded." + BytecodeViewer.nl + - "(C:/programfiles/Java/JRE_xx/bin/java.exe)"); + "(C:/programfiles/Java/JDK_xx/bin/java.exe)"); viewer.java(); empty = java.isEmpty(); } diff --git a/src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java b/src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java index 477fa845..05141550 100644 --- a/src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/compilers/JavaCompiler.java @@ -48,12 +48,12 @@ public class JavaCompiler extends Compiler { tempD.mkdirs(); new File(fileStart2).mkdirs(); - if (BytecodeViewer.javac.equals("")) { - BytecodeViewer.showMessage("You need to set your Javac path, this requires the JDK to be downloaded." + BytecodeViewer.nl + "(C:/programfiles/Java/JRE_xx/bin/javac.exe)"); + if (BytecodeViewer.javac.equals("") || !new File(BytecodeViewer.javac).exists()) { + BytecodeViewer.showMessage("You need to set your Javac path, this requires the JDK to be downloaded." + BytecodeViewer.nl + "(C:/programfiles/Java/JDK_xx/bin/javac.exe)"); BytecodeViewer.viewer.javac(); } - if (BytecodeViewer.javac.equals("")) { + if (BytecodeViewer.javac.equals("") || !new File(BytecodeViewer.javac).exists()) { BytecodeViewer.showMessage("You need to set Javac!"); return null; } diff --git a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index ad5ffb0f..571449af 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -112,7 +112,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { @Override public String getDescription() { - return "Javac Executable (Requires JDK 'C:/programfiles/Java/JRE_xx/bin/javac.exe)"; + return "Javac Executable (Requires JDK 'C:/programfiles/Java/JDK_xx/bin/javac.exe)"; } }); fc.setFileHidingEnabled(false); @@ -137,7 +137,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { @Override public String getDescription() { - return "Java Executable (Inside Of JRE/JDK 'C:/programfiles/Java/JRE_xx/bin/java.exe')"; + return "Java Executable (Inside Of JRE/JDK 'C:/programfiles/Java/JDK_xx/bin/java.exe')"; } }); fc.setFileHidingEnabled(false); diff --git a/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java index 18f1d033..541c7a52 100644 --- a/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java +++ b/src/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java @@ -2,6 +2,7 @@ package the.bytecode.club.bytecodeviewer.plugin.preinstalled; import java.util.ArrayList; +import org.objectweb.asm.Opcodes; import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.MethodNode; @@ -30,23 +31,44 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole; * Simply shows all classes that have a public static void main(String[]) * * @author Konloch + * @author Sh1ftchg */ -public class ShowMainMethods extends Plugin { +public class ShowMainMethods extends Plugin +{ + private static final int PUBLIC_STATIC = Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC; @Override public void execute(ArrayList classNodeList) { PluginConsole frame = new PluginConsole("Show Main Methods"); + StringBuilder sb = new StringBuilder(); for (ClassNode classNode : classNodeList) { for (Object o : classNode.methods.toArray()) { MethodNode m = (MethodNode) o; - if (m.name.equals("main") - && m.desc.equals("([Ljava/lang/String;)V")) - frame.appendText(classNode.name + "." + m.name + "" - + m.desc); + if ((m.access & (PUBLIC_STATIC)) == PUBLIC_STATIC) + { + if (m.name.equals("main") && m.desc.equals("([Ljava/lang/String;)V")) + { + sb.append(classNode.name); + sb.append("."); + sb.append(m.name); + sb.append(m.desc); + sb.append("\n"); + } + } } } + + if(sb.length() == 0) + { + frame.appendText("No main methods found."); + } + else + { + frame.appendText(sb.toString()); + } + frame.setVisible(true); } }