Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Application aborted." Error declaring custom system classloader via JVM options #103

Open
robert-esl opened this issue Jul 19, 2023 · 0 comments

Comments

@robert-esl
Copy link

An error is preventing me from using WinRun4j.

I am hoping to use Winrun4j to package an application, to prevent the user from modifying the command-line. The application also uses a custom system classloader, specified by the JVM's -Djava.system.class.loader argument (as documented at ClassLoader.getSystemClassloader() ).

However, when I run the following test application with a custom system classloader, I get an error in the log: [err] Application aborted. (after the splash screen appears briefly). I get no System.out messages from the application, which then exits.

The application runs fine through the IDE, and if I don't overwrite the system classloader myself, I do appear to get the JVM's classloader, and all expected output.

Can you please suggest any reason for the crash, or any way I can get further information?

I am using coretto-11.0.18 64-bit.

My entire application is as follows (2 class files, packaged into a JAR).

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, World");
    }
}
public class MyClassLoader extends ClassLoader {
    private transient boolean recurse;
    public MyClassLoader(ClassLoader parent) {
        super(parent);
    }
    @Override
    protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
        if (!recurse) {
            System.out.println("Loading: " + name);
        }
        try{
            recurse = true;
            return super.loadClass(name, resolve);
        } finally {
            recurse = false;
        }
    }
}

My .ini file (added to the .exe)

main.class=Main
vmarg.1=-Djava.system.class.loader=MyClassLoader
vm.location=C:\Users\rober\.jdks\corretto-11.0.18\bin\server\jvm.dll
vm.version.min=1.11
splash.image=splashscreen_newest.gif
ini.override=false # don't allow classloader overrides
args.allow.vmargs=false # don't allow vm argument overrides
log=winrun4jtest.log
log.overwrite=true

winrun4jtest.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant