Tostis / areca

Fork of https://sourceforge.net/projects/areca/
GNU General Public License v2.0
5 stars 0 forks source link

NoClassDefFoundError - jface.window.Window$IExceptionHandler #4

Open ag88 opened 1 month ago

ag88 commented 1 month ago

this is more an app/dev note

after building successfully with

gradle copyToDistributionDir

the files are in build/dist

when running areca.sh an error prompted e.g.:

java.lang.NoClassDefFoundError: org.eclipse.jface.window.Window$IExceptionHandler
        at java.base/java.lang.ClassLoader.defineClassInternal(ClassLoader.java:476)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:437)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:1110)
        at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:898)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:806)
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:764)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1078)
        at com.application.areca.launcher.gui.Launcher.launchImpl(Launcher.java:141)
        at com.myJava.system.AbstractLauncher.launch(AbstractLauncher.java:47)
        at com.application.areca.launcher.gui.Launcher.main(Launcher.java:48)

it turns out that for some unknown reason the various dependent libs (e.g. Jface, SWT) are not copied into the libs dir.

I manually run

gradle copyDependencies

and the relevant jar files should be in build/libs. Then manually copy those same jar files into build/dist/os/lib running areca.sh then started successfully

this is just a dev/app note which may not necessary solve your problem, but leaving a note here just in case it helps

ag88 commented 1 month ago

additional dev note, turns out in build.gradle, copyToDistributionDir may be edited as

tasks.register('copyToDistributionDir', Copy) {
    group = 'Build'
    description = 'Copies all files to distribution directory.'

    dependsOn tasks.build, copyDependencies
    mustRunAfter createExe, createExeTui, copyDependencies

    tasks.checkArecafsSharedLibraryJniSymbols.dependsOn(copyDependencies)
...

adding the dependsOn copyDependencies runs copyDependencies prior to copyToDistributionDir. that additional tasks.checkArecafsSharedLibraryJniSymbols.dependsOn(copyDependencies) is to fix tasks dependencies errors during gradle copyToDistributionDir which complains/error that the task dependency must be specified.

this fix would assure that the dependencies jars are copied and hence averting the errors due to the missing jar libraries e.g. SWT etc