0

I am developing an JavaFX application and used the native packaging tool (incl. Inno Setup 5 and WiX) to create .exe files and installers. The program is a self-containing application. When I install and execute it on my own computer (Windows 10) it seems not to run. The error message after clicking the launch icon is: "no main class" and after closing this dialog another dialog error:"Failed to launch JVM"

build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="SVG Prototype Application" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<path id="fxant">
    <filelist>
        <file name="C:\Program Files\Java\jdk1.8.0_31\lib\ant-javafx.jar"/>
        <file name="C:\Program Files\Java\jdk1.8.0_31\jre\lib\ext\jfxrt.jar"/>
        <file name="${basedir}"/>
    </filelist>
</path>

<taskdef classpathref="fxant"
         resource="com/sun/javafx/tools/ant/antlib.xml"
         uri="javafx:com.sun.javafx.tools.ant"/>

<fx:application id="fxApplication"
                name="Test Application"
                mainClass="com.testlibrary.Main"
                version="1.0"
/>
<fx:jar destfile="dist/test.jar">
    <!-- Details about application -->
    <fx:application name="SVGPrototype" mainClass="com.testlibrary.Main"/>

    <!-- Define what auxilary resources are needed -->
    <fx:resources>
        <fx:fileset dir="dist" includes="lib/*.jar"/>
    </fx:resources>

    <!-- What to include into result jar file?
         Everything in the build tree -->
    <fileset dir="build/classes"/>
</fx:jar>

<fx:deploy height="400" nativeBundles="all" outdir="dist" outfile="SVGViewer" placeholderId="ZZZ" width="600">
    <fx:application name="Test Application" mainClass="com.testlibrary.Main"/>
    <fx:resources>
        <fx:fileset dir="dist" includes="test.jar"/>
        <fx:fileset dir="dist" includes="resources/**"/>
    </fx:resources>
</fx:deploy>

package.cfg generated

app.mainjar=test.jar
app.version=1.0
app.id=com.testlibrary
app.preferences.id=com/testlibrary
app.mainclass=com/testlibrary/Main
app.classpath=

Does someone know where is the problem? Thanks in advance!

IrApp
  • 1,823
  • 5
  • 24
  • 42
  • 2
    are you sure that your main class is src.main.java.com.testlibrary.Main ? appear that "src.main.java" is not correct, possibly is "com.testlibrary.Main" – F.Rosado Feb 22 '17 at 12:17
  • Nope, I have tried this too. It is a Java project and the rooth is this one. – IrApp Feb 22 '17 at 13:02
  • @IrApp which package does our Main class is in? Does it say at the very top `package src.main.java.com.testlibrary`? – Sergey Grinev Feb 22 '17 at 13:34
  • Yes, it is in: `src.main.java.com.testlibrary` – IrApp Feb 22 '17 at 13:35
  • are you completely sure? The java maven project folder structure usually is like SRC/main/java – F.Rosado Feb 22 '17 at 15:15
  • 1
    It is not a maven project, I use gradle. My class is in src.main.java.com.testlibrary, I am completely shure, I have checked it 1000 times :( – IrApp Feb 22 '17 at 15:18
  • When using gradle, you might want to try this plugin: https://github.com/FibreFoX/javafx-gradle-plugin (DISCLAIMER: I'm the author of that gradle-plugin) – FibreFoX Feb 23 '17 at 11:32
  • Please note that "src/main/java" is not part of the package! it is part for the compiler to find it's sources without special configuration, so you have to change your package to "com.testlibrary", even if it sits inside "src/main/java", this is the CONVENTION location. – FibreFoX Feb 23 '17 at 11:34
  • Addendum: this convention got adopted from maven, even gradle uses the same folder-structure per default – FibreFoX Feb 23 '17 at 12:24
  • I have tried this too and it is not working either :( – IrApp Feb 24 '17 at 09:47
  • @IrApp can you try to upload you app somewhere? It is hard to debug this situation without the actual code – FibreFoX Feb 25 '17 at 13:43

0 Answers0