Java class file editor

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A java class file viewer and editor, written in C#. Similar to jclasslib but supports extra features such as copy and paste bytecode between methods

License

AngryCarrot789/BCEdit180

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A java classfile viewer and editor, written in C#.

Similar to jclasslib but will soon support many more features, e.g copy and pasting bytecode, adding and removing methods and fields, etc

Click here for insertion/removal and also copying instructions between methods/classes

You can download the release.zip file from releases, which includes the .exe with all the dependencies

If you want to build it yourself, you will need to build the projects REghZy.MVVM and REghZy.WPF from https://github.com/AngryCarrot789/REghZyUtilsCS, and reference those 2 DLL files in this project. Once you reference them, you should be able to build

You don’t need to download my fork of the JavaAsm library, as i moved it into this solution. But it can be found here: https://github.com/AngryCarrot789/java-asm My fork of java-asm targets .NET Standard 2.0 (instead of 2.1 which the original creator used), as well as my MVVM and WPF libraries, which works fine with .NET Framework 4.7.2 which this project uses (i think. i didn’t really look)

  • Class info viewer
  • Interfaces list (can edit, add and remove interfaces)
  • Editable class attributes (apart from bootstrap methods; they are contained in the method instructions)
  • Method list, + general method info editor (descriptor, name, max stack/locals, etc)
  • Method instruction editor (bytecode editor), allowing basically every single instruction to be modified. The bytecode editor also has colours, which helps the details stand out.
  • You can copy instructions between methods (including methods in different classes), using the copy and paste buttons
  • Exception table and local variable table editor. Cannot add/remove exceptions or local variables currently (coming soon)
  • Field list + general field info editor (name, descriptor, signature, etc)
  • A source code generator (does not actually generate method source code, only the structure of the class (all methods will look ‘abstract’))
  • You can create and remove methods too. But you can’t actually add instructions to the methods yet, so it’s pretty much pointless
  • You can create and remove fields, which might have some use with reflection or when using custom ASM libraries
  • You can view annotations, but you can only edit the annotation type, and the name/type of the annotation’s entries. Will add more to this soon though
Читайте также:  PHPMailer Contact Form

There’s probably more that i’ve missed, but this is generally what this program can do

When loading big class files (with 100s of methods), it may lag for a split second. The bytecode editor will be the most laggiest (scrolling isn’t laggy at all); when you select a new method, it has to clear a list of instructions and create new list items for each instruction. WPF controls, like ListBoxItems (which the bytecode editor use for every instruction) usually takes about half a millisecond (0.5ms~) to create and add to the bytecode editor list. Meaning when you select a method with, say, 1000 instructions, there will be a half second lag spike. This is a limit in the WPF framework and i’m 99% certain there’s no way to decrease this lag 🙁 (unless i switch to a text editor. but i don’t work at JetBrains so :< )

Copying code between methods

I use this feature a lot to inject instructions into an existing method (because i do a lot of minecraft plugin/mod fixes). So instead of decompiling, editing, and recompiling a class (which might not be successful if you’re missing libraries, or if the decompilation isn’t 100%), you can insert the instructions yourself. But if you don’t fancy inserting instructions 1-by-1:

  • You can write a simple class in VSCode for example, then compile it ( javac MyClass.java in CMD/terminal)
  • Drag and drop the class you want to modify, and MyClass (or whatever you called it) into the app
  • Then, in MyClass, goto Methods > Bytecode Editor and select the instructions you want to copy, then click Copy.
  • Then goto the target class and into it’s bytecode editor, and click either Paste Below or Paste Above (the selected instruction). Branches will keep their target, but you have to re-link branches if you copied a jump instruction or switch table/lookup but not it’s target

The screenshots above probably don’t show the copy/paste buttons, i have yet to update them:

Читайте также:  Редактор html таблиц online

About

A java class file viewer and editor, written in C#. Similar to jclasslib but supports extra features such as copy and paste bytecode between methods

Источник

Java Class File Editor

Open a Java class file binary to view or edit strings, attributes, methods and generate readable reports similar to the javap utility. In built verifier checks changes before saving the file. Easy to use Java Swing GUI.

Project Samples

ClassEditor Constant Pool Display ClassEditor Byte Code Display ClassEditor Methods Screen

Project Activity

Categories

License

Follow Java Class File Editor

The modern way to do B2B integration.

User Ratings

User Reviews

Additional Project Details

Languages

Intended Audience

Programming Language

Registered

