all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Any JDEE experts here? Need help compiling files.
@ 2018-06-02 18:22 Carlo Tambuatco
  2018-06-03 13:48 ` Carlo Tambuatco
  0 siblings, 1 reply; 2+ messages in thread
From: Carlo Tambuatco @ 2018-06-02 18:22 UTC (permalink / raw
  To: help-gnu-emacs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Any JDEE experts here? Need help compiling files.
  2018-06-02 18:22 Any JDEE experts here? Need help compiling files Carlo Tambuatco
@ 2018-06-03 13:48 ` Carlo Tambuatco
  0 siblings, 0 replies; 2+ messages in thread
From: Carlo Tambuatco @ 2018-06-03 13:48 UTC (permalink / raw
  To: help-gnu-emacs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-03 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 18:22 Any JDEE experts here? Need help compiling files Carlo Tambuatco
2018-06-03 13:48 ` Carlo Tambuatco

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.