Module Not Found, when doing "mvn clean install"

My project has one Module named useTesting and inside this module theres another 3 Modules (use-assembly, use-core, use-gui). All these Modules do have a module-info.java now I wanted to create another module named use-guiFX which is using things from use-core and use-gui when calling mvn clean install I get the following:
[INFO] use ................................................ SUCCESS [ 0.265 s]
[INFO] use-assembly ....................................... SUCCESS [ 5.609 s]
[INFO] use-core ........................................... SUCCESS [ 16.766 s]
[INFO] use-gui ............................................ SUCCESS [ 10.322 s]
[INFO] use-guiFX .......................................... FAILURE [ 0.861 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.957 s
[INFO] Finished at: 2024-10-30T20:20:44+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project use-guiFX: Compilation failure
[ERROR] /C:/Users/akifn/Desktop/MyProjects/java/useTesting/use-guiFX/src/main/java/module-info.java:[10,17] module not found: use.gui
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :use-guiFX
[INFO] use ................................................ SUCCESS [ 0.265 s]
[INFO] use-assembly ....................................... SUCCESS [ 5.609 s]
[INFO] use-core ........................................... SUCCESS [ 16.766 s]
[INFO] use-gui ............................................ SUCCESS [ 10.322 s]
[INFO] use-guiFX .......................................... FAILURE [ 0.861 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.957 s
[INFO] Finished at: 2024-10-30T20:20:44+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project use-guiFX: Compilation failure
[ERROR] /C:/Users/akifn/Desktop/MyProjects/java/useTesting/use-guiFX/src/main/java/module-info.java:[10,17] module not found: use.gui
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :use-guiFX
what am I doing wrong? I am using IntelliJ, Project is in Java and uses Maven. can also join a call if needed.
No description
771 Replies
JavaBot
JavaBot4w ago
This post has been reserved for your question.
Hey @Akif! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st4w ago
Do you have a use.gui module with that name in the module-info.java? Can you show the pom.xml and the module-info.java of use-guiFX
Akif
AkifOP4w ago
yes sure: here is the module-info.java for my use.gui
module use.gui {
requires org.eclipse.jdt.annotation;
requires use.core;
requires vtd.xml;
requires com.google.common;
requires itextpdf;
requires java.desktop;
exports org.tzi.use.gui.main;
exports org.tzi.use.gui.util;
exports org.tzi.use.gui.views.diagrams.behavior.communicationdiagram;
exports org.tzi.use.gui.views.diagrams.classdiagram;
exports org.tzi.use.gui.views.diagrams.objectdiagram;
exports org.tzi.use.runtime.gui.impl;
exports org.tzi.use.runtime;
exports org.tzi.use.main.shell;

}
module use.gui {
requires org.eclipse.jdt.annotation;
requires use.core;
requires vtd.xml;
requires com.google.common;
requires itextpdf;
requires java.desktop;
exports org.tzi.use.gui.main;
exports org.tzi.use.gui.util;
exports org.tzi.use.gui.views.diagrams.behavior.communicationdiagram;
exports org.tzi.use.gui.views.diagrams.classdiagram;
exports org.tzi.use.gui.views.diagrams.objectdiagram;
exports org.tzi.use.runtime.gui.impl;
exports org.tzi.use.runtime;
exports org.tzi.use.main.shell;

}
and here my use-guiFX module-info.java
module use.guiFX {

requires javafx.graphics;
requires javafx.fxml;
requires use.core;
requires javafx.controls;
requires javafx.swing;
requires javafx.web;
requires org.kordamp.desktoppanefx.core;
requires use.gui;

exports org.tzi.use.mainFX;
exports org.tzi.use.gui.main;
opens org.tzi.use.gui.main;
}
module use.guiFX {

requires javafx.graphics;
requires javafx.fxml;
requires use.core;
requires javafx.controls;
requires javafx.swing;
requires javafx.web;
requires org.kordamp.desktoppanefx.core;
requires use.gui;

exports org.tzi.use.mainFX;
exports org.tzi.use.gui.main;
opens org.tzi.use.gui.main;
}
and here the pom.xml of the use-guiFX as a File
dan1st
dan1st4w ago
Can you try running mvn clean verify -DskipTests? Does that succeed? on the root project
Akif
AkifOP4w ago
Il run it now and let you know on useTesting right?
dan1st
dan1st4w ago
on the root I think that's use
Akif
AkifOP4w ago
ah yeah ok wait
No description
Akif
AkifOP4w ago
thats the root right?
dan1st
dan1st4w ago
If it's where all other modules are in
Akif
AkifOP4w ago
I guess I jut have had put a different name my fault when like forking and cloning
dan1st
dan1st4w ago
Can you also show the pom.xml of use-gui?
Akif
AkifOP4w ago
dan1st
dan1st4w ago
Are you overwriting the normal JAR with a jar-with-dependencies?
dan1st
dan1st4w ago
Why are you using
<finalName>use-guiFX</finalName>
<appendAssemblyId>false</appendAssemblyId>
<finalName>use-guiFX</finalName>
<appendAssemblyId>false</appendAssemblyId>
in the maven-assembly-plugin?
Akif
AkifOP4w ago
this is the result of mvn clean verify -DskipTests that part is copy pasted from the use-guis pom
dan1st
dan1st4w ago
[WARNING] Can't extract module name from use-gui.jar: Module 'use.core' is already on the module path!
Yeah, I think the jar-with-dependencies is the issue Why are you using that anywhere?
Akif
AkifOP4w ago
the other poms have it like that so thats why
dan1st
dan1st4w ago
You can try removing the <appendAssemblyId>false</appendAssemblyId> from all POMs
Akif
AkifOP4w ago
alright I will do that
dan1st
dan1st4w ago
and then the JARs with dependencies will have different names
Akif
AkifOP4w ago
I think so, what exactly do you mean when saying jar with dependencies?
dan1st
dan1st4w ago
You are using the Maven assembly plugin to generate JARs that include dependencies
Akif
AkifOP4w ago
I am trying to create the jar, which is a application that needs the librarys and such and the 3 modules to be also work with each other
dan1st
dan1st4w ago
meaning you'd have a single JAR that includes all dependencies/other modules it needs which causes issues with (JPMS) modules Because if you have a single JAR with everything, you don't have modules (module-info.java) any more
Akif
AkifOP4w ago
ahh so I dont really need module-info.java? originally that project does not have module-info.java build in
dan1st
dan1st4w ago
so you should not use a JAR with dependencies ;)
Akif
AkifOP4w ago
I just ended up building that in bcs when using webView (javaFX) it ended up causing problems when having created the jar here is the original Project: https://github.com/AkifAydin/useTesting or I should say my fork of it here is the original: https://github.com/useocl/use
Akif
AkifOP4w ago
after having done this and calling "mvn clean install" now I get this:
dan1st
dan1st4w ago
ok it seems like that integration test requires a JAR with dependencies
Akif
AkifOP4w ago
yeah I would like to not change the project, like the way it was originally. So my project, for you to understand what I am trying and working on is, that I am trying to migrate the GUI part of this application, which is originally swing/awt to javafx. so it then motly worked in the IntelliJ Local Machine when calling it in there but when having created the Jar the for example webView caused problems which sayed something like module not found. Would you say that my idea of building in the module-infos in the classes was maybe obsolete?
dan1st
dan1st4w ago
It seems like that was already fixed 4 months ago in the original project but you don't have that change in your fork
Akif
AkifOP4w ago
you mean the changes in the pom.xmlof the use?
dan1st
dan1st4w ago
Changes to ShellIT
dan1st
dan1st4w ago
GitHub
refactor: In process integration tests for the shell · useocl/use@3...
- Instead of executing the final binaries for the integration tests, which consumed a lot of time, we execute them in process by repeatedly calling main - Minor code style fixes suggested by IntelliJ
dan1st
dan1st4w ago
or you could also try getting it to work without modules
Akif
AkifOP4w ago
would you say I can just upgrade this part of the code? Or I would need to upgrade more?
dan1st
dan1st4w ago
If possible, I'd just update everything but make a backup of your project first you should be able to just pull/merge it with git (after you have the backup)
Akif
AkifOP4w ago
how could I best do a backup? kinda stressing a bit now :boohoo: 😅 like panicking prob for no reason but yeah sorry I was thinking of just copy pasting the project file somewhere else but maybe thats not the best solution/Backup?
dan1st
dan1st4w ago
copy the project it's fine
Akif
AkifOP4w ago
ok I will try @dan1st I have a stupid question now, do I want the things from Master? or do i have to use origin?
dan1st
dan1st4w ago
From the master of the remote corresponding to the original repository What's the output of git remote?
Akif
AkifOP4w ago
origin
dan1st
dan1st4w ago
only that?
Akif
AkifOP4w ago
i never really worked with forked projects I am sorry yes only that
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
I assume that's your fork?
Akif
AkifOP4w ago
idk i guess so 😅 mine is actually called akifAydin the one I am using https://github.com/AkifAydin/useTesting/tree/akifAydin
dan1st
dan1st4w ago
you can add a new remote to the original repo with git remote add upstream <URL of the original repo> this will create a new remote called upstream
Akif
AkifOP4w ago
ah did I maybe do something wrong when forking?
dan1st
dan1st4w ago
What's the output of git status? no, not at all
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
and then shows things to be stashed and changes and such but I think you wanted to see that on top
dan1st
dan1st4w ago
Which changes are there? no I'm interested in changes
Akif
AkifOP4w ago
Akif
AkifOP4w ago
changes to be commited not staged oned and untracked ones
dan1st
dan1st4w ago
so you changed a lot I hope there won't be merge conflicts
Akif
AkifOP4w ago
idk I actually didnt change anything or anything at all I motly just worked in that form me new created module
dan1st
dan1st4w ago
Then why are there so many modified files?
Akif
AkifOP4w ago
I got curious and am checking idk haha
dan1st
dan1st4w ago
might be line endings...
Akif
AkifOP4w ago
idk its showing me only the javadocs but i didnt tach these files so weird idk
dan1st
dan1st4w ago
oh you renamed a package
Akif
AkifOP4w ago
so yeah with this I connect now the original repo
dan1st
dan1st4w ago
you changed use.main to use.maincore
Akif
AkifOP4w ago
ah yeah that could be it I did that a few times but I thought i changed it back
dan1st
dan1st4w ago
Did you commit it in between?
Akif
AkifOP4w ago
on my forked project only on akifAydin
dan1st
dan1st4w ago
yeah so you changed the package, committed and changed it back?
Akif
AkifOP4w ago
last time 2 weeks ago thought havent had big accomplishments since I had this problem caused by the mvn generated jar not being able to show me wevView and such oh no these I didnt commit thats all in this 2 weeks
dan1st
dan1st4w ago
then I think you didn't change that package back
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
now i have upstream I see
dan1st
dan1st4w ago
yeah but before pulling in the changes from there, you should probably make sure you have no conflicts if possible and renaming a package iss very likely to cause conflicts so you might want to change it back
Akif
AkifOP4w ago
I changed it back you was right it was maincore
dan1st
dan1st4w ago
I think you might want to add use-guiFX/target to the gitignore after doing that, run git add . followed by git status to see your current state
Akif
AkifOP4w ago
ah ok so it doesnt show it anymore for now
dan1st
dan1st4w ago
What does that show?
Akif
AkifOP4w ago
Akif
AkifOP4w ago
sorry ignore the file before this
dan1st
dan1st4w ago
still quite a few changes in use-core that could cause issues you can try to create a commit and then run git pull upstream
Akif
AkifOP4w ago
oh but I dont know if I want to commit these should I?
dan1st
dan1st4w ago
you could also just run git pull upstream and see whether it works or first run git stash which removes your changes, pull and then run git stash apply to get your changes back
Akif
AkifOP4w ago
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> git pull upstream
remote: Enumerating objects: 2172, done.
remote: Counting objects: 100% (2083/2083), done.
remote: Compressing objects: 100% (1009/1009), done.
remote: Total 2172 (delta 955), reused 1862 (delta 821), pack-reused 89 (from 1)
Receiving objects: 100% (2172/2172), 1.15 MiB | 2.07 MiB/s, done.
Resolving deltas: 100% (960/960), completed with 167 local objects.
From https://github.com/useocl/use
* [new branch] 61-file-explorer-should-be-based-on-the-oss-explorer -> upstream/61-file-explorer-should-be-based-on-the-oss-explorer
* [new branch] cleanup -> upstream/cleanup
* [new branch] features/60-unify-user-and-developer-output-in-use -> upstream/features/60-unify-user-and-developer-output-in-use
* [new branch] intellij_cleanup -> upstream/intellij_cleanup
* [new branch] master -> upstream/master
* [new branch] use-library-support -> upstream/use-library-support
* [new tag] v7.0.0 -> v7.0.0
* [new tag] v7.0.1 -> v7.0.1
* [new tag] v7.1.0 -> v7.1.0
* [new tag] v7.1.1 -> v7.1.1
You asked to pull from the remote 'upstream', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> git pull upstream
remote: Enumerating objects: 2172, done.
remote: Counting objects: 100% (2083/2083), done.
remote: Compressing objects: 100% (1009/1009), done.
remote: Total 2172 (delta 955), reused 1862 (delta 821), pack-reused 89 (from 1)
Receiving objects: 100% (2172/2172), 1.15 MiB | 2.07 MiB/s, done.
Resolving deltas: 100% (960/960), completed with 167 local objects.
From https://github.com/useocl/use
* [new branch] 61-file-explorer-should-be-based-on-the-oss-explorer -> upstream/61-file-explorer-should-be-based-on-the-oss-explorer
* [new branch] cleanup -> upstream/cleanup
* [new branch] features/60-unify-user-and-developer-output-in-use -> upstream/features/60-unify-user-and-developer-output-in-use
* [new branch] intellij_cleanup -> upstream/intellij_cleanup
* [new branch] master -> upstream/master
* [new branch] use-library-support -> upstream/use-library-support
* [new tag] v7.0.0 -> v7.0.0
* [new tag] v7.0.1 -> v7.0.1
* [new tag] v7.1.0 -> v7.1.0
* [new tag] v7.1.1 -> v7.1.1
You asked to pull from the remote 'upstream', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.
dan1st
dan1st4w ago
git pull upstream master and hope there are no merge conflicts
Akif
AkifOP4w ago
yeah causing an problem
Akif
AkifOP4w ago
as you guessed
dan1st
dan1st4w ago
that looks like many potential merge conflicts you can do that: - git stash - git pull upstream master - git stash apply and see which conflicts you get if pulling gives you something about conflicts, don't do git stash apply
Akif
AkifOP4w ago
how can I check if it stashed?
dan1st
dan1st4w ago
git status
Akif
AkifOP4w ago
bcs the terminal was acting weird and now says no local changes to save
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
Did you run the stash command twice? that looks like stashing was successful
Akif
AkifOP4w ago
I might have bcs of the terminal ah ok glad to hear that
dan1st
dan1st4w ago
you can run git pull upstream master
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
I did run it
dan1st
dan1st4w ago
oh no ok only one merge conflict as it seems And it seems like it's an IntelliJ file
Akif
AkifOP4w ago
yeah right
dan1st
dan1st4w ago
Can you run git status?
Akif
AkifOP4w ago
I can add that to ignore?
dan1st
dan1st4w ago
Does it show anything about both modified?
Akif
AkifOP4w ago
Akif
AkifOP4w ago
yeah it does on a few files if you meant that
dan1st
dan1st4w ago
I think you can just run git checkout --theirs .idea/misc.xml to just use the misc.xml from the repo and ignore your changes to it Can you check the file use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java? I think it should have some weird markers indicating the conflicting parts like <<<<<<<<, >>>>>>>>> and ========
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
xD
dan1st
dan1st4w ago
Are these markers somewhere? e.g. near imports Did you modify that class in previous commits?
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
ok yeah this is where a merge conflict happened
Akif
AkifOP4w ago
i dont get it thought, bcs I have no changes in here since we stashed?
dan1st
dan1st4w ago
I think HEAD is your previous version and the part after the ====== is the changes from the original repo The stashing temporarily removed all your changes now you are merging the existing commits with the updates from the original repo (upstream)
Akif
AkifOP4w ago
ok so what would we do now?
dan1st
dan1st4w ago
fix all these conflicts
Akif
AkifOP4w ago
it seems like only a comment?
dan1st
dan1st4w ago
you see both versions and you have to decide on the version you want
Akif
AkifOP4w ago
so I could copy paste the part of the current in these?
dan1st
dan1st4w ago
you remove the version you don't want
Akif
AkifOP4w ago
or is there a more professional way on doing it?
dan1st
dan1st4w ago
?
Akif
AkifOP4w ago
I mean master/original deciding for that*
dan1st
dan1st4w ago
Do you want all changes from the original repo/upstream and ignore your changes?
Akif
AkifOP4w ago
you mean the ones we stashed?
dan1st
dan1st4w ago
no commits you made previously vs changes in the orriginal repository the stashed things are gone until you take them back in which case you could have more merge conflicts
Akif
AkifOP4w ago
as I sayed I mainly commited things in that new Module I created
dan1st
dan1st4w ago
yeah you'll see about that later
Akif
AkifOP4w ago
i think these wouldnt be affected right?
dan1st
dan1st4w ago
no should be fine
Akif
AkifOP4w ago
alright than i think we can do this I just hope project isnt gonna explode ☠️ with more problems but yeah we have a backup
dan1st
dan1st4w ago
if you want to ignore all changes in your previous commit, you can run git checkout --theirs use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java and see whether that file still has errors
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
it looks like this it did Update that little part which we did see
dan1st
dan1st4w ago
Do you have Java 21 installed? Because the new version updated to Java 21
Akif
AkifOP4w ago
yeah exactly I think your right I need 21 bcs this updated
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
i am installing Amazon Coretto 21.0.5 now the one IntelliJ recommends
dan1st
dan1st4w ago
ok should be fine
Akif
AkifOP4w ago
I wounder if it causes problems with javafx but will see
dan1st
dan1st4w ago
JavaFX should support that
Akif
AkifOP4w ago
yeah thats what I think
dan1st
dan1st4w ago
at least newer JavaFX versions
Akif
AkifOP4w ago
alright warnings gone I think
dan1st
dan1st4w ago
Does it look fine?
Akif
AkifOP4w ago
yes just ClassDiagram is still red? is it bcs that one had the conflict? I mean the files color
dan1st
dan1st4w ago
Can you show it? I think it's just still marked as conflicting
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
You can run git add use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java which means "I have resolved the merge conflict"
Akif
AkifOP4w ago
ah I see wasnt just added
dan1st
dan1st4w ago
Can you run git status again?
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
ok so you can do git add .idea to mark that conflict as resolved as well and then run git commit, to finish the merge
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
pressing jut enter it was right?
dan1st
dan1st4w ago
press the ESC key followed by :wq meaning "write quit" and then enter
Akif
AkifOP4w ago
ah ok ty did so
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
great, the merge is finished you see there are 67 commits you have that are not in your fork. These are the commits from the original repository that aren't in your fork
Akif
AkifOP4w ago
ahh I see
dan1st
dan1st4w ago
You can now run git stash apply. This should reapply all changes you stashed
Akif
AkifOP4w ago
2 conflicts if I read correct
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> git stash apply
Removing use-gui/src/main/resources/images/use1.gif
Auto-merging use-gui/src/main/java/org/tzi/use/main/shell/Shell.java
Auto-merging use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java
CONFLICT (content): Merge conflict in use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java
Auto-merging use-gui/src/main/java/org/tzi/use/gui/views/diagrams/DiagramView.java
Auto-merging use-gui/src/main/java/org/tzi/use/gui/main/ModelBrowser.java
Auto-merging use-gui/pom.xml
Auto-merging use-core/src/test/java/org/tzi/use/parser/USECompilerTest.java
Auto-merging use-core/src/main/java/org/tzi/use/config/Options.java
Auto-merging use-assembly/pom.xml
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Auto-merging .gitignore
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> git stash apply
Removing use-gui/src/main/resources/images/use1.gif
Auto-merging use-gui/src/main/java/org/tzi/use/main/shell/Shell.java
Auto-merging use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java
CONFLICT (content): Merge conflict in use-gui/src/main/java/org/tzi/use/gui/views/diagrams/classdiagram/ClassDiagram.java
Auto-merging use-gui/src/main/java/org/tzi/use/gui/views/diagrams/DiagramView.java
Auto-merging use-gui/src/main/java/org/tzi/use/gui/main/ModelBrowser.java
Auto-merging use-gui/pom.xml
Auto-merging use-core/src/test/java/org/tzi/use/parser/USECompilerTest.java
Auto-merging use-core/src/main/java/org/tzi/use/config/Options.java
Auto-merging use-assembly/pom.xml
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Auto-merging .gitignore
the classdiagram one and pom
dan1st
dan1st4w ago
ok now you can handle the merge conflicts but you might want to do it manually open the files and then check for differences and edit it to whatever you prefer
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
well the 21 is the correct one
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
so like this you mean
dan1st
dan1st4w ago
exactly anything else in the pom.xml? regarding merge conflicts
Akif
AkifOP4w ago
nothing else in the pom
dan1st
dan1st4w ago
then you can use git add pom.xml to confirm you have resolved the conflicts in that file
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
I think you want both methods here maybe..?
Akif
AkifOP4w ago
yeah exactly the bottom one is mine is just a flag I use
dan1st
dan1st4w ago
then keep both methods but remove the conflict markers
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
you mean these <<< things right?
dan1st
dan1st4w ago
yes But I think there are more conflicts in that file
Akif
AkifOP4w ago
that was the only one with <<<...
dan1st
dan1st4w ago
it seems there are still a few errors in the file
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
i think bcs I have to add these new things into the modules the ones which came new and I dont have in the modules maybe inside the module-info.javas i mean
dan1st
dan1st4w ago
Can you run mvn compile and see wwhat happens?
Akif
AkifOP4w ago
Akif
AkifOP4w ago
do you know why sometimes when I copy things from the terminal they disappear or the terminal looks different afterwards?
dan1st
dan1st4w ago
that means Maven doesn't know about your Java 21 Installation I don't use IntelliJ and idk what you mean
Akif
AkifOP4w ago
even thought it shows it on the project structure on them all
No description
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
ahhh
dan1st
dan1st4w ago
IntelliJ knows about Java 21 but not Maven
Akif
AkifOP4w ago
I have to maybe change my environmental variables?
dan1st
dan1st4w ago
you can do that or you can run Maven in a different way from IntelliJ Do you have a Maven tab on the right in IntelliJ?
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
yes exactly that popped up when we did all the git pulling
dan1st
dan1st4w ago
Can you use the reload icon? ?
Akif
AkifOP4w ago
I did now ah lol that fixed it xD
dan1st
dan1st4w ago
if you expand use, is there a lifecycle thing? nice
Akif
AkifOP4w ago
like all the red is gone
dan1st
dan1st4w ago
Are all errors gone?
Akif
AkifOP4w ago
yeah only adding class is left I guess ClasDiagram*
dan1st
dan1st4w ago
?
Akif
AkifOP4w ago
I mean just like we added pom.xml
dan1st
dan1st4w ago
? ah yes and testing what works
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
I meant in the Maven tab
Akif
AkifOP4w ago
ah yes there is
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
sorry I never used it
dan1st
dan1st4w ago
if you expand it, does it have a "conpile" thing?
Akif
AkifOP4w ago
so classdiagram and pom is added now ✅ yes
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
Can you double-click it? That should try compiling the project with Maven hopefully using JDK 21
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
couple modules not found
dan1st
dan1st4w ago
double-clicking compile there is similar to mvn compile
Akif
AkifOP4w ago
ah I see like when I do in the terminal mvn compile in the path of use
dan1st
dan1st4w ago
ok seems like there are some issues left there yes
Akif
AkifOP4w ago
I will be back really quick need to go to the kitchen Got Coffee :boohoo:
dan1st
dan1st4w ago
nice under-caffeination subverted
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
does this happen bcs of using module-info.java?
dan1st
dan1st4w ago
yes where is that?
Akif
AkifOP4w ago
I think that was original reason why i changed the names when I was creating these this one in use-gui its so funny how I take one and destroy another haha
dan1st
dan1st4w ago
yeah if you have modules, you cannot use the same package in different modules
Akif
AkifOP4w ago
so I would need to change package names
dan1st
dan1st4w ago
How many classes are in the same package in both modules?
Akif
AkifOP4w ago
wow idk too many haha
Akif
AkifOP4w ago
Akif
AkifOP4w ago
here is the tree its a lot I was thinking of renaming the folders but maybe thats not a good idea?
dan1st
dan1st4w ago
How many files are in that package in use-gui? subpackages are not a problem
Akif
AkifOP4w ago
can I somehow get it also in the terminal like the tree with tree?
dan1st
dan1st4w ago
idk but just check in IntelliJ How many files are in the main package?
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
oh you mean this? like directly in main?
dan1st
dan1st4w ago
no
Akif
AkifOP4w ago
ups sorry you did say files wait I check
dan1st
dan1st4w ago
org.tzi.use.main files in that package not including subpackages
Akif
AkifOP4w ago
so has 333 files and 49 folders the use-gui/src/main
dan1st
dan1st4w ago
I meant only the files in use-gui/src/main/java/org/tzi/use/main without subfolders
Akif
AkifOP4w ago
ah that one that has 9 files what do you mean without subfolders?
dan1st
dan1st4w ago
ok then you should hopefully be able to just move that 9 files to a new subpackage not including files in subfolders if there are any
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
so shell i wouldnt count than its 1 file?
dan1st
dan1st4w ago
e.g. move them to use-gui/src/main/java/org/tzi/use/main/gui or whatever- just make sure the package doesn't exist elsewhere even better then you only need to move that file but move it in IntelliJ
Akif
AkifOP4w ago
I feel like as if you are seeing my screan since i was in the file directory I was legit about to do it there xD and thought if it would cause problems haha So this is how I would fix that "problem" by just moving the files into for example another file like in this case
dan1st
dan1st4w ago
it wouldn't cause many issues, you'd just have to change the package name
Akif
AkifOP4w ago
instead of creating new files so i can also jt rename files right?
dan1st
dan1st4w ago
?
Akif
AkifOP4w ago
like for example this one
No description
Akif
AkifOP4w ago
I could jut rename input to inputShell
dan1st
dan1st4w ago
yes but it would also affect subfolders if applicable
Akif
AkifOP4w ago
ah and thats where problems could happen?
dan1st
dan1st4w ago
merge conflicts if you merge again in the future
Akif
AkifOP4w ago
ah I get it so jut creating a new subfolder if its possible is best
dan1st
dan1st4w ago
if you change a package name, you might have conflicts in all the files in that package a subfolder doesn't solve the issue but it doesn't affect other packages in the same directory it's just minimizing possible impact
Akif
AkifOP4w ago
you know what i do with the errors like this one: [INFO] use 7.1.1 .......................................... SUCCESS [ 0.003 s] [INFO] use-assembly 7.1.1 ................................. SUCCESS [ 0.001 s]
[INFO] use-core 7.1.1 ..................................... SUCCESS [ 14.531 s]
[INFO] use-gui 7.1.1 ...................................... FAILURE [ 3.579 s]
[INFO] use-guiFX 7.1.0 .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.272 s
[INFO] Finished at: 2024-10-31T00:07:56+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project use-gui: Compilation failure
[ERROR] /C:/Users/akifn/Desktop/MyProjects/java/useTesting/use-gui/src/main/java/org/tzi/use/main/shell/Shell.java:[53,1] Package org.tzi.use.utilcore ist nicht vorhanden
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :use-gui
[INFO] use-core 7.1.1 ..................................... SUCCESS [ 14.531 s]
[INFO] use-gui 7.1.1 ...................................... FAILURE [ 3.579 s]
[INFO] use-guiFX 7.1.0 .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.272 s
[INFO] Finished at: 2024-10-31T00:07:56+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project use-gui: Compilation failure
[ERROR] /C:/Users/akifn/Desktop/MyProjects/java/useTesting/use-gui/src/main/java/org/tzi/use/main/shell/Shell.java:[53,1] Package org.tzi.use.utilcore ist nicht vorhanden
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :use-gui
where it says that it doesnt exist?
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
never mind I think its not being used anymore
dan1st
dan1st4w ago
I think you moved it but it didn't change the import
Akif
AkifOP4w ago
and thats why
dan1st
dan1st4w ago
or that
Akif
AkifOP4w ago
Akif
AkifOP4w ago
I think we are getting closer to maven not failing anymore now its just that both read something similar use.guiFX and use.gui for example vtd.xml
dan1st
dan1st4w ago
Do you still have the <appendAssemblyId>false? in any pom.xml
Akif
AkifOP4w ago
i think I deleted all but Il check all gone like I deleted all I mean*
dan1st
dan1st4w ago
Does the package org.tzi.use.gui.main exist in both use-gui and use-guiFX? deleted them now or before?
Akif
AkifOP4w ago
like when you told me I deleted them they are not there anymore in the poms
dan1st
dan1st4w ago
try running mvn clean compile or clean followed by compile
Akif
AkifOP4w ago
yeah I mean since there was no module-info.java at all they all kinda have same foulder structures
dan1st
dan1st4w ago
the same package shouldn't be used in two different modules
Akif
AkifOP4w ago
not my project :x I got to learn haha
dan1st
dan1st4w ago
well in guiFX, you can easily fix it because you can move/rename stuff there without risking merge conflicts or similar
Akif
AkifOP4w ago
I wanted to change as less as possible in the other modules haha but I guess I need to kinda do than so now I would just change in guifx
Akif
AkifOP4w ago
so I can now jut change the main to mainFX for example?
No description
Akif
AkifOP4w ago
refactor it*
dan1st
dan1st4w ago
well it might also be possible to get JavaFX to work without modules but it's annoying yes
Akif
AkifOP4w ago
yeah It worked till I used javafx.webView but yeah I wanted to try use it right way with module-info
dan1st
dan1st4w ago
and you probably needed --add-modules and whatever
Akif
AkifOP4w ago
since thats how its supposed to be in javafx yeah i did use them all in the vm options checked alll in internet stack overflows and such haha somehow nothing worked
dan1st
dan1st4w ago
yes the typical things
Akif
AkifOP4w ago
and I thought module-info would be simple solution Man was I wrong xD
dan1st
dan1st4w ago
it would be simple if the project didn't do stiff that doesn't work well with it
Akif
AkifOP4w ago
Exactly thats the problem I mean tis a whole existing project which is also old tbh but yeah its also interesting
dan1st
dan1st4w ago
well does that work?
Akif
AkifOP4w ago
its running he doesnt find packages and such again
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
guess have to just add these dependencies
dan1st
dan1st4w ago
Does mvn compile show an error?
Akif
AkifOP4w ago
yeah
dan1st
dan1st4w ago
looks about right
Akif
AkifOP4w ago
I think I just have to add these again
dan1st
dan1st4w ago
not accessible?
Akif
AkifOP4w ago
il do that really quick
Akif
AkifOP4w ago
dan1st
dan1st4w ago
tell me when you get a different error:)
Akif
AkifOP4w ago
mvn compile was succesfull 👀 but yeah mvn verify doesnt work 🤔
Akif
AkifOP4w ago
so yeah currently getting this one: [ERROR] /C:/Users/akifn/Desktop/MyProjects/java/useTesting/use-gui/src/test/java/org/tzi/use/util/DiagramUtilTest.java:[20,1] Package ist in einem anderen Modul vorhanden: use.core [ERROR] /C:/Users/akifn/Desktop/MyProjects/java/useTesting/use-gui/src/it/java/org/tzi/use/main/ShellIT.java:[1,1] Package ist in einem anderen Modul vorhanden: use.core you can see in the file ERROR1 in engl it says the following: package is avaiable in another module: use.core in addition to that here the tree where you see where its located(treeGui), if I am correct I think its generated by mvn files? it says it is in use core, but theres no file of any of both(DiagramUtilTest.java, ShellIT.java) inside usecore?
dan1st
dan1st4w ago
ok so compiling the integration test fails try moving that to another package as well maybe Note that it's use-gui/src/it
Akif
AkifOP4w ago
Yeah exactly Ah so use-gui/src/it I have to move? 🤔 I wasnt sure about that Test File, bcs it seemed generated and I guess doesnt make any changes to be editing Generated stuff 😂
dan1st
dan1st4w ago
the ShellIT class in there The ShellIT is alsso in org.tzi.main which cannot be located in multiple modules What makes you think it's generated?
Akif
AkifOP4w ago
Idk these foulders where marked green so that confused me but i guess your right
dan1st
dan1st4w ago
green means test sources i.e. these are used to test to check that the code works but not actually part of the code
Akif
AkifOP4w ago
I see So these arent generated I will change the foulders again than The name*
dan1st
dan1st4w ago
yeah I'd say so or actually there's also another way it might also be possible to disable modules for the test If the surefire plugin is used for that, you could specify <useModulePath>false</useModulePath> for that
Akif
AkifOP4w ago
ah I did already change the names of both like added a subfoulder for both and works now but yeah in general all this Modules causing so many problems so now there was a bat file which is just a script to run the jar, how would I need to change this now?
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-gui-7.1.0.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-gui-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-gui-7.1.0.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-gui-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
like since we have module-info.java in all classes this is causing problems this way of running it I think I can delete the module path and add modules?
Akif
AkifOP4w ago
like I cant even run it inside IntelliJ anymore got fixed by swapping language level under 17+
No description
Akif
AkifOP4w ago
I guess just having had deleted the module-infos would have had been a way of avoiding all these
Akif
AkifOP4w ago
now it cant find use.core again
No description
dan1st
dan1st4w ago
yeah that's kinda necessary either you use the JAR with dependencies but then you have the same problems with JavaFX or you run it without the module-info.jaav Can you run mvn clean followed by mvn verify? Does that succeed? This seems like you still have the <appendAssemblyId>false</appendAssemblyId> in one of the POMs If the error only occurs in IntelliJ and not when running Maven, you can try mvn install
Akif
AkifOP4w ago
its only in this one:
No description
Akif
AkifOP4w ago
but thats commented
dan1st
dan1st4w ago
which would fix the "IntelliJ handles multi-module projects badly" problem
Akif
AkifOP4w ago
and this is in a library both did run
dan1st
dan1st4w ago
try that then and then reload the Maven project in IntelliJ using the reload button here
Akif
AkifOP4w ago
ah that one ok, was about to ask your literally reading mind haha alright I did the mvn install and the reload
dan1st
dan1st4w ago
Does building from IJ work now?
Akif
AkifOP4w ago
java: No enum constant javax.lang.model.element.Modifier.SEALED build fales fails*
dan1st
dan1st4w ago
that means it isn't configured for JDK 21 or language level 21 actually it could be an annotation processor Can you show the error message/full stack trace?
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
it showed me only that Executing pre-compile tasks... Loading Ant configuration... Running Ant tasks... Running 'before' tasks Checking sources Copying resources... [use-gui] Copying resources... [use-core] Parsing java… [use-core] Writing classes… [use-core] java: No enum constant javax.lang.model.element.Modifier.SEALED Checking dependencies… [use-core] Dependency analysis found 87 affected files Errors occurred while compiling module 'use-core' javac 21 was used to compile java sources Finished, saving caches… Compilation failed: errors: 1; warnings: 2 Executing post-compile tasks... Loading Ant configuration... Running Ant tasks... Synchronizing output directories... 31.10.2024 11:35 - Build completed with 1 error and 2 warnings in 8 sec, 528 ms
dan1st
dan1st4w ago
Why are you using ant..? Do you have a build.xml anywhere (not a pom.xml)?
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
seems like in ChangeLog and News but its commented
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
... ok I don't see a build.xml in the GH repo so it might come from IntelliJ
dan1st
dan1st4w ago
Stack Overflow
What to do with "java: No enum constant javax.lang.model.element.Mo...
For a University project we need to implement a server 'registrar' that communicates with a client 'barowner' through a SSL RMI connection. When building the client, I get the error java: No enum
dan1st
dan1st4w ago
make sure you are using the correct SDK version everywhere i.e. 21 and not 14
Akif
AkifOP4w ago
what about language level?
dan1st
dan1st4w ago
the Java version of the language features you want to use it should be 21
Akif
AkifOP4w ago
it should be 21 everywhere I checked
dan1st
dan1st4w ago
What are you doing so you are getting that output? What is shown when right-clicking use-core? Can you run mvn help:effective-pom? See the "m" button in that image? You can use that to run arbitrary Maven commands from IntelliJ I think
Akif
AkifOP4w ago
this is when I did run in intellij on the Local Machine
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
seems like that click on "Open Module settings" it's pretty much down at the bottom of the list
Akif
AkifOP4w ago
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
looks right the output seems correct
Akif
AkifOP4w ago
that starts the Project Structure
No description
dan1st
dan1st4w ago
it sais language level 17
No description
Akif
AkifOP4w ago
there it jut goes back to language level 17 somehow
dan1st
dan1st4w ago
Can you check all modules? Is there any module using a language level lower than 17?
Akif
AkifOP4w ago
bcs there is no 21: and when doing project default it goes back to 17
No description
dan1st
dan1st4w ago
Do you have an old IntelliJ version that doesn't support Java 21?
Akif
AkifOP4w ago
i need to check that
dan1st
dan1st4w ago
actually it would be possible it selected the wrong JDK Is there a Help > About menu or similar in IntelliJ? that tells you the IntelliJ version
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
yeah seems old should I update?
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
Java 21 was released in 2021 so your version should work
Akif
AkifOP4w ago
hmm I see
dan1st
dan1st4w ago
you could update to a newer version if you want to but you don't have to Is there a way to change SDKs or project JDKs? or module JDKs
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
this for example for sdks
dan1st
dan1st4w ago
Also check Settings > Build, Execution Deployment > Java Compiler
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
modules dependencies
dan1st
dan1st4w ago
Is it 21 for all modules here?
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
here I can type 21
Akif
AkifOP4w ago
maybe that works ok il update than
dan1st
dan1st4w ago
Make sure to actually update to the newest IntelliJ version
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
ah i see its already at 2024.2
dan1st
dan1st4w ago
You mean you updated to it?
Akif
AkifOP4w ago
nono updating to it right now
dan1st
dan1st4w ago
ah ok
Akif
AkifOP4w ago
oh no
No description
Akif
AkifOP4w ago
I guess updating from 2022 to 2024 version is too heavy I might need to download it
dan1st
dan1st4w ago
seems like it tried to download a nonexisting version If the project doesn't need Java 17+ features, you could also try downgrading to 16 (for the language level, you don't need a JDK for it) But that wouldn't work if the project needs something from 17+
Akif
AkifOP4w ago
I did download the new version and omg does all look different
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
I think you can still enable the old UI if you want to Does it build properly now?
Akif
AkifOP4w ago
so it does build and start the application, buttt..... many of the features seem to somehow not work anymore
Akif
AkifOP4w ago
like these work
No description
dan1st
dan1st4w ago
and what doesn't work?
Akif
AkifOP4w ago
but when I try to for example press on that
No description
Akif
AkifOP4w ago
Akif
AkifOP4w ago
idk where these problems coming from since before they worked
dan1st
dan1st4w ago
You can add exports org.tzi.use.gui.views; to the use.gui module If you use modules, Java ensures that classes from one module cannot access classes from another module unless permitted Or you can use the open keyword to say "Anyone can access what's inside of this module"
Akif
AkifOP4w ago
ah I get it so I need to export them?
dan1st
dan1st4w ago
you can also use exports org.tzi.use.gui.views to com.google.common; to only export it to the com.google.common module
Akif
AkifOP4w ago
how do I do the open? I havent used open yet
dan1st
dan1st4w ago
yes
open module use.gui {
...
}
open module use.gui {
...
}
that means "any other module can access stuff in my module, including deep reflective access
Akif
AkifOP4w ago
so than I dont need to export anything anymore? only require?
Akif
AkifOP4w ago
so I did the opens, why do i still get this than:
dan1st
dan1st4w ago
yes Seems like org.w3c.dom.ls.DocumentLS doesn't exist
dan1st
dan1st4w ago
Stack Overflow
NoClassDefFoundError: org/w3c/dom/ls/DocumentLS - issue occurring o...
Background I have a project where I parse some XML documents and I happened to need the xerces dependency: <dependency> <groupId>xerces</groupId> <artifactId>xerc...
Akif
AkifOP4w ago
so waht would this mean for me?
No description
Akif
AkifOP4w ago
bcs I have only xerces xercesImpl
dan1st
dan1st4w ago
Maybe remove the xml-apis exclusion? idk whether that causes the issue but it sounds likely
Akif
AkifOP4w ago
hmm its still there <dependency> <groupId>xerces</groupId> <artifactId>xerces</artifactId> <version>2.4.0</version> </dependency> this works idk why but yeah i kinda recreated what they used on so <dependency> <groupId>xerces</groupId> <artifactId>xerces</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> but the <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> isnt needed in this case
dan1st
dan1st4w ago
Did you reload the Maven project after making the change?
Akif
AkifOP4w ago
soooo yeah I forgot that it seems xD but this one works: <dependency> <groupId>xerces</groupId> <artifactId>xerces</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> <version>2.11.0</version> </dependency> so the one on SO was right so now that the swing version is working in intelliJ, it still does not work, when being called from the JAR
Akif
AkifOP4w ago
mvn verify did run succesfull thought:
No description
Akif
AkifOP4w ago
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> use-gui\src\main\resources\bin\use.bat
Fehler: Beim Laden der Klasse org.tzi.use.main.gui.Main ist ein LinkageError aufgetreten
java.lang.UnsupportedClassVersionError: org/tzi/use/main/gui/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> use-gui\src\main\resources\bin\use.bat
Fehler: Beim Laden der Klasse org.tzi.use.main.gui.Main ist ein LinkageError aufgetreten
java.lang.UnsupportedClassVersionError: org/tzi/use/main/gui/Main has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
dan1st
dan1st4w ago
that's because the version you used for combiling doesn't match the version you are running it with
JavaBot
JavaBot4w ago
When compiling Java applications to .class files, javac adds an integer representing the version it has been compiled for to the class file. Each Java version has a class file (major) version associated with it. A list with Java versions and the matching class file major version numbers can be found in this Stack Overflow question. In order to use a class, the JVM must be of a newer or equal version to the one specified in the class file.
dan1st
dan1st4w ago
You compiled it with JDK 17 but run it with JDK 21 you could change the PATH to use Java 21
Akif
AkifOP4w ago
you mean the envireomantal variable path right?
dan1st
dan1st4w ago
yes I think you installed JDK 21 somewhere in your user home in a .jdks directory or something like that
Akif
AkifOP4w ago
ah lol I have had changed it but it went back to 17 maybe bcs of new installation of intellij it disappeared
dan1st
dan1st4w ago
How did you change it?
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
that's the JAVA_HOME which is used by Maven
Akif
AkifOP4w ago
in the path it seems not to be there anymore:
No description
dan1st
dan1st4w ago
the PATH is used when running java -jar
Akif
AkifOP4w ago
I see I didnt know that
dan1st
dan1st4w ago
Maybe you just didn't set the PATH
Akif
AkifOP4w ago
its in the ath kind of
No description
Akif
AkifOP4w ago
maybe the path is not correct anymore ? idk i guess intellij didnt get it
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
just restartet intelij now it shows the right version
dan1st
dan1st4w ago
I think using things like %JAVA_HOME% doesn't work in there you might need the full path there but idk you need to restart IntelliJ for it to apply
Akif
AkifOP4w ago
so yeah it seems to work again but now my part isnt working bcs of module-info again i think since this is the original application the swing/awt one and now my javafx version which is in the use-guiFX oh WOW this is actually my first error I can show you know which did lead me to try using module-info.java
dan1st
dan1st4w ago
ok yeah I expected that at some point
Akif
AkifOP4w ago
dan1st
dan1st4w ago
So if you use modules, you cannot use the jar-with-dependencies If you run mvn dependency:copy-dependencies, it should copy all dependencies somewhere in the target directory
Akif
AkifOP4w ago
this has been my first problem which I couldnt solve for days
JavaBot
JavaBot4w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
dan1st
dan1st4w ago
Alternatively I think you can solve that by adding --add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED to the JVM arguments Can you check that?
Akif
AkifOP4w ago
it did do it succesfully
dan1st
dan1st4w ago
Did it put all dependencies of use-guiFX inside use-guiFX/target?
Akif
AkifOP4w ago
yes
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
Can you show the bat file?
Akif
AkifOP4w ago
@echo off if "%OS%"=="Windows_NT" @setlocal rem CONFIGURATION rem Add -Xss20m to VMARGS when using the generator set VMARGS= REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar" IF NOT EXIST %USE_JAR% ( echo Cannot find USE executable. Please provide correct path to use.jar. goto end ) :runApp java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %* REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %* if "%OS%"=="Windows_NT" @endlocal :mainEnd rem echo exit code: %ERRORLEVEL% :end
JavaBot
JavaBot4w ago
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
Akif
AkifOP4w ago
brb have to do something parents calling, just so you know
dan1st
dan1st4w ago
Can you try running java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar wait What's your main class?
Akif
AkifOP4w ago
in use-guiFX its C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\src\main\java\org\tzi\use\mainFX\MainFX.java
dan1st
dan1st4w ago
then try running java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar org.tzi.use.mainFX.MainFX
Akif
AkifOP4w ago
Akif
AkifOP4w ago
Akif
AkifOP4w ago
does the same or do you mean me adding it to the VM options?
dan1st
dan1st4w ago
Can you try using cmd instead of powershell? or maybe java --module-path "C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar" org.tzi.use.mainFX.MainFX with the double quotes
Akif
AkifOP4w ago
C:\Users\akifn\Desktop\MyProjects\java\useTesting>java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar org.tzi.use.mainFX.MainFX
Error occurred during initialization of boot layer
java.nio.file.InvalidPathException: Illegal char <*> at index 78: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar
C:\Users\akifn\Desktop\MyProjects\java\useTesting>java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar org.tzi.use.mainFX.MainFX
Error occurred during initialization of boot layer
java.nio.file.InvalidPathException: Illegal char <*> at index 78: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
sorry didnt realize it using powershell, I need to maybe go back to the old intellij design
dan1st
dan1st4w ago
I think it should work with either one in some way but idk how to deal with Windows terminal things I think in PowerShell you can do something like java --module-path "C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar`;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\*.jar" org.tzi.use.mainFX.MainFX with a backtick before the ; Running the command dir C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\ lists your dependencies (JAR files), right? You can also try
java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\ org.tzi.use.mainFX.MainFX
java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\ org.tzi.use.mainFX.MainFX
on cmd or
java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar`;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\ org.tzi.use.mainFX.MainFX
java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar`;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\ org.tzi.use.mainFX.MainFX
in PowerShell
Akif
AkifOP4w ago
Yes it does
dan1st
dan1st4w ago
try that
Akif
AkifOP4w ago
C:\Users\akifn\Desktop\MyProjects\java\useTesting>java --module-path C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar;C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency\ org.tzi.use.mainFX.MainFX Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules jdk.xml.dom and xml.apis export package org.w3c.dom.html to module javafx.graphicsEmpty
dan1st
dan1st4w ago
ok it seems like this exclusion might have been necessary and make sure to run mvn clean package dependency:copy-dependencies after changing the pom.xml to ensure everything is copied again
Akif
AkifOP4w ago
i dont get it, bcs that one was in use-gui and not use-guiFX ah ok il do that
dan1st
dan1st4w ago
JavaFX seems to try to access that package but there are two modules with that package
Akif
AkifOP4w ago
now says this: Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules xercesImpl and jdk.xml.dom export package org.w3c.dom.html to module antlr.runtime apis is gone no wait its still saying xercesImpl the message is a bit different but yeah still contains same package
dan1st
dan1st4w ago
You might also need the exclusion in xercesImpl
Akif
AkifOP4w ago
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
i did it like that you mean include the exclusion also on the top one?
Akif
AkifOP4w ago
bcs I mean it is already in xercesimpl? what kind of solution is that xD
dan1st
dan1st4w ago
idk what that does
Akif
AkifOP4w ago
to delete org.w3c.dom.html.HTMLDOMImplementation
dan1st
dan1st4w ago
because it shouldn't be in xerces from the start on I think but you can also try the alternative solution of ignoring modules Did you manage to run the guiFX thing from IntelliJ?
Akif
AkifOP4w ago
no that didnt work maybe we should look into that first?
dan1st
dan1st4w ago
oh then you should try making sure that works first yes I thought that works
Akif
AkifOP4w ago
my fault I forgot to say that here
dan1st
dan1st4w ago
alternatively it might also be possible to make a JAR with dependencies and try to figure out all the other stuff as a backup solution
Akif
AkifOP4w ago
should this be in the VM Options or not: --module-path "C:\Users\akifn.jdks\corretto-21.0.5\lib" --add-exports javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
Akif
AkifOP4w ago
when running it like this:
No description
dan1st
dan1st4w ago
I think not Try using the reload button in the Maven tab and try again
Akif
AkifOP4w ago
I think from what I did understand when using module-info theres no vm options needed
dan1st
dan1st4w ago
and remove these VM arguments
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
Why do you have a package named bin? What's in there?
Akif
AkifOP4w ago
in both it in the ressources in with the .bat files are
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
I guess I need to rename the foulder again in FX instead of renaming the files in it? thi is like from earlier, where I thought that changing file names would fix it
dan1st
dan1st4w ago
Why are these in the resource directories? Did you put them there? It's enough to move them outside of the resources directory in the guiFX module I think
Akif
AkifOP4w ago
that was the structure how it was in use-gui
dan1st
dan1st4w ago
yeah but you shouldn't have the same packages in multiple modules
Akif
AkifOP4w ago
I just wanted to have my solutions all seperated from the SwingAWT solution
dan1st
dan1st4w ago
you can still have that but that doesn't mean you have to copy stuff 1:1
Akif
AkifOP4w ago
but yeah the way I work has changed since than, I am using swing/AWT parts inside my javafx so thats something causing these problems, bcs modules cant have same strucutre
dan1st
dan1st4w ago
Is there a reason the guiFX thing depends on the swing GUI?
Akif
AkifOP4w ago
exactly haha but as i say first it was thought of both having nothing to do with each other yeah as I said, inside the javafx parts I still use the swing parts with SwingNode
dan1st
dan1st4w ago
ah ok
Akif
AkifOP4w ago
thats only the first step so that all functionality is given
dan1st
dan1st4w ago
yeah just make sure that you don't use the same directories in src/main/java and src/main/resources
Akif
AkifOP4w ago
and than step by step the parts should be migrated so can I just change the name of bin to binFX or what would be best to do? soo I changed the names
Akif
AkifOP4w ago
now i get following Errors:
Akif
AkifOP4w ago
this also worked earlier
dan1st
dan1st4w ago
for example or completely move it out of the resources directory Does that file exist? Can you show the code loading it? I think it might be part of the Main.fxml
Akif
AkifOP4w ago
yeah exactly:
private void createPrimaryStage(Stage primaryStage) throws IOException {

try {

// Load the main window FXML file
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Main.fxml"));
Parent root = loader.load();
// Set up the scene
Scene scene = new Scene(root, 900.0, 620.0);

//scene.getStylesheets().add(getClass().getResource("/styles/style.css").toExternalForm());

// Set the stage properties
primaryStage.setTitle("USE");
primaryStage.getIcons().add(new Image("images/use1.gif"));
primaryStage.setScene(scene);

// Center the stage on the screen
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
double centerX = primaryScreenBounds.getMinX() + (primaryScreenBounds.getWidth() - scene.getWidth()) / 2;
double centerY = primaryScreenBounds.getMinY() + (primaryScreenBounds.getHeight() - scene.getHeight()) / 2;
primaryStage.setX(centerX);
primaryStage.setY(centerY);

// Show the stage
primaryStage.show();

} catch (IOException e) {

Log.error("Failed to load FXML: " + e.getMessage());
e.printStackTrace();

}

}
private void createPrimaryStage(Stage primaryStage) throws IOException {

try {

// Load the main window FXML file
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/Main.fxml"));
Parent root = loader.load();
// Set up the scene
Scene scene = new Scene(root, 900.0, 620.0);

//scene.getStylesheets().add(getClass().getResource("/styles/style.css").toExternalForm());

// Set the stage properties
primaryStage.setTitle("USE");
primaryStage.getIcons().add(new Image("images/use1.gif"));
primaryStage.setScene(scene);

// Center the stage on the screen
Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds();
double centerX = primaryScreenBounds.getMinX() + (primaryScreenBounds.getWidth() - scene.getWidth()) / 2;
double centerY = primaryScreenBounds.getMinY() + (primaryScreenBounds.getHeight() - scene.getHeight()) / 2;
primaryStage.setX(centerX);
primaryStage.setY(centerY);

// Show the stage
primaryStage.show();

} catch (IOException e) {

Log.error("Failed to load FXML: " + e.getMessage());
e.printStackTrace();

}

}
I am using fxml
Akif
AkifOP4w ago
dan1st
dan1st4w ago
If you remove the stylesheets="@/styles/style.css" from the FXML and uncomment the scene.getStylesheets().add(getClass().getResource("/styles/style.css").toExternalForm());, are you getting the same error? Did you use open module in the guiFX module-info.java?
Akif
AkifOP4w ago
that part is commented not used ah no
dan1st
dan1st4w ago
you can try that yeah I meant making it a non-comment i.e. removing the //
Akif
AkifOP4w ago
oh ok
dan1st
dan1st4w ago
either that or using open module could also work open module is kinda the opposite of the goal of modules (modules are supposed to make sure that stuff is only accessible by what is supposed to access it and open means "everything can access my stuff"
Akif
AkifOP4w ago
till the same
Akif
AkifOP4w ago
dan1st
dan1st4w ago
That was with open module but without the change to the FXML file, right?
Akif
AkifOP4w ago
both
dan1st
dan1st4w ago
oh it's a different exception What's line 790 in MainWindowFX? Is it primaryStage.getIcons().add(new Image("images/use1.gif"));?
Akif
AkifOP4w ago
Image image = new Image(Objects.requireNonNull(MainWindowFX.class.getResourceAsStream(Options.getIconPath(name)))); oh thats prob bcs i changed the foulder name
dan1st
dan1st4w ago
ok yeah it doesn't find that icon the Objects.requireNonNull() fails because it is null
Akif
AkifOP4w ago
Akif
AkifOP4w ago
i did put this in there now: Image image = new Image(Objects.requireNonNull(MainWindowFX.class.getResourceAsStream("/imagesFX/" + name)));
john
john4w ago
before it was using this methode
public static String getIconPath(String iconName) {
return "/images/" + iconName;
}
public static String getIconPath(String iconName) {
return "/images/" + iconName;
}
This message has been formatted automatically. You can disable this using /preferences.
dan1st
dan1st4w ago
What's line 176? same issue ther?
Akif
AkifOP4w ago
yes not its running
dan1st
dan1st4w ago
You mean now?
Akif
AkifOP4w ago
like from inside IntelliJ
dan1st
dan1st4w ago
ok
Akif
AkifOP4w ago
but yeah things still not working in it which did work earlier I checked
dan1st
dan1st4w ago
?
Akif
AkifOP4w ago
but I have to first change the paths
dan1st
dan1st4w ago
Btw if you want to run it from the command-line there is one easy way I didn't tell you before which should work but it requires Maven for running the application
Akif
AkifOP4w ago
like from images to imagesFX and such
dan1st
dan1st4w ago
yeah I guess you can also use a constant for that btw
Akif
AkifOP4w ago
Trueee so true haha
dan1st
dan1st4w ago
either a constant or one method that is used everywhere or a method used everywhere that uses a constant whatever you like
Akif
AkifOP4w ago
thank you! I will note that down and think about how to do that later
JavaBot
JavaBot4w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Akif
AkifOP4w ago
so now it working in IntelliJ il check mvn verify now verify went well as expected but yeah I cant run the jar with dependencies: PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> use-guiFX\src\main\resources\bin\useFX.bat
use-guiFX\src\main\resources\bin\useFX.bat : Das Modul "use-guiFX" konnte nicht geladen werden. Wenn Sie weitere Informationen wünschen, führen Sie "Import-Module use-guiFX" aus. In Zeile:1 Zeichen:1 + use-guiFX\src\main\resources\bin\useFX.bat + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (use-guiFX\src\m...s\bin\useFX.bat:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoLoadModule dont I have to take out the module-path and such in my :runApp? inside the start_useFX.bat?
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
dan1st
dan1st4w ago
You can also try running mvn -f use-guiFX\pom.xml exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX if yu want to run it from the console That's the easy way to run it with Maven Which means "use the pom.xml from the use-guiFX module and run the org.tzi.use.mainFX.MainFX class" It might be necessary to do mvn install first
Akif
AkifOP4w ago
Akif
AkifOP4w ago
ah ok
dan1st
dan1st4w ago
If you don't want to run it with Maven each time, you can try the following in your script:
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

REM set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%" org.tzi.use.mainFX.MainFX -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

REM set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%" org.tzi.use.mainFX.MainFX -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
This is the command from earlier
Akif
AkifOP4w ago
that didnt work its showing same message errors
dan1st
dan1st4w ago
The one about a package being accessible from multiple modules, right? related to xerces What is xerces used for?
Akif
AkifOP4w ago
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> use-guiFX\src\main\resources\bin\useFX.bat
use-guiFX\src\main\resources\bin\useFX.bat : Das Modul "use-guiFX" konnte nicht geladen werden. Wenn Sie weitere Informationen wünschen, führen Sie "Import-Module use-guiFX" aus. In Zeile:1 Zeichen:1 + use-guiFX\src\main\resources\bin\useFX.bat + ~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (use-guiFX\src\m...s\bin\useFX.bat:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoLoadModule
dan1st
dan1st4w ago
oh that's something else I think Powershell didn't like you running a bat file
Akif
AkifOP4w ago
ahh
dan1st
dan1st4w ago
I think you can run cmd /c use-guiFX\src\main\resources\bin\useFX.bat in PowerShell and it should run the bat file
Akif
AkifOP4w ago
I forget Its powershell default thats so stupid
dan1st
dan1st4w ago
I think you can change that in IntelliJ
Akif
AkifOP4w ago
the old version didnt have that yeah and I am thinking like whats these messages xD
dan1st
dan1st4w ago
and I think it's also possible to create a run configuration that runs a bat file I'm glad I'm using Linux and having a terminal I understand xd
Akif
AkifOP4w ago
No description
Akif
AkifOP4w ago
it cannot find the path it says
dan1st
dan1st4w ago
you changed the folder it's no longer bin I think That may also be the reason for the error you just got with powerShell
Akif
AkifOP4w ago
#!/bin/sh
#
# Start script for USE

# CONFIGURATION
# Add -Xss20m to VMARGS when using the generator
VMARGS=""

unset CDPATH
BIN_DIR="$( cd "$( dirname "$0" )" && pwd )"
USE_HOME="$BIN_DIR/.."
USE_JAR="$USE_HOME/lib/use-guiFX.jar"

if [ ! -f "$USE_JAR" ]; then
echo "Cannot find USE executable. Please provide correct path to use.jar." >&2
exit 1
fi

export LD_LIBRARY_PATH="$USE_HOME/lib:$LD_LIBRARY_PATH"

# set cmd for running USE
java $VMARGS -jar "$USE_JAR" "$@"
#!/bin/sh
#
# Start script for USE

# CONFIGURATION
# Add -Xss20m to VMARGS when using the generator
VMARGS=""

unset CDPATH
BIN_DIR="$( cd "$( dirname "$0" )" && pwd )"
USE_HOME="$BIN_DIR/.."
USE_JAR="$USE_HOME/lib/use-guiFX.jar"

if [ ! -f "$USE_JAR" ]; then
echo "Cannot find USE executable. Please provide correct path to use.jar." >&2
exit 1
fi

export LD_LIBRARY_PATH="$USE_HOME/lib:$LD_LIBRARY_PATH"

# set cmd for running USE
java $VMARGS -jar "$USE_JAR" "$@"
true ah thats stupid changes foulder names is pain haha ah I am so stupid now i got it use-guiFX\src\main\resources\binFX\useFX.bat this one needs binFX
dan1st
dan1st4w ago
Oh and if you make a change to the program, you might need to run mvn clean package dependency:copy-dependencies before running the script to ensure everything is there
Akif
AkifOP4w ago
xD
dan1st
dan1st4w ago
You can also make it such that mvn package or mvn verify or whatever is sufficient by modifying the pom.xml
Akif
AkifOP4w ago
i was mostly just using mvn verify so i would in addition also need the mvn clean....
dan1st
dan1st4w ago
You can configure it that mvn verify also copies the dependencies
Akif
AkifOP4w ago
ah I see
dan1st
dan1st4w ago
mvn clean just deletes the target folders so if you remove a dependency, that would still be in target/dependency and the clean gets rid of that anyways that command should also work if Maven etc is installed so you could also use that in your bat - if you are ok with relying on Maven to run it
Akif
AkifOP4w ago
how would I do it if I dont want to rely on maven? or should i be relying on maven and editing the pom? 🤔
dan1st
dan1st4w ago
First use Maven to build all the JARs (e.g. dependency:copy-dependencies and package which could be done in one step) Editing the POM would only be necessary once and then run Java with these JARs
Akif
AkifOP4w ago
so this is my current start_useFX.bat
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
dan1st
dan1st4w ago
There are also other ways that include making an installer or similar which is a bit harder to set up but makes running it easier
Akif
AkifOP4w ago
I would build these in there?
dan1st
dan1st4w ago
You only need these commands to ensure all JARs are where they should be
Akif
AkifOP4w ago
I got overwhelmed a bit I am sorry
dan1st
dan1st4w ago
And it is possible to configure Maven to automatically do dependency:copy-dependencies on package Yeah I understand that What exactly are your requirements for the script?
Akif
AkifOP4w ago
like currently its working with doing mvn verify on changes and then running it with use-guiFX\src\main\resources\binFX\useFX.bat
dan1st
dan1st4w ago
Is that working?
Akif
AkifOP4w ago
I just want it to run haha
dan1st
dan1st4w ago
You managed to run it with mvn -f use-guiFX\pom.xml exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX so you could also just put that in the start_useFX.bat
Akif
AkifOP4w ago
i am a bit confused bcs I think this part in the .bat is wrong and I need to edit :runApp java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*
dan1st
dan1st4w ago
.
Akif
AkifOP4w ago
so this one would run it with mvn then right? but is it than also like doing the verify?
dan1st
dan1st4w ago
or actually I think mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX would be better yes I think that isn't even necessary with mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX The idea of the script is that you can use Maven to build JAR files and then run the JAR files from the script
Akif
AkifOP4w ago
ok wait I am so confused haha bcs that one is working now so I can put this now inside the bat?
dan1st
dan1st4w ago
yes But then you will need Maven if you want to use the bat That's your choice
Akif
AkifOP4w ago
that means? I mean I have already maven dont i?
dan1st
dan1st4w ago
If someone wants to run the bat, they need to install Maven
Akif
AkifOP4w ago
:runApp java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %* mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX so thee two runApps
dan1st
dan1st4w ago
You don't need the java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %* for Maven
Akif
AkifOP4w ago
for one they would need mvn for the other one not?
dan1st
dan1st4w ago
Maven does that for you also java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %* would be wrong
Akif
AkifOP4w ago
I see but what about the dependencys now? does it do that a well?
dan1st
dan1st4w ago
The dependencies are needed if you want to run it without Maven which I think doesn't even work yet
Akif
AkifOP4w ago
exactly
dan1st
dan1st4w ago
If you want to only run it with Maven (or from IntelliJ), you don't need the dependency:copy-dependencies
Akif
AkifOP4w ago
thats the problem like someone should be able to call via cmd or such this one use-guiFX\src\main\resources\binFX\useFX.bat and the application should start thats the idea and I think when using mvn here this doesnt work or does it?
dan1st
dan1st4w ago
Well someone would need to compile it and give them the files first It is possible to make it work (and pretty easily) but it would require the person using the batch script to install Maven first The other way is the one with JARs where idk how well that would work / how we can get it to work
Akif
AkifOP4w ago
hmm I see
dan1st
dan1st4w ago
idk what exactly you want/need
Akif
AkifOP4w ago
my project is actually "just" the migration from swing to javafx* Kind of
dan1st
dan1st4w ago
I think the intent of the bat script is to run it without Maven
Akif
AkifOP4w ago
I have had recreated the swing awt gui as javafx, and after building in 2 functionalities as javafx, I decided to do just use for now the swing functionalities inside the javafx components. So that I would first have all the functionalities, before I continue the migrating yeah like its a application that exists and I am trying to modernize it next I wanted to check out browser engineering, to see if I could build some parts that way so that it could be at the next step be created sometime later as a web version
dan1st
dan1st4w ago
If you think it's fine for now, you could also commit and push it and then work on it more (e.g. fix the bat) later
Akif
AkifOP4w ago
that sounds like a good idea btw if I delete the dependency foulder in the target it should still work right? bcs its not being used as you did say
dan1st
dan1st4w ago
What exactly should still work?
Akif
AkifOP4w ago
running the start_use.bat running from cmd
dan1st
dan1st4w ago
You can also just replace the script with
@echo off
mvn compile
mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX
@echo off
mvn compile
mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX
or similar Did that one ever work?
Akif
AkifOP4w ago
yes
dan1st
dan1st4w ago
Are you talking about the Swing or JavaFX one?
Akif
AkifOP4w ago
swing and javafx one
dan1st
dan1st4w ago
The Swing one should still work But I thought the JavaFX one doesn't even work with the dependency folder?
Akif
AkifOP4w ago
yeah it works so javafx and swing version both did work, but until I started using WebView
dan1st
dan1st4w ago
ah right
Akif
AkifOP4w ago
and than when I started using module-info.java yeah didnt work anymore haha but yeah now with the mvn call you created it does work again
dan1st
dan1st4w ago
We could still try to get it withing with Webview and the jar with dependencies
Akif
AkifOP4w ago
you mean we could try it without the module-infos? or you mean now without mvn? Sorry if I am sometimes understanding late
dan1st
dan1st4w ago
First make the JAR with mvn and then run the JAR without Maven We could try it but idk whether it works You could also just try changing --add-modules javafx.controls,javafx.fxml to --add-modules javafx.controls,javafx.fxml,javafx.web But the --add-modules shouldn't be necessary at all once it works well
Akif
AkifOP4w ago
ah here yes so when using this now :runApp java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar %USE_JAR% -nr %*
Akif
AkifOP4w ago
Akif
AkifOP4w ago
I get this one the one i was talking about from since the beginning and why I started using module-info
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0x3daab1db) cannot access class com.sun.javafx.scene.NodeHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene to unnamed module @0x3daab1db
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0x3daab1db) cannot access class com.sun.javafx.scene.NodeHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene to unnamed module @0x3daab1db
it says stuff like unnamed module
dan1st
dan1st4w ago
I think you can fix that error by --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED but idk how many errors you'd get yes because as soon as you have a JAR with dependencies, modules don't work anymore
Akif
AkifOP4w ago
thats the thing I have had tryed all these but couldnt fix it
dan1st
dan1st4w ago
Where did you add it?
Akif
AkifOP4w ago
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0xddefd7b) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0xddefd7b with that one i get this now inside the bat :runApp java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED -jar %USE_JAR% -nr %* but earlier this and last week always in the VM Options
dan1st
dan1st4w ago
--add-exports javafx.graphics/com.sun.javafx.embed.swing=ALL-UNNAMED yeah that's fine as long as it's before the -jar The thing is idk how many --add-exports that needs
Akif
AkifOP4w ago
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0x161e0b82) cannot access class com.sun.javafx.scene.NodeHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene to unnamed module @0x161e0b82
dan1st
dan1st4w ago
I think there may be another approach but that would either make the program only work on one OS or it would make the JAR significantly bigger
Akif
AkifOP4w ago
oh did you mean keeping the other add exports and adding this one
dan1st
dan1st4w ago
but then it wouldn't require any --module-path or --add-modules yes
Akif
AkifOP4w ago
hmm I see so mvn is the better solution after all?
dan1st
dan1st4w ago
It's the easier solution for you But it isn't easier for users And I think the project wouldn't like that solution
Akif
AkifOP4w ago
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0x6a6681f1) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x6a6681f1 this comes when having both java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED,javafx.graphics/com.sun.javafx.embed.swing=ALL-UNNAMED -jar %USE_JAR% -nr %* idk if I can do , between them I guess so would make sense
dan1st
dan1st4w ago
Another --add-exports javafx.graphics/com.sun.javafx.util=ALL-UNNAMED You can find it from the error message the issue is I have no idea how many you need It could be a lot
Akif
AkifOP4w ago
C:\Users\akifn\Desktop\MyProjects\java\useTesting>use-guiFX\src\main\resources\binFX\useFX.bat
WARNING: Unknown module: javafx.graphics/com.sun.javafx.embed.swing=ALL-UNNAMED specified to --add-exports
WARNING: Unknown module: javafx.graphics/com.sun.javafx.util=ALL-UNNAMED specified to --add-exports
USE version 7.1.1, Copyright (C) 1999-2024 University of Bremen & University of Applied Sciences Hamburg
Invalid extension directory 'C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX/oclextensions'
Error: Could not read plugin directory `C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\lib\plugins'.
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0x45d72b0d) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x45d72b0d
C:\Users\akifn\Desktop\MyProjects\java\useTesting>use-guiFX\src\main\resources\binFX\useFX.bat
WARNING: Unknown module: javafx.graphics/com.sun.javafx.embed.swing=ALL-UNNAMED specified to --add-exports
WARNING: Unknown module: javafx.graphics/com.sun.javafx.util=ALL-UNNAMED specified to --add-exports
USE version 7.1.1, Copyright (C) 1999-2024 University of Bremen & University of Applied Sciences Hamburg
Invalid extension directory 'C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX/oclextensions'
Error: Could not read plugin directory `C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\lib\plugins'.
use> Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: class com.sun.javafx.embed.swing.SwingNodeHelper (in unnamed module @0x45d72b0d) cannot access class com.sun.javafx.util.Utils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.util to unnamed module @0x45d72b0d
ah so you get it from the message but this seems odd WARNING: Unknown module: javafx.graphics/com.sun.javafx.embed.swing=ALL-UNNAMED specified to --add-exports WARNING: Unknown module: javafx.graphics/com.sun.javafx.util=ALL-UNNAMED specified to --add-exports
dan1st
dan1st4w ago
It might be possible to do it in a way that doesn't require any --add-exports and no JavaFX SDK by telling Maven to include the stuff for Windows, MacOS and Linux in the JAR What exactly did you put in the JAR?
Akif
AkifOP4w ago
good question this one right: use-gui-jar-with-dependencies
Akif
AkifOP4w ago
No description
dan1st
dan1st4w ago
yes Essentially you could add <classifier>win</classifier> to all JaavFX dependencies and then it would work for Windows and then you could just run it with java -jar and don't need to do anything with modules - maybe
Akif
AkifOP4w ago
win for the winners haha il try that out
dan1st
dan1st4w ago
The important thing when doing that is the following: Don't run it with --module-path, --add-modules or --add-exports
Akif
AkifOP4w ago
so this one :runApp java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web --add-exports javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED,javafx.graphics/com.sun.javafx.embed.swing=ALL-UNNAMED,javafx.graphics/com.sun.javafx.util=ALL-UNNAMED -jar %USE_JAR% -nr %* would look like this? :runApp java %VMARGS% -jar %USE_JAR% -nr %* you mean like this:
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>17.0.13</version>
<classifier>win</classifier>
<scope>compile</scope>
</dependency>
dan1st
dan1st4w ago
yes and run mvn package or mvn verify before running the JAR
Akif
AkifOP4w ago
btw can I deleat this now:
No description
dan1st
dan1st4w ago
ok
Akif
AkifOP4w ago
since I think you did say we dont need it anymore
dan1st
dan1st4w ago
mvn clean automatically deletes it btw
nikcho-kouhai
nikcho-kouhai4w ago
did you fix it?
Akif
AkifOP4w ago
ah okey kind of, we are trying something out
nikcho-kouhai
nikcho-kouhai4w ago
did you check if your javafx versions match the version on your project?
dan1st
dan1st4w ago
not really the problem
Akif
AkifOP4w ago
I think dan1t would have realized that problem after 5 messages haha I wish it would be just that haha @dan1st | Daniel C:\Users\akifn\Desktop\MyProjects\java\useTesting>use-guiFX\src\main\resources\binFX\useFX.bat Fehler: Zum Ausführen dieser Anwendung benötigte JavaFX-Runtime-Komponenten fehlen
nikcho-kouhai
nikcho-kouhai4w ago
well probably, but I just ran into this issue literally 2 days ago and it resulted in the exact same problem you are experiencing so it was worth a shot
Akif
AkifOP4w ago
it says it needs the needed javafx-runtime-components which are mising
dan1st
dan1st4w ago
Did you run mvn package before running the bat file?
Akif
AkifOP4w ago
:runApp java %VMARGS% -jar %USE_JAR% -nr %* when I called it like this I did mvn verify
dan1st
dan1st4w ago
yes that's fine
Akif
AkifOP4w ago
ah I see thank you still
JavaBot
JavaBot4w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Akif
AkifOP4w ago
glad to hear yours got fixed so i guess the classifier>win< wont work here?
dan1st
dan1st4w ago
Can you show the pom.xml?
nikcho-kouhai
nikcho-kouhai4w ago
I've ran into this before too. This might sound weird but did you try making a new main class that just calls the main in your application that calls launch? It did the trick for me.
Akif
AkifOP4w ago
Akif
AkifOP4w ago
my problem is kind of a bit bigger to be fixed jut this way sadly it a problem with swing/javafx and the project being Multi Module
nikcho-kouhai
nikcho-kouhai4w ago
just give it a try, it will take you around 30 seconds and can be easily reversed. My project was multi module too with javafx it was a real odd solution and to this day I have no idea why it worked
Akif
AkifOP4w ago
thats the best problems when you get them fixed and really dont know whats happening haha
dan1st
dan1st4w ago
the "proper" solution would be the thing with copying dependencies - or jlink but the issue with that is split packages
nikcho-kouhai
nikcho-kouhai4w ago
yup
Akif
AkifOP4w ago
I see yeah the split packages issue we had
dan1st
dan1st4w ago
which could in theory also be solved with extracting the offending dependency which would be doable but kinda annoying
Akif
AkifOP4w ago
alright il stick with mvn for now than
dan1st
dan1st4w ago
I can tell you something that can be done: You can change the guiFX pom.xml to do the following: - When mvn package is executed, it runs dependency:copy but excludes xercesImpl - It extracts xercesImpl but removes the class causing the split package issue And then in your bat, you can run the project with --module-path on: - The JAR generated by mvn package (not the jar-with-dependencies) - The copied dependencies - The extracted dependency So essentially do some changes to the guiFX pom.xml and change the bat a bit
Akif
AkifOP4w ago
alright I will note this down for now and check it out later definetly for now I reached something big, which was getting this problem "fixed" since I wasnt able to run from cmd since 2 weeks @dan1st | Daniel if I should have questions or problems can I msg you or should I just post it in #java-help again?
dan1st
dan1st4w ago
You can create a post again or if you don't close this post, you can still use it
Akif
AkifOP4w ago
ah posts are there forever?
dan1st
dan1st4w ago
If you want to, I can show you what I think this would look like
Akif
AkifOP4w ago
like "inactive" yeah sure would like to see
dan1st
dan1st4w ago
Posts can go dormant after some time of inactivity but the post would stay there but it may be harder to find
Akif
AkifOP4w ago
alright Il reach out here then! your such a life saver man thank you very much :boohoo: 🤍 JavaBot is so sick of me haha
Akif
AkifOP4w ago
btw do you know how I can get rid of these long messages:
dan1st
dan1st4w ago
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>copy-deps</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeArtifactIds>xercesImpl</excludeArtifactIds>
</configuration>
</execution>
<execution>
<id>unpack-xercesImpl</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</artifactItem>
</artifactItems>
<excludes>
<exclude>org/w3c/dom/html/*</exclude>
</excludes>
<outputDirectory>${project.build.directory}/xercesImpl</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>copy-deps</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeArtifactIds>xercesImpl</excludeArtifactIds>
</configuration>
</execution>
<execution>
<id>unpack-xercesImpl</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</artifactItem>
</artifactItems>
<excludes>
<exclude>org/w3c/dom/html/*</exclude>
</excludes>
<outputDirectory>${project.build.directory}/xercesImpl</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Then you build it with mvn package (or mvn verify)
Akif
AkifOP4w ago
ah thats what these xerces do
dan1st
dan1st4w ago
and then you should theoretically be able to run it with a bat like
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

REM set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"
set USE_UNPACKED="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\xercesImpl"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" org.tzi.use.mainFX.MainFX -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

REM set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"
set USE_UNPACKED="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\xercesImpl"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" org.tzi.use.mainFX.MainFX -nr %*

REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
xercesImpl was the dependency causing the issue with org.w3c.dom.html. This step would change it so that this part would not be included. btw that would need to be in the guiFX POM Does that approach work like that? idk I didn't test it
Akif
AkifOP4w ago
yes yes got that
dan1st
dan1st4w ago
maybe I also messed up some configs, I jsut typed that out
Akif
AkifOP4w ago
idk I would need to test it out later but it looks good
dan1st
dan1st4w ago
Also practically you'd probably want to put all these things together in some directory (with the bat file) which you can then give to others who can just run it
Akif
AkifOP4w ago
you mean the whole project? I guess you mean my javafx part
dan1st
dan1st4w ago
only the things generated there meaning: - use-guiFX/target/dependency - use-guiFX/target/use-guiFX-YOUR_VERSION_HERE.jar - use-guiFX/target/xercesImpl - use-guiFX/src/main/resources/bin these would (ideally) be required
Akif
AkifOP4w ago
I am back faster then I thought haha sooo I realized a big flaw of our solution, so the other solution allows parameters to be added to the .bat call like this for example: use-gui\src\main\resources\bin\use.bat C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-core\src\main\resources\examples\Documentation\Fruits\Fruits.use our call with mvn, would that somehow support something like that?
@ECHO OFF
rem This proxy batch file is needed for the BAD tests in /test/state

rem %* = all command line arguments
rem %~dp0 = pathname of this batch file

call "%~dp0\start_use.bat" %*
@ECHO OFF
rem This proxy batch file is needed for the BAD tests in /test/state

rem %* = all command line arguments
rem %~dp0 = pathname of this batch file

call "%~dp0\start_use.bat" %*
so the %* it could contain a few parameters
dan1st
dan1st4w ago
yes, that's possible I think you can do mvn exec:java ... -Dexec.args="%*" or similar if these are separated by spaces
Akif
AkifOP4w ago
mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX so here how would i do that here?
dan1st
dan1st4w ago
mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX -Dexec.args="%*" idk whether %* is the right thing
Akif
AkifOP4w ago
ah so another dexec
dan1st
dan1st4w ago
I don't know batch that well yes
Akif
AkifOP4w ago
I see thank you il test
JavaBot
JavaBot4w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
dan1st
dan1st4w ago
-Da=b means "tell maven that a is set to b"
Akif
AkifOP4w ago
yeah %* should be correct
dan1st
dan1st4w ago
so you are setting exec.args to whatever is %*
Akif
AkifOP4w ago
that I will try to find out
john
john4w ago
So when i add it like this: :runApp mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX -Dexec.jvmArgs="%VMARGS%" -Dexec.args="%*" I get following: java.lang.NullPointerException: in (MainWindowFX.java:159) which is this:
if (fSession != null && fSession.hasSystem()) {
fModelBrowser.setModel(fSession.system().model());
}
if (fSession != null && fSession.hasSystem()) {
fModelBrowser.setModel(fSession.system().model());
}
inside MainWindowFX
This message has been formatted automatically. You can disable this using /preferences.
dan1st
dan1st4w ago
it means that fModelBrowser is null btw for development, you can just run the main from IntelliJ
Akif
AkifOP4w ago
idk its just a feature that should be there, but I will see if its ok this way
dan1st
dan1st4w ago
btw I pinned that so you can easily find the message if you want to come back to that in the future
Akif
AkifOP4w ago
Ah thats great Thank You bro, I will definetly come here a few times, bcs need to document properly what we did here and what I tryed :thumbs:
JavaBot
JavaBot4w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Akif
AkifOP3w ago
Idk seems to be not working kind of
Akif
AkifOP3w ago
Idk why but it says that packages arent visible
dan1st
dan1st3w ago
What's your full bat file?
Akif
AkifOP3w ago
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"
set USE_UNPACKED="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\xercesImpl"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java -nr %*

REM mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX -Dexec.jvmArgs="%VMARGS%" -Dexec.args="%*"

REM mvn -pl use-guiFX javafx:run


REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"
set USE_UNPACKED="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\xercesImpl"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java -nr %*

REM mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX -Dexec.jvmArgs="%VMARGS%" -Dexec.args="%*"

REM mvn -pl use-guiFX javafx:run


REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
dan1st
dan1st3w ago
and the pom.xml of the guiFX module
JavaBot
JavaBot3w ago
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"
set USE_UNPACKED="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\xercesImpl"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java -nr %*

REM mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX -Dexec.jvmArgs="%VMARGS%" -Dexec.args="%*"

REM mvn -pl use-guiFX javafx:run


REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
@echo off

if "%OS%"=="Windows_NT" @setlocal

rem CONFIGURATION
rem Add -Xss20m to VMARGS when using the generator
set VMARGS=

REM PATH1: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-7.1.1.jar
REM PATH2: C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-gui\target\use-guiFX-jar-with-dependencies.jar

set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
set USE_DEPENDENCIES="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\dependency"
set USE_UNPACKED="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\xercesImpl"

IF NOT EXIST %USE_JAR% (
echo Cannot find USE executable. Please provide correct path to use.jar.
goto end
)

:runApp
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java -nr %*

REM mvn -pl use-guiFX exec:java -Dexec.mainClass=org.tzi.use.mainFX.MainFX -Dexec.jvmArgs="%VMARGS%" -Dexec.args="%*"

REM mvn -pl use-guiFX javafx:run


REM java %VMARGS% --module-path "C:\Program Files\Java\openjfx-19_windows-x64_bin-sdk\javafx-sdk-19\lib" --add-modules javafx.controls,javafx.fxml,javafx.web -jar %USE_JAR% -nr %*


if "%OS%"=="Windows_NT" @endlocal

:mainEnd
rem echo exit code: %ERRORLEVEL%

:end
dan1st
dan1st3w ago
set USE_JAR="C:\Users\akifn\Desktop\MyProjects\java\useTesting\use-guiFX\target\use-guiFX-jar-with-dependencies.jar"
That shouldn't be the jar-with-dependencies
Akif
AkifOP3w ago




dan1st
dan1st3w ago
but the normal JAR
Akif
AkifOP3w ago
ah yeah you did say so true why again was it supposed to be not that one?
dan1st
dan1st3w ago
the jar-with-dependencies means you have one JAR with all classes together in one place
Akif
AkifOP3w ago
btw here I too out the :
<execution>
<id>unpack-xercesImpl</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<outputDirectory>${project.build.directory}/xercesImpl</outputDirectory>
<excludes>**/org/w3c/dom/html/*</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-xercesImpl</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<outputDirectory>${project.build.directory}/xercesImpl</outputDirectory>
<excludes>**/org/w3c/dom/html/*</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
part
dan1st
dan1st3w ago
this doesn't work with modules that require one JAR or directory per module
Akif
AkifOP3w ago
but wasnt that the goal to be achieved "mocked" with package?
dan1st
dan1st3w ago
you mean with the thing in the pom.xml? That makes sure the dependencies are in the correct directories like it copies all dependency JARs somewhere and also fixes the xercesImpl stuff
Akif
AkifOP3w ago
Akif
AkifOP3w ago
I get till the same one I just the jar without dependencies yes exactly
dan1st
dan1st3w ago
You have use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java in your bat. I think that should be org.tzi.use.mainFX.MainFX
Akif
AkifOP3w ago
this path somehow doesnt work, thats why I used that one:
dan1st
dan1st3w ago
or maybe -m YOUR_MODULE_NAME_HERE/org.tzi.use.mainFX.MainFX
Akif
AkifOP3w ago
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> use-guiFX\src\main\resources\binFX\useFX.bat
Fehler: Hauptklasse org.tzi.use.mainFX.MainFX konnte nicht gefunden oder geladen werden
Ursache: java.lang.ClassNotFoundException: org.tzi.use.mainFX.MainFX
PS C:\Users\akifn\Desktop\MyProjects\java\useTesting> use-guiFX\src\main\resources\binFX\useFX.bat
Fehler: Hauptklasse org.tzi.use.mainFX.MainFX konnte nicht gefunden oder geladen werden
Ursache: java.lang.ClassNotFoundException: org.tzi.use.mainFX.MainFX
it says could not be found
dan1st
dan1st3w ago
What's the name of the guiFX module? in the module-info.java
Akif
AkifOP3w ago
idk that somehow sometimes happens il check:
john
john3w ago
open module use.guiFX {

requires javafx.graphics;
requires javafx.fxml;
requires use.core;
requires javafx.controls;
requires javafx.swing;
requires javafx.web;
requires org.kordamp.desktoppanefx.core;
requires use.gui;

exports org.tzi.use.mainFX;
exports org.tzi.use.gui.mainFX;
}
open module use.guiFX {

requires javafx.graphics;
requires javafx.fxml;
requires use.core;
requires javafx.controls;
requires javafx.swing;
requires javafx.web;
requires org.kordamp.desktoppanefx.core;
requires use.gui;

exports org.tzi.use.mainFX;
exports org.tzi.use.gui.mainFX;
}
This message has been formatted automatically. You can disable this using /preferences.
dan1st
dan1st3w ago
java %VMARGS% --module-path "%USE_JAR%;%USE_DEPENDENCIES%;%USE_UNPACKED%" -m use.guiFX/org.tzi.use.mainFX.MainFX -nr %*
Akif
AkifOP3w ago
oh wow that one worked what did that change? o you defined the module which one it needs to use? ahh I guess it was looking in a different module maybe
dan1st
dan1st3w ago
Saying "I want to run the class org.tzi.use.mainFX.MainFX from the module use.guiFX
Akif
AkifOP3w ago
makes totally sense
dan1st
dan1st3w ago
if you use use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java, it tries to run use-guiFX/src/main/java/org/tzi/use/mainFX/MainFX.java and figure out stuff by itself
Akif
AkifOP3w ago
prob my structure making problems
dan1st
dan1st3w ago
which didn't know about modules properly as it seems That one is using the source code launcher which is (currently) not made for things with dependencies
Akif
AkifOP3w ago
Ty! but so how could someone run it now without having the need to have the whole project?
dan1st
dan1st3w ago
First of all, you need to make a few changes
Akif
AkifOP3w ago
like you know when someone has the jar with dependencies they can run it without needing the project like in the swing version
dan1st
dan1st3w ago
Like you would not use full paths
Akif
AkifOP3w ago
I might have these in a few spots I need to edit that :check:
dan1st
dan1st3w ago
One option would be to give them a zip file containing - the dependency directory - the guiFX JAR - the xercesImpl directory - the bat file and ensure the relative paths are set up in a way that it works whenever extracting the zip file you can also configure Maven to put everything in a single directory with the correct layout But since it works, you might want to commit and push first
Akif
AkifOP3w ago
xercesImpl Directory? I dont have that like as I did say I did took out that part Ah I had a typo there sorry I took out that xerces part bcs it was causing problems so this is the only thing added in pom.xml as a new plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>copy-deps</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeArtifactIds>xercesImpl</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>copy-deps</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeArtifactIds>xercesImpl</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
dan1st
dan1st3w ago
it's generated by Maven in the target directory
Akif
AkifOP3w ago
No description
dan1st
dan1st3w ago
that's the unpack part here
Akif
AkifOP3w ago
theres nothing at least I didnt see it
dan1st
dan1st3w ago
but if it works without it, ig that would be fine
Akif
AkifOP3w ago
btw can you maybe Help me out with a few warnings that kinda sound concerning when doing any mvn call? like I did check stackoverflow but It felt like all they where saying i accept it theres nothing to fix it ☠️
dan1st
dan1st3w ago
sure let me guess: encodings?
Akif
AkifOP3w ago
No description
Akif
AkifOP3w ago
its these ones Required filename-based automodules detected: https://stackoverflow.com/questions/46501047/what-does-required-filename-based-automodules-detected-warning-mean Oh yeah exactly I should do that first, before anything else
dan1st
dan1st3w ago
ahh that The good news about that warning is that you can pretty much ignore it as long as you don't publish it to a Maven repository and if you are able to change names in the module-info.java if that's necessary in the future but that would be something these library maintainers have to fix btw a better way would be to use jlink/jpackage which can create a full minimal Java installation that includes everything necessary but that's more complicated to set up and note: You can also configure Maven to automatically copy the bat file etc to the right location using the resource maven plugin if you want to
Akif
AkifOP3w ago
what exactly define a maven repository? am I not publishing it to one?
dan1st
dan1st3w ago
If you have a library and you want others (not working on the same project) to easily use it with <dependency>...</dependency>, you need to publish it to a Maven repository (typically Maven Central) since that isn't the case with you, that wouldn't be an issue
Akif
AkifOP3w ago
ah yeah jpackage was the next thing I thought about I heared thats for javafx to create a runnable application for them kinda old but yeah jut watched a video on youtube about it today, dont know thought how it would work out, but was looking forward to it, but first wanted to try out what you told me here amazed that this worked
dan1st
dan1st3w ago
btw I think if you build it on Windows, it might only work on Windows because the JavaFX Maven plugin might select the Windows version of JavaFX
Akif
AkifOP3w ago
ahh thats that maven central thing, have read about it before
dan1st
dan1st3w ago
not sure though
Akif
AkifOP3w ago
i guess i am not using it so far and not needed
dan1st
dan1st3w ago
Yes, Maven Central is the main Maven repository you are using it for your dependencies but you aren't publishing anything to it
Akif
AkifOP3w ago
and I dont need to right? like other people could still run it wiht the bat? hmm fair point that could be something to keep in mind I might try it out later on an macbook
dan1st
dan1st3w ago
Currently your bat uses absolute paths so you'd need to fix that Note that MacOS cannot run batch files so you'd need to adapt the shell script as well Note: With jlink/jpackage, you would create different artifacts/files/installers/whatever for different operating systems
Akif
AkifOP3w ago
yeah on it, I think I can use like %~dp0 or so
dan1st
dan1st3w ago
but you'd need to create these files on the operating systems you want to target (e.g. you need MacOS if you want to build it for MacOS). However, you can use things like GitHub Actions to do that for you. idk what exactly %~dp0 but there are likely alternatives with bash e.g. $*
Akif
AkifOP3w ago
i actually dk if the original swing version had cross compatibility
dan1st
dan1st3w ago
Swing is part of the Java standard libraries
Akif
AkifOP3w ago
I would need to check that out first, until than Il put that on lower priority i think
dan1st
dan1st3w ago
So if you download Java, you are also downloading the Swing version for the same OS
Akif
AkifOP3w ago
ah ok so its only a javaFX problem? bcs its not in the java standard library anymore?
dan1st
dan1st3w ago
Well it's also generally a thing if you use jlink/jpackage yeah pretty much
Akif
AkifOP3w ago
hmm I see
dan1st
dan1st3w ago
You could also say "Users have to download Java and the JavaFX SDK" to avoid this problem but do you really want to do that?
Akif
AkifOP3w ago
I have to look more into it than Idk, but I guess you wouldnt want to do that normally
dan1st
dan1st3w ago
Currently with the Swing version it would probably be users having to download Java
Akif
AkifOP3w ago
yeah thats currently a must anyways exactly
dan1st
dan1st3w ago
With jlink/jpackage, everything would come with the application including Java
Akif
AkifOP3w ago
ah I see i didnt know java also in it in the "package"
dan1st
dan1st3w ago
and including JavaFX and including dependencies that's what jlink/jpackage does
Akif
AkifOP3w ago
i was thinking only the dependencies like a jar with dep just like as a java solution kinda
dan1st
dan1st3w ago
jlink --> create a partial Java installation that only contains what you need (and also some extra things like your application and dependencies if you want to) jpackage --> pretty much like jlink but it can create it as a single executable installer
Akif
AkifOP3w ago
hmm so what would you recommend I should go for should I like do the Zip? or should I do one of these both Il need to first fix my code haha at least the call works now with java form the bat and not with mvn, thank you Daniel!
JavaBot
JavaBot3w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
dan1st
dan1st3w ago
For now, you could make sure that Maven puts all files in one directory you can easily create a zip file from. So such a directory would contain - the stuff from (I think) src/main/resources/bin - You'd need to update the paths there - the guiFX JAR - the dependencies - the xercesImpl folder if necessary if you have a directory like that (let's say target/dist) where Maven puts all these things automatically, you could just create a zip file and give that to others. After extracting that zip file, they could just run the bat In principle, I think it would also be possible to make that work for multiple OSes but that would increase the size of the zip file (and you can still do that independently from the other things)
Akif
AkifOP3w ago
Thank You @dan1st I will check these out and try that out!
JavaBot
JavaBot3w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Akif
AkifOP3w ago
Mannnn @dan1st I can call now from the cmd with Parameters its working OMG
dan1st
dan1st3w ago
nice
Akif
AkifOP3w ago
Thanks to your help bro, I am sooo happpy
JavaBot
JavaBot3w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Akif
AkifOP3w ago
has been a while I felt so good ngl i will sleep well tonight we are geniuses
dan1st
dan1st3w ago
good night
Akif
AkifOP3w ago
Thank You and wishing you the same
JavaBot
JavaBot3w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server