Jump to content
  • 0

Question

Posted

Hi Friends. I am learning a little how to edit jar files from the Core, i Need to modify the engine.jar to add some lines in donatemanager class for the classes changer but i got an error when i import the jar file to my proyecto,for example error in imports Like log4j.

Could you explain the Steps to modify and import this files to our project?.

3 answers to this question

Recommended Posts

  • 0
Posted

If you need change any class from JAR package then you need:

 

  • Decompile the target class;
  • Create new Java project in IDE as container of target class (project can includes only "dead code");
  • Normalize all fields and methods;
  • Restore all imports with external dependencies;
  • Compile as new project;
  • Replace new class from new JAR package to old.

For all you need any IDE (Eclipse, IntelliJ IDEA) and any Jva decompile (e.g. Java Decompiler)

  • Like 2
  • 0
Posted
11 hours ago, Rootware said:

If you need change any class from JAR package then you need:

 

  • Decompile the target class;
  • Create new Java project in IDE as container of target class (project can includes only "dead code");
  • Normalize all fields and methods;
  • Restore all imports with external dependencies;
  • Compile as new project;
  • Replace new class from new JAR package to old.

For all you need any IDE (Eclipse, IntelliJ IDEA) and any Jva decompile (e.g. Java Decompiler)

 

}

Thanks Root, i have exported source from engine.jar, i have created a Java Project with java 11 because Sunrise use that. then i copy the files to the project and imported a library of l24j. That error has been resolved, but tha source has an error because cant find de l2r.DatabaseFactory and L2PCInstance. i share the images.

If i export that source i think that it wouldnt work.

 

https://ibb.co/z28XxKg

https://ibb.co/TvZbYf8

  • 0
Posted

You need restore all dependencies. It means you need:

 

  • reproduce classes irerarchy and package location (e.g. if target class locates by path "l2j.net.sf.gameserver" you need create this package path in your new project and put there target class);
  • if target class calls some methods from classes from this package then you need create this classes as DUMMIES and reproduce them empty methods/fields for exclude logical errors while compilation. This names as "make a dead code";
  • compile result and take modified class for replacing.

That's all steps i meant by phrase "Restore all imports with external dependencies".

 

Sometimes recompilation the target class requeres a lot of time and new project can includes few hundreds "depended" classes. You must be ready for this.

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...