[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Any JDEE experts here? Need help compiling files.
From: |
Carlo Tambuatco |
Subject: |
Re: Any JDEE experts here? Need help compiling files. |
Date: |
Sun, 3 Jun 2018 06:48:01 -0700 (PDT) |
User-agent: |
G2/1.0 |
On Saturday, June 2, 2018 at 2:22:10 PM UTC-4, Carlo Tambuatco wrote:
> 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.
Okay, I've made a little progress here...it seems for some reason jdee is
compiling with java version 10 instead of 1.8. I don't know why as I've set
jdee-jdk explicitly to "1.8"... this was confirmed when I ran the jdee compiled
file using java10 via the command line. The only solution I've found as of now
is to remove all alternate jdk's except the one I intend to use.
If anyone else has some insight into why this is behaving this way, I'd
appreciate it.