The Java™ Programming Language is a general-purpose, concurrent, strongly typed, class-based object-oriented language. It is normally compiled to the bytecode instruction set and binary format defined in the Java Virtual Machine Specification. In the Java programming language, all source code is.

Rapise is a robust, next-generation test automation platform for desktop, mobile, and web applications developed by Inflectra. Using the power of open and extensible architecture, Rapise delivers the most rapid and flexible functional testing tool. Rapise comes with a built-in support for.

MarathonITE makes it easy to create GUI tests. You can quickly automate your functional tests and regression tests. MarathonITE has an open and flexible architecture based on open source projects like Marathon, Ruby and Selenium. MarathonITE makes creating, maintaining and executing automated.

Источник

JBE — Java Bytecode Editor

JBE is a bytecode editor suitable for viewing and modifying java class files. It is built on top of the open-source jclasslib bytecode viewer by ej-technologies. For verification and exporting the class files, JBE uses the the Bytecode Engineering Library by Apache’s Jakarta project.

  • JBE requires Java 1.5 to run.
  • It uses the standard mnemonics for JVM opcodes as instruction names. Jumps are absolute, labels are shown as line numbers. The cases/targets of tableswitch and lookupswitch instructions should be preceded by a tab or a space.
  • Class names should be written using the Java class file format conventions, so java.lang.String becomes java/lang/String
  • Type information is also written as they appear in class files (e.g. the descriptor I speficies an integer, [Ljava/lang/Thread; is an array of Threads, etc.).
  • To add a constant, method, interface or field, select the appropriate section in the left pane. A form for adding th appropriate attribute is displayed on the main pane.
  • To remove a constant, method, interface or a field, select it in the left pane. A delete button appears on the main pane.
  • To add or remove an exception select the method’s exception table tab. There, a form is included for adding an exception. An exception can be removed via the delete button.
  • There is no global save, all changes are directly applied to the class file after adding/deleting/modifying attributes. To return to the original file, select the appropariate menu item or button («Revert to original class file»).

Источник

Class File Editor in Java

Class File Editor in Java

  1. Features of Java Class File Editor
  2. Using Java Class File Editor to Edit a Compiled Java Class
Читайте также:  Таблицы

In this article, we will discuss the Java Class File Editor, a tool created in Java used to edit Java compiled classes. We can decompile and see the Java classes once they are created, but we need tools like the Java Class File Editor to modify them.

Features of Java Class File Editor

  • Easy to use Interface built using Java Swing
  • Allows modifications of various parts of a class file, like methods, strings, constants, etc.
  • Consistency Checks

Using Java Class File Editor to Edit a Compiled Java Class

Download Java Class File Editor from https://sourceforge.net/projects/classeditor/files/
Extract the compressed file, and open the JAR file name ce.jar shown below.

Class File Editor in Java - Step 2

If we are unable to open the file, we can open the command line/terminal and use the following command:

Once the editor is opened, we open a Java class file using the File > Open menu item and choose the explorer class file.
We will use the following code in the class file.
public class ExampleClass1   private static final String METHOD_NAME1 = "exampleMethod1";  private static final String METHOD_NAME2 = "exampleMethod2";   public static void main(String[] args)   int abc = 200;  System.out.println(abc);  exampleMethod2();   >   static void exampleMethod2()   System.out.println("This is just a method");  >  > 
After the editor opens the file, we turn on the Modify Mode in the top-right corner; this mode is off by default, as shown in the image below. The button will turn blue if it is on and green if it is off.

Class File Editor in Java - Step 5

After the modification is on, we can modify certain aspects of the class by going to different editor sections.

The General section of the editor shows the class name and its parent class. We can see and edit the interfaces if any are in the class. Class Access Modifiers are also there, which we can change if we want to.
Class File Editor in Java - Step 6
The next section is the Constant Pool section, which displays all the editor’s constants in the class. Here we can change the type of the constant and its value. We can add new constants or delete an existing one.
Class File Editor in Java - Step 6
The Fields section of the editor shows the fields with their access modifiers which we can modify.
Class File Editor in Java - Step 6
The last section of the editor part is the Methods section, where all the class methods are listed with their name, access modifiers, and return types that are all editable, and we can change them.
Class File Editor in Java - Step 2

After all the modifications, we save the class file using the File > Save menu item. We can also export all the items like the name of fields, constants, methods, and their values as an XML file using the File > Export to XML menu item.

Rupam Saini is an android developer, who also works sometimes as a web developer., He likes to read books and write about various things.

Источник

Оцените статью