#Why Others fmxl files not exist with the main and it work working before change it to "Jar"?
114 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @tardy lichen! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed 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.
<@&765578700724371486>
Please help I go youtube and all like sources but get no answer!
if you know ping me!
sorry @fluid bough
But can i have help?
What doesn't work?
How do you know it doesn't work?
Are there any exceptions/stack traces/errors?
Frist Of all everything was working and fine when i run it in intellj
but when i covert it from code to jar the only main file is working but others files that i link with don't do anything even the sounds
i use javafx sensebuilder to build my gui
i have like 4 fxml files
the only one that show me is "Main.fxml" but all other is even show
how it gonna load the other fxml you might ask?
Yes
@FXML
void settingsButton(ActionEvent event) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
Sound button = new Sound();
button.button(this);
root = FXMLLoader.load(getClass().getResource("Settings.fxml"));
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
and what is the console output?
Ah i say this in jar not in intellj
intellj working fine and everything
You can still get the console output when running a JAR
but when i corvert it to .jar a build the artifact it not show anthing
I want to see the console output when running the application as a JAR
how?
open your terminal in the directory of your JAR
and run java -jar yourjar.jar where yourjar.jar is your JAR file
Ok 1 sec
sorry how open terminal from intellj?
oh
this one i see
this what it show me
idk why it not opening lol
first of all, move to the directory your JAR is located
using cd or similar
Secondly, put the name of your JAR instead of yourjar.jar, not after it
Thirdly, if there are spaces, you might need to quote them with ""
Oh
ok
ok!
java -jar "Nation Quest (Beta 1).jar"
it working
and it frist thing now
when i click button
it send error
this error or smth was not happend in intellj
Ok!
here all 😂 java public void button(Action action) throws UnsupportedAudioFileException, IOException, LineUnavailableException { File file; try { file = new File(Main.class.getResource("Sounds/Button-s.wav").toURI()); } catch (URISyntaxException e) { throw new RuntimeException(e); } AudioInputStream audioStream = AudioSystem.getAudioInputStream(file); clip.stop(); clip.close(); clip.open(audioStream); clip.start();
it is not a file
oh
AudioSystem.getAudioInputStream(Main.class.getResource("Sounds/Button-s.wav"));
it in reaouses
just do it like that
yes in rouses
yes, without files
that should work
without files, no
all my files in rouses it's in the project
ah
As soon as you build a JAR, they aren't files any more so you cannot use them as files
that works in inetllj
so how make then like linked to the Jar!
then it should also work in the JAR
all my files that i show here works in intellj but not in the jar
you probably have different problems as you had with the sound thing
let me send you the error
recreate the JAR, run it with java -jar and check the console
oh ok
Are you sure you recreated the JAR after changing the code as I told you?
Sorry I send it so earlie just doing that now
java -jar Nation Quest (Beta 1).jar
again
with ""
ok!
:0
it working
the sound here!
bruh now the other files working 💀
but what is this warning?
JavaFX is not intended to be run from a JAR like that
not run it as a JAR
Ye i want run it as a exe
yes, that works
so i can fix that warning and put icon
at least if you have properly modularized your application
Then you can use jpackage/jlink to package it as an exe file
does when i use this apps does the icon i will put will be here too?
up the page? of my window?
I think you can do that