edvin / fxlauncher

Auto updating launcher for JavaFX Applications
Apache License 2.0
713 stars 110 forks source link

java.lang.ClassNotFoundException #120

Open HiranManjula opened 6 years ago

HiranManjula commented 6 years ago

image

java.lang.ClassNotFoundException: com.greencoding.MyApp at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at fxlauncher.AbstractLauncher.createApplicationEnvironment(AbstractLauncher.java:161) at fxlauncher.Launcher.lambda$start$0(Launcher.java:149) at java.lang.Thread.run(Thread.java:748)

here is my pom file. it is work fine when your demo project executed. but when I started new project to implement that above exception is throwing when running the application.

<?xml version="1.0" encoding="UTF-8"?>

4.0.0 com.greencoding MyApp 1.0.0 jar MyApp no.tornado fxlauncher 1.0.16 MyApp com.greencoding.MyApp USERLIB/MyApp --myOption=myValue --myOtherOption=myOtherValue Green Coding 2.0 http://demo.example edvin@demo.example:demo ${project.build.directory}/app ${project.build.directory}/installer false UTF-8 Green Coding org.apache.maven.plugins maven-jar-plugin 2.6 ${app.dir} org.apache.maven.plugins maven-dependency-plugin 2.10 provided ${app.dir} true package copy-dependencies org.codehaus.mojo exec-maven-plugin 1.4.0 create-manifest package java fxlauncher.CreateManifest ${app.url} ${app.mainClass} ${app.dir} --cache-dir=${app.cacheDir} --accept-downgrade=${app.acceptDowngrade} --include-extensions=jpg ${app.parameters} embed-manifest-in-launcher package exec jar ${app.dir} uf fxlauncher.jar app.xml installer install exec javapackager -deploy -native -outdir ${app.installerdir} -outfile ${app.filename} -srcdir ${app.dir} -srcfiles fxlauncher.jar -appclass fxlauncher.Launcher -name ${project.name} -title ${project.name} -vendor ${app.vendor} -BappVersion=${app.version} -Bidentifier=${project.groupId}.${project.artifactId} deploy-app exec scp -r target/app/. ${app.deploy.target} org.apache.maven.plugins maven-compiler-plugin 3.3 1.8 1.8
edvin commented 6 years ago

The issue is that you don't have a class called com.greencoding.MyApp in your target folder. Double check the class name and inspect the target folder :) If not, can you post a link to your project so I can take a look at the code?

HiranManjula commented 6 years ago

okay, can you specify me where is the target folder is?

edvin commented 6 years ago

Directly in your project folder after you have built the project.

HiranManjula commented 6 years ago

yeah inside the target folder there are 5 folders. This is my testing project link and I'm using NetBeans IDE 8.2 on Windows 10 64bit platform to generate target folder.

https://github.com/HiranManjula/green-myapp

image

HiranManjula commented 6 years ago

FYI : seems like there is no different between your demo project main class path & my project main class path. image

HiranManjula commented 6 years ago

hi edvin, could you please help me to get rid this out?

edvin commented 6 years ago

The reason is simple - the installer is now able to download the files from the url you provided (http://demo.example is not where you're hosting your application artifacts). Since the installer cannot download the application library files, it simply can't run the app. You posted the bottom most error message, but you'll see an error message pertaining to failed HTTP downloads higher up in the log. Before you try to run your app, you need to actually deploy the app files and make sure they are available at the url you specified.