I want to use lambda expressions, so i need JDK 8. I have set the project to JDK 8, in properties, but editor of the code gives errors when i use lambda. When trying to build it gives error like this:
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Test.java:17: error: lambda expressions are not supported in -source 1.7
Runnable r = () -> System.out.println();
(use -source 8 or higher to enable lambda expressions)
So how to set JMonkeyEngine working on JDK 8?
Thanks.

- 127,867
- 37
- 205
- 259

- 73
- 2
- 7
-
Why are you using the `-source 1.7` option when compiling your code? Are you using an IDE? Then configure it so that it regards your code as Java 8 code. – Jesper Mar 24 '14 at 13:58
-
Welcome to StackOverflow. To add to what @Jesper said, please edit your question to give us more details. How are you compiling your code? Are you using an IDE or a build tool such as Maven or Gradle? The "-source 1.7" setting is coming from somewhere, and that is causing your problem. – Richard Neish Mar 24 '14 at 14:08
-
The tangetial discussion on [this JMonkey thread](http://hub.jmonkeyengine.org/forum/topic/include-last-updated-date-on-the-download-page/) discusses using Java 8 with JMonkey - basically not available officially but may be possible by manually changing the JDK in the jmonkeyplatform.conf file – Richard Tingle Mar 29 '14 at 15:09
1 Answers
I wasn't able to get Java 8 to work within the JMonkey IDE. However I was able to do it the other way round; add JMonkey libraries to Netbeans 8.
- Install Netbeans 8
Then you follow the instructions for adding JMonkey as a library to annother IDE. The instructions are for eclipse (as JMonkey IDE is based on Netbeans it would normally make no sense to do this).
Unzip and save in your user directory
Open Netbeans 8
Either open an existing JMonkey project or Start a new project
Open the project properties
Select to add JARs
Browse to where you saved the JMonkey build and open the lib folder
Select all the libraries and add them
At this point it is now possible to create a JMonkey program using Java 8 code within Netbeans 8. However; the assets folder may still be missing, If you opened an existing project it will likely be there otherwise, again, we follow similar instructions within Setting up JME3 in Eclipse but its arguably easier in netbeans. Its pretty much identical to adding the JARs so I won't include screenshots.
- Open the project properties (again)
- Open the libraries tab
- Click add JAR/Folder
- Browse to assets folder
- Click open
Now you can run your project just as within the JMonkey IDE, using AssetManager
to load assets. Of course you won't have all the nice JME specific features of JMonkey IDE.
Note; JMonkey is untested with Java 8, I got a basic program to run, this does not guarantee success with a more complex program (That said I have now used this technique to move my 500 class game across with zero issues; I love java)

- 1
- 1

- 16,906
- 5
- 52
- 77