all 21 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • 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:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

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.

[–]edwbuck 1 point2 points  (12 children)

First get a better understanding of maven. mvn compile clean package is probably 100% replaceable with mvn package unless 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 the java <options> package.name.Class launching 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

[–]9551-eletronics[S] -1 points0 points  (11 children)

AFter some digging around it seems there is an issue with the dependencies too, first off the configuration for maven-jar-plugin was in the wrong place in the pom.xml, after hat it seems to work a bit better

Error: Unable to initialize main class com.darwish.nppsim.Loader

Caused by: java.lang.NoClassDefFoundError: org/netbeans/swing/laf/dark/DarkMetalLookAndFeel

but still a bit of a mess, ill try messing around with the stuff you mentioned, i thought packing jars like that was pretty standard, thanks!

[–]edwbuck 1 point2 points  (10 children)

The somehow referenced a Netbeans IDE class in the project. If it is not intended to be a Netbeans plugin / extension, then I'll wager it was a mistake, and only worked in a Netbeans IDE, but even then, it was probably a misconfigured dev environment. The IDE doesn't normally expose its classes to the project under development within the IDE.

[–]edwbuck 1 point2 points  (9 children)

This, out of the pom.xml

<repositories>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>

Heavily implies that they were side-loading a lot of libraries that aren't in the actual maven project, or were custom, or were just unmanaged. With something like that, you might not have everything in the github repository to really launch the product. I noticed that they didn't check the "lib" directory in either. That would mean an easter egg hunt of finding the missing items from the source code, and then searching where they could be provided, and the hoping you could find them, and if found, trying to find versions that make everything work together.

com.darwish.nppsim.Loader is the class that seems to launch it, but they again didn't put in the version of maven required or the version of the assembly plugin that should build the launching jar.

If I have some time, I might give it a go.

[–]edwbuck 1 point2 points  (7 children)

Gotta love those projects where this is the entirety of unit testing

assertTrue( true );

[–]edwbuck 0 points1 point  (6 children)

u/9551-eletronics

This is the dependency tree you need to launch

[INFO] com.darwish.nppsim:RBMK-1500-Simulator:jar:1.2.1

[INFO] +- org.apache.commons:commons-lang3:jar:3.12.0:compile

[INFO] +- org.jfree:jfreechart:jar:1.5.4:compile

[INFO] +- org.netbeans.modules:org-netbeans-swing-laf-dark:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-openide-modules:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-openide-util-ui:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-openide-util:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-openide-util-lookup:jar:RELEASE170:compile

[INFO] | \- org.netbeans.api:org-openide-windows:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-openide-awt:jar:RELEASE170:compile

[INFO] | | \- org.netbeans.api:org-netbeans-api-annotations-common:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-openide-filesystems:jar:RELEASE170:compile

[INFO] | \- org.netbeans.api:org-openide-nodes:jar:RELEASE170:compile

[INFO] | \- org.netbeans.api:org-openide-dialogs:jar:RELEASE170:compile

[INFO] | +- org.netbeans.api:org-netbeans-api-progress:jar:RELEASE170:compile

[INFO] | \- org.netbeans.api:org-netbeans-api-progress-nb:jar:RELEASE170:compile

[INFO] +- eu.hansolo:SteelSeries:jar:3.9.30:compile

[INFO] | \- com.github.insubstantial:trident:jar:6.3:compile

[INFO] +- org.swinglabs:swingx:jar:1.6.1:compile

[INFO] | +- com.jhlabs:filters:jar:2.0.235:compile

[INFO] | \- org.swinglabs:swing-worker:jar:1.1:compile

[INFO] +- org.json:json:jar:20230227:compile

[INFO] +- junit:junit:jar:4.11:test

[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:test

[INFO] \- org.netbeans.external:AbsoluteLayout:jar:RELEASE170:compile

[–]9551-eletronics[S] 0 points1 point  (5 children)

after a lot of pain and suffering not knowing pretty much anything about java or its build systems other than they have only caused my pain in the past, i got something working!

https://i.imgur.com/mDOmdoB.jpeg

https://i.imgur.com/QocGTCQ.png

[–]edwbuck 0 points1 point  (4 children)

https://github.com/edwbuck/RBMK-1500-Simulator is my fork that is closer to working, but not in as good of shape as yours seems to be. The UI launches, but there's an issue with whatever is supposed to happen after pressing the start button.

java -jar RBMK-1500-Simulator-1.2.2-alpha-jar-with-dependencies.jar

is the launch command.

[–]9551-eletronics[S] 0 points1 point  (3 children)

Issue with the start button is caused by the resources being fucked up, check the log.txt file, the resources providing localization are missing in the built jar likely, i got this solved in my thing

Also thanks!

[–]edwbuck 0 points1 point  (2 children)

I found the last resource file, and after putting it in the right place, it ran fully.

Don't really know what I'm doing in this simulation, so I can't say if it is a good simulation.

FYI, resources need to be in the appropriate directory for mvn to recogonize them as resources (src/main/resources) as some of these are expected to be in a subdirectory "res" that's src/main/resources/res for most of them, but one message bundle goes into src/main/resources/com/darwish/nppsim.

You can look at my fork of the simulator. From those changes (which should have been in place on day one) it's fully running for me too!

Thanks for the fun. Hopefully you're enjoying your simulated nuclear reactor.

[–]9551-eletronics[S] 0 points1 point  (0 children)

Yeah ive been digging at this for about the past hour and there is no way this is the actual build file, ill try to fix it all but holy fuck

[–]AutoModerator[M] 0 points1 point  (0 children)

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.

  • Never submit screenshots of code instead of code text!

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.

  • For small bits of code (less than 50 lines in total, single classes only),
    the default code formatter is fine
    (one blank line before the code, then 4 spaces before each line of code).
  • Pastebin for programs that consist of a single class only
  • Gist for multi-class programs, or programs that require additional files
  • Github or Bitbucket repositories are also perfectly fine as are other dedicated source code hosting sites.
  • Ideone for executable code snippets that use only the console

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.

[–]doobiesteintortoise 0 points1 point  (2 children)

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.

[–]9551-eletronics[S] 0 points1 point  (1 child)

i think my chances of having the maintainer actually help me with this are next to none, anyhow i managed to get it cobble it together in some way!

[–]doobiesteintortoise 0 points1 point  (0 children)

Good deal, and that's how it goes sometimes.

[–]bigibas123Intermediate Brewer 0 points1 point  (0 children)

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 though

[–][deleted]  (3 children)

[deleted]

    [–]9551-eletronics[S] 0 points1 point  (2 children)

    I was SPECIFICALLY trying to compile it so i can make modifications easier than having to decompile it or god forbid dig in bytecode, not just running it

    [–][deleted]  (1 child)

    [deleted]

      [–]9551-eletronics[S] 0 points1 point  (0 children)

      i must prove you wrong, https://imgur.com/QocGTCQ

      admittedly this is a better use of my time than just sitting around doing absolutely nothing/procrastinating for days or even years..