简体   繁体   English

带有JDK 8的JMonkeyEngine

[英]JMonkeyEngine with JDK 8

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. 我想使用lambda表达式,所以我需要JDK8。我已经在属性中将项目设置为JDK 8,但是当我使用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) 尝试构建时,它会给出如下错误: 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) 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? 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)那么如何设置在JDK 8上运行的JMonkeyEngine? Thanks. 谢谢。

I wasn't able to get Java 8 to work within the JMonkey IDE. 我无法使Java 8在JMonkey IDE中工作。 However I was able to do it the other way round; 但是我还是可以做到的。 add JMonkey libraries to Netbeans 8. 将JMonkey库添加到Netbeans 8。

Then you follow the instructions for adding JMonkey as a library to annother IDE . 然后,按照说明将JMonkey作为库添加到另一个IDE中 The instructions are for eclipse (as JMonkey IDE is based on Netbeans it would normally make no sense to do this). 这些说明适用于Eclipse(由于JMonkey IDE基于Netbeans,因此通常没有任何意义)。

  • Download the most recent build of JMonkey 下载最新版本的JMonkey
  • Unzip and save in your user directory 解压缩并保存在用户目录中
  • Open Netbeans 8 打开Netbeans 8
  • Either open an existing JMonkey project or Start a new project 打开现有的JMonkey项目或开始一个新项目

  • Open the project properties 打开项目属性

    在此处输入图片说明

  • Select to add JARs 选择添加JAR

    在此处输入图片说明

  • Browse to where you saved the JMonkey build and open the lib folder 浏览到保存JMonkey构建的位置,然后打开lib文件夹

    在此处输入图片说明

  • 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; 现在,可以在Netbeans 8中使用Java 8代码创建一个JMonkey程序。 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. 资产文件夹可能仍会丢失。如果您打开了一个现有项目,则可能会存在该文件夹。同样,我们遵循Eclipse中的“设置JME3”中的类似说明但在netbeans中可以说很容易。 Its pretty much identical to adding the JARs so I won't include screenshots. 它与添加JAR几乎相同,因此我将不包括屏幕截图。

  • Open the project properties (again) 再次打开项目属性
  • Open the libraries tab 打开库标签
  • Click add JAR/Folder 点击添加JAR /文件夹
  • Browse to assets folder 浏览到资产文件夹
  • Click open 点击打开

Now you can run your project just as within the JMonkey IDE, using AssetManager to load assets. 现在,您可以像在JMonkey IDE中一样运行项目,使用AssetManager加载资产。 Of course you won't have all the nice JME specific features of JMonkey IDE. 当然,您不会拥有JMonkey IDE的所有出色的JME特定功能。

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) JMonkey尚未在Java 8上经过测试 ,我有一个基本程序可以运行,但这不能保证使用更复杂的程序就能成功 (也就是说,我现在已经使用该技术将我的500类游戏迁移为零问题;我喜欢Java)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM