help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Any JDEE experts here? Need help compiling files.


From: Carlo Tambuatco
Subject: Any JDEE experts here? Need help compiling files.
Date: Sat, 2 Jun 2018 11:22:08 -0700 (PDT)
User-agent: G2/1.0

Here's my JDEE init file contents:

(setq jdee-jdk-registry (quote (
                                ("1.8" . 
"/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home")
                                ("9" . 
"/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home")
                                ("10" . 
"/Library/Java/JavaVirtualMachines/jdk-10.jdk/Contents/Home")
                                )
                               )
      jdee-jdk `("1.8")
      );;end setq
      
(setq jdee-server-dir "~/.emacs.d/jdee-server/")
;; Sets the compiler to use to compile java programs
;; was originally "javac server"
(setq jdee-compiler '("javac"))


I've got the jdk registry set up to use java 1.8 for compilation, and to use 
"javac" the local java compiler command instead of the default "javac server".

When I compile a file from the command line using javac (not using emacs, using 
the shell outside of emacs), everything works great. The JVM runs the program 
without error.

When I run c-c c-v c-c , which runs jdee-compile, (which is set to run the 
"javac" command per the options I set), it compiles the file, but when I run 
the compiled file I get the following error:

Assuming I am compiling a file named HelloWorldSwing.java using jdee-compile:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: 
HelloWorldSwing has been compiled by a more recent version of the Java Runtime 
(class file version 54.0), this version of the Java Runtime only recognizes 
class file versions up to 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
        at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)



This error does not occur when I compile the HelloWorldSwing.java from the 
command line. I have no idea how to configure JDEE to properly compile the file 
using the same JVM as the command line.

To be clear, emacs JDEE is configured to use jdk version 1.8, the same version 
jdk used at the command line.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]