jeudi 22 mars 2018

Making a Java file executable? "Could not find main class"?

I developed a program on Eclipse (October 2017). It's a GUI, but doesn't use the APPLET extension. I've been trying to figure out how to make it a simple executable so it doesn't require a compiler to run. Upon trying export it as a JAR Runnable, I get the following error:

enter image description here

I also tried a command line jar program, however I believe the versions aren't compatible as I get a bunch of errors in code that I don't get in Eclipse.

Exception in thread "main" java.lang.UnsupportedClassVersionError: bin/display : Unsupported major.minor version 53.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

At the bottom of my display class, I do have my main method

    public static void main(String[] args) {
    display show = new display();
}

I can't create a Web App out of it either, since it isn't an APPLET.

I've tried stuff, but I'm a little lost now.

Any ideas or guidance would be greatly appreciated.

Thank you.




Aucun commentaire:

Enregistrer un commentaire