unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Carlo Tambuatco <oraclmaster@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Any JDEE experts here? Need help compiling files.
Date: Sun, 3 Jun 2018 06:48:01 -0700 (PDT)	[thread overview]
Message-ID: <893d1770-3cc6-4988-b44c-3380fb20ccb1@googlegroups.com> (raw)
In-Reply-To: <602906c9-4540-4d22-ac90-a5ad1b285c56@googlegroups.com>

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.


      reply	other threads:[~2018-06-03 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-02 18:22 Any JDEE experts here? Need help compiling files Carlo Tambuatco
2018-06-03 13:48 ` Carlo Tambuatco [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=893d1770-3cc6-4988-b44c-3380fb20ccb1@googlegroups.com \
    --to=oraclmaster@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).