Quantcast

Maven JavaFX Application

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Maven JavaFX Application

Rallenaldo
Hi.

I have a huge problem with programming a JavaFX Maven application.

If I create a new Maven Java FX project, I get the following error message within project properties.

I expanded the whole project, so you can see, that I haven´t done anything yet. If I start to programm the application, this warning isn´t a problem but after some time (max 1-2 hours) netbeans tells me, that it cannot find the main class anymore.

I can build the application without an error. But if I choose run file or run project, I get the error that the main class cannot be found. (I removed the name of the main class to avoid confusion about the file names of the blank project and the project I am working on)

I attached 3 files to show you the problem.

Versions:

JDK: 1.8.0_121
JRE: 1.8.0_121
Maven: 3.5.0
Windows 7 64bit
Netbeans 8.2

Can somebody help me out?




Attachments:
http://forums.netbeans.org//files/netbeans2_150.jpg
http://forums.netbeans.org//files/pom_181.txt
http://forums.netbeans.org//files/netbeans1_234.jpg

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven JavaFX Application

Brett Ryan

> On 21 Apr 2017, at 19:59, Rallenaldo <[hidden email]> wrote:
>
> Hi.
>
> I have a huge problem with programming a JavaFX Maven application.
>
> If I create a new Maven Java FX project, I get the following error message within project properties.
>
> I expanded the whole project, so you can see, that I haven´t done anything yet. If I start to programm the application, this warning isn´t a problem but after some time (max 1-2 hours) netbeans tells me, that it cannot find the main class anymore.
>
> I can build the application without an error. But if I choose run file or run project, I get the error that the main class cannot be found. (I removed the name of the main class to avoid confusion about the file names of the blank project and the project I am working on)
>
> I attached 3 files to show you the problem.
>
> Versions:
>
> JDK: 1.8.0_121
> JRE: 1.8.0_121
> Maven: 3.5.0
> Windows 7 64bit
> Netbeans 8.2
>
> Can somebody help me out?
>
> Attachments:
> http://forums.netbeans.org//files/netbeans2_150.jpg
> http://forums.netbeans.org//files/pom_181.txt
> http://forums.netbeans.org//files/netbeans1_234.jpg

That warning message is normal due to the JavaFX template using different execution goals (see Actions > Run project and Debug Project). The project should still run as normal.

Where do you get the main class can not be found error? The main class is set in the pom's mainClass property, which in your screenshot looks fine.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Maven JavaFX Application

Rallenaldo
In reply to this post by Rallenaldo
Hi.

Thanks for the quick answer.

Like I said. The application runs just fine - for 1-2 hours. After that, the error message occurs.

It shows up, when I try to run the project (clean and build without an error). I attached the complete POM file as a txt file. The POM file was completely created by maven. I just added some dependencies and changed the name of the main class. After I changed the main class the application still worked.




Attachments:
http://forums.netbeans.org//files/app1_652.jpg
http://forums.netbeans.org//files/pom_183.txt

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Maven JavaFX Application

Brett Ryan
Interesting, can you share the project?

I wonder if there's an alteration in one of your nbactions since you have multiple profiles going on there that could be causing the issue.

What happens if you execute the project from maven on the command line? TIP: If you don't have a standalone maven installation you can find the one that comes with netbeans in $NETBEANS_HOME/java/maven, thus you can set

MAVEN_HOME=$NETBEANS_HOME/java/maven
PATH=$MAVEN_HOME/bin:$PATH

I know that's not the windows convention but it's been so long since I've used windows I can't remember how to set environment variables there.

mvn -Drunfx.args='-jar "${project.build.directory}/${project.build.finalName}.jar"' clean package org.codehaus.mojo:exec-maven-plugin:1.2.1:exec


The run action should look as follows:

        <action>
            <actionName>run</actionName>
            <goals>
                <goal>clean</goal>
                <goal>package</goal>
                <goal>org.codehaus.mojo:exec-maven-plugin:1.2.1:exec</goal>
            </goals>
            <properties>
                <runfx.args>-jar "${project.build.directory}/${project.build.finalName}.jar"</runfx.args>
            </properties>
        </action>


> On 21 Apr 2017, at 22:10, Rallenaldo <[hidden email]> wrote:
>
> Hi.
>
> Thanks for the quick answer.
>
> Like I said. The application runs just fine - for 1-2 hours. After that, the error message occurs.
>
> It shows up, when I try to run the project (clean and build without an error). I attached the complete POM file as a txt file. The POM file was completely created by maven. I just added some dependencies and changed the name of the main class. After I changed the main class the application still worked.
>
>
>
>
> Attachments:
> http://forums.netbeans.org//files/app1_652.jpg
> http://forums.netbeans.org//files/pom_183.txt
>

Loading...