Create working .jar out of Maven-Project - JavaFX (Afterburner.fx) Project : Currently stuck with...












1















I´ve created a small JavaFx Project with the use of the afterburner.fx framework.
It works fine when I start it in the IDE (IntelliJ), but after I created a fat .jar out of it via the "maven-assembly-plugin" it fails to open the Second View.





Pom.xml:



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.company.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>


SetupPresenter.onStart():



public void onStart(){
InProgressView inProgressScreen = new InProgressView();
Scene scene = new Scene(inProgressScreen.getView());
window.setScene(scene);
window.setTitle("Currently Running");
window.show();

SetRating app = new SetRating();
new Thread(app).start();
}




Errormessage:



Caused by: java.lang.IllegalStateException: Cannot load file InProgress.fxml
at com.airhacks.afterburner.views.FXMLView.getResourceCamelOrLowerCase(FXMLView.java:221)
at com.airhacks.afterburner.views.FXMLView.getFXMLName(FXMLView.java:205)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:83)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:72)
at com.company.gui.inProgress.InProgressView.<init>(InProgressView.java:5)
at com.company.gui.setup.SetupPresenter.onStart(SetupPresenter.java:41)
... 58 more


The same Errormessage you get in the IDE, when you not include the .fxml in the pom.xml as displayed following:



<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.properties</include>
<include>**/*.png</include>
</includes>
</resource>


So probably it has something to do with it.
But as I said, the First View is loaded and it is initiated in completly the same way as the Second View:



@Override
public void start(Stage stage) {
window = stage;

SetupView setupScreen = new SetupView();
Scene scene = new Scene(setupScreen.getView());
window.setScene(scene);
window.setTitle("ScotlandYard");
window.show();

}




I´ve tried to find the solution by myself today and tried to generate the fat .jar in varoius other ways, but wasnt able to get a running .jar.










share|improve this question

























  • Look in your generated .jar if all the necessary files are included (InProgress.fxml, InProgressPresenter.java, InProgressView.java). If not, try adding the " <directory>src/main/resources</directory>" as resource in your pom.

    – briadeus
    Nov 30 '18 at 12:39
















1















I´ve created a small JavaFx Project with the use of the afterburner.fx framework.
It works fine when I start it in the IDE (IntelliJ), but after I created a fat .jar out of it via the "maven-assembly-plugin" it fails to open the Second View.





Pom.xml:



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.company.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>


SetupPresenter.onStart():



public void onStart(){
InProgressView inProgressScreen = new InProgressView();
Scene scene = new Scene(inProgressScreen.getView());
window.setScene(scene);
window.setTitle("Currently Running");
window.show();

SetRating app = new SetRating();
new Thread(app).start();
}




Errormessage:



Caused by: java.lang.IllegalStateException: Cannot load file InProgress.fxml
at com.airhacks.afterburner.views.FXMLView.getResourceCamelOrLowerCase(FXMLView.java:221)
at com.airhacks.afterburner.views.FXMLView.getFXMLName(FXMLView.java:205)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:83)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:72)
at com.company.gui.inProgress.InProgressView.<init>(InProgressView.java:5)
at com.company.gui.setup.SetupPresenter.onStart(SetupPresenter.java:41)
... 58 more


The same Errormessage you get in the IDE, when you not include the .fxml in the pom.xml as displayed following:



<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.properties</include>
<include>**/*.png</include>
</includes>
</resource>


So probably it has something to do with it.
But as I said, the First View is loaded and it is initiated in completly the same way as the Second View:



@Override
public void start(Stage stage) {
window = stage;

SetupView setupScreen = new SetupView();
Scene scene = new Scene(setupScreen.getView());
window.setScene(scene);
window.setTitle("ScotlandYard");
window.show();

}




I´ve tried to find the solution by myself today and tried to generate the fat .jar in varoius other ways, but wasnt able to get a running .jar.










share|improve this question

























  • Look in your generated .jar if all the necessary files are included (InProgress.fxml, InProgressPresenter.java, InProgressView.java). If not, try adding the " <directory>src/main/resources</directory>" as resource in your pom.

    – briadeus
    Nov 30 '18 at 12:39














1












1








1


2






I´ve created a small JavaFx Project with the use of the afterburner.fx framework.
It works fine when I start it in the IDE (IntelliJ), but after I created a fat .jar out of it via the "maven-assembly-plugin" it fails to open the Second View.





Pom.xml:



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.company.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>


SetupPresenter.onStart():



public void onStart(){
InProgressView inProgressScreen = new InProgressView();
Scene scene = new Scene(inProgressScreen.getView());
window.setScene(scene);
window.setTitle("Currently Running");
window.show();

SetRating app = new SetRating();
new Thread(app).start();
}




Errormessage:



Caused by: java.lang.IllegalStateException: Cannot load file InProgress.fxml
at com.airhacks.afterburner.views.FXMLView.getResourceCamelOrLowerCase(FXMLView.java:221)
at com.airhacks.afterburner.views.FXMLView.getFXMLName(FXMLView.java:205)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:83)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:72)
at com.company.gui.inProgress.InProgressView.<init>(InProgressView.java:5)
at com.company.gui.setup.SetupPresenter.onStart(SetupPresenter.java:41)
... 58 more


