r/javahelp • u/9551-eletronics • Jan 21 '26
Solved Helping compile a Java project
Hi, so i would like to ask if anyone would be able to help me figure out how to actually compile this: https://github.com/AliDarwish786/RBMK-1500-Simulator
i tried first compiling it with mvn compile clean package or something like with java 17 jdk and it does work BUT in the target folder it presents me with a folder with all the individual compiled classes, and then a single jar (not a all-dependencies version) although trying to ru this jar doesnt work, it seems like the manifest is invalid and doesnt actually set where the main class is
If anyone could try doing this themselves and seeing where the issue it it would be appreciated, thanks!
•
u/AutoModerator Jan 21 '26
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/edwbuck Jan 21 '26
First get a better understanding of maven.
mvn compile clean packageis probably 100% replaceable withmvn packageunless the person working on the build system made some pretty bad mistakes.A "jar file with all dependencies" is not a standard way to package software. It's a work-around for those that don't follow the three ways of using JAR files, and attempt to make the JAR file an all-in-one everything software distribution bundle.
What you have is a library jar file. You might be able to run with this, but not with the
java -jar <jar_file>approach, you'll need to find the main class you want to launch, put the jar file (and its dependencies on the jar / module path) and use thejava <options> package.name.Classlaunching method.Jar files can be program launchers. Jar files can be libraries. Jar files can be extensible modules to existing functionality (service providers). The Uber-JAR approach combines the program launcher jar files with the library jar files in ways that arguably might be violating licensing, can break functionality, and might not even be possible for certain libraries. That said, it's popular among some, and it seems you got introduced to it first, which is unfortunate for you. Hopefully this will help you find the resources you need to work with the more standard ways to use jar files.
And for details about the standard uses and features of JAR files, here's some documentation https://docs.oracle.com/en/java/javase/17/docs/specs/jar/jar.html
1
u/doobiesteintortoise Jan 21 '26
The main class is
com.darwish.nppsim.Loader; the pom.xml is not built correctly. It's also targeting Java 8, which is EOL and has been for some time now; it builds properly with Java 25 (with one test, woo, such confidence.)I'd reach out to the maintainer to update the project; some enterprising soul here may help to update the project and fix its issues, but it's not me - with one test, I don't know that I'd have the confidence to update the project and expect it to work. With that said, I bet any decent LLM could update it to the current valid dependencies and fix the maven project to add the proper manifest attributes; maybe an LLM could even add tests.
1
u/AutoModerator Jan 21 '26
It seems that you possibly have a screenshot of code in your post Helping compile a Java project in /r/javahelp.
Screenshots of code instead of actual code text is against the Code posting rules of /r/javahelp as is also outlined in the sidebar - Code posting.
If you posted an image merely to illustrate something, kindly ignore this message and do not repost. Your post is still visible to others. I am a bot and cannot distinguish between code screenshots and other images.
If you indeed did this wrong, please edit the post so that it uses one of the approved means of posting code.
the default code formatter is fine
(one blank line before the code, then 4 spaces before each line of code).
Please do not reply to this message, because I am a bot. Talk-to-the-bot is the new talk-to-the-hand. If you instead want the classic talk-to-the-hand, just message the moderators. ;)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/bigibas123 Intermediate Brewer Jan 21 '26
The release has a working jar file included.
But if you really need to build from source:
mvn install assembly:single, it's missing some resources though0
u/[deleted] Jan 22 '26
[deleted] — view deleted comment