From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Carlo Tambuatco Newsgroups: gmane.emacs.help Subject: Re: Any JDEE experts here? Need help compiling files. Date: Sun, 3 Jun 2018 06:48:01 -0700 (PDT) Message-ID: <893d1770-3cc6-4988-b44c-3380fb20ccb1@googlegroups.com> References: <602906c9-4540-4d22-ac90-a5ad1b285c56@googlegroups.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1528033710 32261 195.159.176.226 (3 Jun 2018 13:48:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 3 Jun 2018 13:48:30 +0000 (UTC) Injection-Date: Sun, 03 Jun 2018 13:48:02 +0000 User-Agent: G2/1.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 03 15:48:26 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPTMu-0008H1-CT for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Jun 2018 15:48:24 +0200 Original-Received: from localhost ([::1]:35390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPTP1-0007vg-9E for geh-help-gnu-emacs@m.gmane.org; Sun, 03 Jun 2018 09:50:35 -0400 X-Received: by 2002:a37:7b83:: with SMTP id w125-v6mr9782680qkc.17.1528033682278; Sun, 03 Jun 2018 06:48:02 -0700 (PDT) X-Received: by 2002:ac8:7349:: with SMTP id q9-v6mr495643qtp.3.1528033682182; Sun, 03 Jun 2018 06:48:02 -0700 (PDT) Original-Path: usenet.stanford.edu!x25-v6no2043513qto.0!news-out.google.com!p41-v6ni1827qtp.1!nntp.google.com!x25-v6no2043503qto.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <602906c9-4540-4d22-ac90-a5ad1b285c56@googlegroups.com> Complaints-To: groups-abuse@google.com Original-Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2600:1700:78d0:a570:35f9:4eae:bc9c:89a3; posting-account=kBs42AoAAAANLkgsfBE9l2x8G7L-UXT5 Original-NNTP-Posting-Host: 2600:1700:78d0:a570:35f9:4eae:bc9c:89a3 Original-Xref: usenet.stanford.edu gnu.emacs.help:222835 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116956 Archived-At: On Saturday, June 2, 2018 at 2:22:10 PM UTC-4, Carlo Tambuatco wrote: > Here's my JDEE init file contents: >=20 > (setq jdee-jdk-registry (quote ( > ("1.8" . "/Library/Java/JavaVirtualMachin= es/jdk1.8.0_161.jdk/Contents/Home") > ("9" . "/Library/Java/JavaVirtualMachines= /jdk-9.0.4.jdk/Contents/Home") > ("10" . "/Library/Java/JavaVirtualMachine= s/jdk-10.jdk/Contents/Home") > ) > ) > jdee-jdk `("1.8") > );;end setq > =20 > (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")) >=20 >=20 > 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 s= erver". >=20 > 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 th= e program without error. >=20 > When I run c-c c-v c-c , which runs jdee-compile, (which is set to run th= e "javac" command per the options I set), it compiles the file, but when I = run the compiled file I get the following error: >=20 > Assuming I am compiling a file named HelloWorldSwing.java using jdee-comp= ile: >=20 > Error: A JNI error has occurred, please check your installation and try a= gain > Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloW= orldSwing has been compiled by a more recent version of the Java Runtime (c= lass file version 54.0), this version of the Java Runtime only recognizes c= lass 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:14= 2) > 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) >=20 >=20 >=20 > This error does not occur when I compile the HelloWorldSwing.java from th= e command line. I have no idea how to configure JDEE to properly compile th= e file using the same JVM as the command line. >=20 > To be clear, emacs JDEE is configured to use jdk version 1.8, the same ve= rsion jdk used at the command line. Okay, I've made a little progress here...it seems for some reason jdee is c= ompiling 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 comp= iled file using java10 via the command line. The only solution I've found a= s of now is to remove all alternate jdk's except the one I intend to use.= =20 If anyone else has some insight into why this is behaving this way, I'd app= reciate it.