| Summary: | Java 1.7 projects fail to load if a dependent library specifies 1.8 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Leo Ufimtsev <lufimtse> | ||||||||||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||||||||||
| Status: | VERIFIED WORKSFORME | QA Contact: | |||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | stephan.herrmann | ||||||||||||
| Version: | 4.8 | ||||||||||||||
| Target Milestone: | 4.8 M1 | ||||||||||||||
| Hardware: | PC | ||||||||||||||
| OS: | Mac OS X | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Bug Depends on: | |||||||||||||||
| Bug Blocks: | 519340 | ||||||||||||||
| Attachments: |
|
||||||||||||||
|
Description
Leo Ufimtsev
Created attachment 269393 [details]
Stacktrace screenshot
(In reply to Leo Ufimtsev from comment #1) > Created attachment 269393 [details] > Stacktrace screenshot Unfortunately, in this screenshot the About dialog hides the line starting "<terminated> ...", in which we'd see which JRE was used for the launch. If that launch uses a JRE 1.7, failing to load a Java-8-compiled class is totally expected. Question: how did you launch on Linux? So, the interesting part is not the compiler compliance, but the JRE configured for run/debug. Created attachment 269404 [details]
screenshot showing jdk
Created attachment 269406 [details]
screenshot showing jdk on Linux
Attaching console screenshot from mac and linux. Interestingly, on Linux it shows 1.8, but on Mac it shows 1.7. Hmmm, not sure, but on Win/Linux, the mechanism is smart enough to launch java 8 if there is a java 8 dependency somewhere, where as on Mac it seems to launch the jvm that is specified in the project. I'm not sure if this is specific to eclipse or java on OS X thou? Leo, what JREs have you registered in Preferences > Java > Installed JREs? Which JRE is used to run Eclipse on the different platforms? Created attachment 269411 [details]
Screenshot of JREs OSX(left), Linux(right)
On both my OSX and Linux I have 1.8. See screenshot.
Thoughts?
Created attachment 269413 [details]
Project
I'm attaching an example project so you can reproduce issue locally easier.
Extract it and import it into your workspace, then try to run the only .java file in the project. You will see it fails on OSX. If you increase JRE to 1.8 in project setting, it works.
Let me know if I can help further.
(In reply to Leo Ufimtsev from comment #7) > Created attachment 269411 [details] > Screenshot of JREs OSX(left), Linux(right) > > On both my OSX and Linux I have 1.8. See screenshot. > > Thoughts? Yep, this explains: On Linux you have *only* 1.8, so whatever the project says, debug can only use this one JRE and everything works - *accidentally*. On MacOS you have both 1.7 & 1.8 so the project setting of 1.7 tells JDT to associate the 1.7 JRE to that project, both for compiling and running. If you want to keep the project at 1.7 you need to update your launch configuration to explicitly select the 1.8 JRE. Ah, I see. Interesting. Thank you for figuring this one out. If I remove the unchecked 1.7 on OSX, then it works. Verified for 4.8 M1 using I20170731-2000 build |