I
I
idkiberlord0772021-12-13 13:51:45
Java
idkiberlord077, 2021-12-13 13:51:45

How to build a decompiled Maven project back into a jar?

Hello friends.

I had an idea to paint one old program, which is written in Java. I have never done anything like this before, but my conscience does not allow me to give up halfway. I hope there are experts on this forum who will show me the right path. And so, what did I do:

- I opened the lib folder, and there are a lot of jar files there. At least I didn’t write a single program in Java, but I knew that it was a library.
- I searched for java code decompilers (people do the same) And I found an excellent online decompiler, here is the link
www.javadecompilers.com
- With the help of the decompiler, I began to study the code (I was lucky, the code is not obfuscated) and look for a place where I need to fix it and I think I found it. But I can’t check, I have to build the jar back.
- I started to learn Java project builders. I found javac at first, which did not help me, but then I found the META_INF folder and pom.xml in the root.
- I tried to create a new project in Idea and put the project folder from the decompiled bible in src/. Replace pom.xml with your own. And try to write
mvn clean package
but gives errors.

61b723f7be0f3604481390.png

I understand that my main task now is to compile .java files into .class, but I don't know how to do it correctly.
Maybe someone tried to do something similar and it worked?
Maybe something to read and see. I'm not looking for solutions, I'm trying to ask for directions.
Thank you all in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Dmitriev, 2021-12-23
@ald61

I suggest not to create a new project, but to import it as a "maven project". In Eclipse, this works with a bang, and there will be no need to understand the folder structure of the project, the IDE should sort everything out by itself. Next, select pom and in the context menu Run as (this is me, again, according to Eclipse). Periodically, I also like to delve into other people's projects, it seems like it turned out in the described way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question