The same Errormessage you get in the IDE, when you not include the .fxml in the pom.xml as displayed following:



<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.properties</include>
<include>**/*.png</include>
</includes>
</resource>


So probably it has something to do with it.
But as I said, the First View is loaded and it is initiated in completly the same way as the Second View:



@Override
public void start(Stage stage) {
window = stage;

SetupView setupScreen = new SetupView();
Scene scene = new Scene(setupScreen.getView());
window.setScene(scene);
window.setTitle("ScotlandYard");
window.show();

}




I´ve tried to find the solution by myself today and tried to generate the fat .jar in varoius other ways, but wasnt able to get a running .jar.










share|improve this question
















I´ve created a small JavaFx Project with the use of the afterburner.fx framework.
It works fine when I start it in the IDE (IntelliJ), but after I created a fat .jar out of it via the "maven-assembly-plugin" it fails to open the Second View.





Pom.xml:



<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>

</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.company.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>


SetupPresenter.onStart():



public void onStart(){
InProgressView inProgressScreen = new InProgressView();
Scene scene = new Scene(inProgressScreen.getView());
window.setScene(scene);
window.setTitle("Currently Running");
window.show();

SetRating app = new SetRating();
new Thread(app).start();
}




Errormessage:



Caused by: java.lang.IllegalStateException: Cannot load file InProgress.fxml
at com.airhacks.afterburner.views.FXMLView.getResourceCamelOrLowerCase(FXMLView.java:221)
at com.airhacks.afterburner.views.FXMLView.getFXMLName(FXMLView.java:205)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:83)
at com.airhacks.afterburner.views.FXMLView.<init>(FXMLView.java:72)
at com.company.gui.inProgress.InProgressView.<init>(InProgressView.java:5)
at com.company.gui.setup.SetupPresenter.onStart(SetupPresenter.java:41)
... 58 more


The same Errormessage you get in the IDE, when you not include the .fxml in the pom.xml as displayed following:



<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.fxml</include>
<include>**/*.css</include>
<include>**/*.properties</include>
<include>**/*.png</include>
</includes>
</resource>


So probably it has something to do with it.
But as I said, the First View is loaded and it is initiated in completly the same way as the Second View:



@Override
public void start(Stage stage) {
window = stage;

SetupView setupScreen = new SetupView();
Scene scene = new Scene(setupScreen.getView());
window.setScene(scene);
window.setTitle("ScotlandYard");
window.show();

}




I´ve tried to find the solution by myself today and tried to generate the fat .jar in varoius other ways, but wasnt able to get a running .jar.







java javafx maven-2 maven-assembly-plugin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 28 '18 at 14:42







th0m4zz

















asked Nov 25 '18 at 19:39









th0m4zzth0m4zz

64




64













  • Look in your generated .jar if all the necessary files are included (InProgress.fxml, InProgressPresenter.java, InProgressView.java). If not, try adding the " <directory>src/main/resources</directory>" as resource in your pom.

    – briadeus
    Nov 30 '18 at 12:39



















  • Look in your generated .jar if all the necessary files are included (InProgress.fxml, InProgressPresenter.java, InProgressView.java). If not, try adding the " <directory>src/main/resources</directory>" as resource in your pom.

    – briadeus
    Nov 30 '18 at 12:39

















Look in your generated .jar if all the necessary files are included (InProgress.fxml, InProgressPresenter.java, InProgressView.java). If not, try adding the " <directory>src/main/resources</directory>" as resource in your pom.

– briadeus
Nov 30 '18 at 12:39





Look in your generated .jar if all the necessary files are included (InProgress.fxml, InProgressPresenter.java, InProgressView.java). If not, try adding the " <directory>src/main/resources</directory>" as resource in your pom.

– briadeus
Nov 30 '18 at 12:39












1 Answer
1






active

oldest

votes


















0














I found the Answer



Solution for me was just to rename the .fxml Files to start Uppercase:
As an example I renamed view1.fxml to View1.fxml.
I guess it has something to do with the way windows is accesing the files inside an jar/zip.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53471158%2fcreate-working-jar-out-of-maven-project-javafx-afterburner-fx-project-cur%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I found the Answer



    Solution for me was just to rename the .fxml Files to start Uppercase:
    As an example I renamed view1.fxml to View1.fxml.
    I guess it has something to do with the way windows is accesing the files inside an jar/zip.






    share|improve this answer




























      0














      I found the Answer



      Solution for me was just to rename the .fxml Files to start Uppercase:
      As an example I renamed view1.fxml to View1.fxml.
      I guess it has something to do with the way windows is accesing the files inside an jar/zip.






      share|improve this answer


























        0












        0








        0







        I found the Answer



        Solution for me was just to rename the .fxml Files to start Uppercase:
        As an example I renamed view1.fxml to View1.fxml.
        I guess it has something to do with the way windows is accesing the files inside an jar/zip.






        share|improve this answer













        I found the Answer



        Solution for me was just to rename the .fxml Files to start Uppercase:
        As an example I renamed view1.fxml to View1.fxml.
        I guess it has something to do with the way windows is accesing the files inside an jar/zip.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 20 '18 at 17:57









        th0m4zzth0m4zz

        64




        64






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53471158%2fcreate-working-jar-out-of-maven-project-javafx-afterburner-fx-project-cur%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks