JDK 8, lambda expressions and other features

if( ! First of all, are there plans to release JME3 SDK with JDK8? ){
Has anyone tried to run the SDK with JDK8?

Can I just plug it into JME3 SDK or it wont work?

Any good reason I should stay with JDK7?

If I move to the new netbeans (or eclipse) + JDK8, what I will loose are the management features, like assets management right? I am a lone developer, mainly a coder (a self.negation() in assets creation), so I am not sure if that will be trouble later…

Also, do you think I could run both? the JME3 SDK to assets management and other specific things, and the new netbeans+JDK8 for coding and running it all?
}

Hi,

You can use jme3 SDK with a project in jdk8 :

  • you setup SDK with
    1. use your jdk8 to launch the SDK (see Specifying the JDK location in wiki / sdk:troubleshooting
    2. register a platform in the SDK for jdk8
    3. use this platform with your project.
  • you should not use custom controller, custom savable with your asset, because assetManager will continue to run on jdk 7
  • you will not be able to use jdk8 features of the IDE (netbeans 7 doesn’t any) Editor will not help you with jdk8 new syntax.

I mainly stop using SDK with jdk8 project.

If you want to use SDK feature (Assets viewer,…) with jdk8, I suggest you to use netbeans 8, register SDK update-site, add plugins from SDK update-site.

EDIT:
There were some missing step, in my instructions. and wrong sentences. Thanks to @normen for the correction

@DavidBernard, seems plain simple! much more simple than what I was thinking to do hehe. As soon I can I will give it a try thanks!!

@DavidBernard

I cant install almost anything :frowning:
“The plugin Java SE Projects is requested in implementation version 46”

it is related to this I think: http://hub.jmonkeyengine.org/forum/topic/solved-java-lang-nosuchmethoderror-com-jme3-renderer-rendermanager-renderfv/, it was not compiled against that netbeans8 base plugin Java SE Projects.

I think it would require all that code to be compiled against the netbeans8 base plugin, and if many things changed it would be a lot of trouble… Even some plugins that look cool, like the three generator, depends on it…

I think the only way, is to deal with assets and these uninstallable plugins at JME SDK, and do the coding on netbeans8, and (I am on linux) just symlink everything I can, least the project configuration files.

I will see what happens :slight_smile:

My team uses IntelliJ Idea for coding and the SDK for assets conversion and related stuff. It works great!

The only thing that we lost was the cross compilation, because IntelliJ IDEA does not understand the netbeans specific ant build files,
but as you are using netbeans 8 you should have less problems there.

1 Like

@Zanval, were your team able to use the JME plugins (that seems only installable on the sdk) related to things like navmesh and other libs? I think, may be, we can just install all these libs apart from the SDk (and not the plugins themselves). So we would have to find and install each of the many interesting libs that are at plugins, but as normal libs, one by one, right?

I am also having a VERY HARD TIME trying to attach sources to JME3 libs to understand what is going on…, that bug may have been fixed on newer versions of it; any tip on this? :frowning: I am having to read the sources on gedit :frowning:

As a jdk8 user, use the maven repository (with gradle) to manage dependency and libs.
the maven repo include sources, so I can use Ctrl-click to see source.
Else you should clone the source repository (at the right version and use it as source folder)

repositories {
	mavenLocal()
	jcenter()
	maven { url "http://updates.jmonkeyengine.org/maven/"}
	maven { url "http://dl.bintray.com/jmonkeyengine/contrib" }
}

sourceSets.main.resources.srcDir 'src/main/java'

def v_slf4j = '1.7.7'
def v_jme3 = '3.0.10'

dependencies {
	// logging
	compile "org.slf4j:slf4j-api:${v_slf4j}"
	compile "org.slf4j:jul-to-slf4j:${v_slf4j}"
	runtime 'ch.qos.logback:logback-classic:1.1.2'

	// jme
	compile 'net.alchim31.jme3:jme3_ext_spatial_explorer:0+'
	compile 'net.alchim31.jme3:jme3_ext_remote_editor:0+'
	compile "com.jme3:jme3-core:${v_jme3}"
	compile "com.jme3:jme3-blender:${v_jme3}"
	runtime "com.jme3:jme3-desktop:${v_jme3}"
	runtime "com.jme3:jme3-lwjgl:${v_jme3}"
	runtime "com.jme3:jme3-plugins:${v_jme3}"

	//utils
	provided 'org.projectlombok:lombok:1.14.2'
	compile 'com.beust:jcommander:1.35'
	testCompile 'junit:junit:4.12'
}

I am seriously thinking on moving to eclipse,

I am experiencing a few usability issues with netbeans from the SDK, basically the docked bars like debug watch variables, console output view etc, they bother too much, show up and hide a lot, or dont hide when I want them to, or show what I dont want to see, may be I just dont know yet how to use it properly, but that is annoying me…, and I dont know if I will have same troubles with new netbeans,

do you think this could work with eclipse too?

Eclipse? Are you for real? Forget about eclipse, if you are considering to use standalone IDE, use IDEA, it’s better at everything. I’ve used eclipse for three years straight and then discovered IDEA, never had an urge to move back, really. The only purpose I’m using eclipse for is my work SWT project.

1 Like

IDE is a matter of taste and habit. I had try IDEA several times, but I prefer eclipse (quick compilation, marker in tree view,…). The important thing is to be able to use the tools that match your needs and habit.

Anyway, I created a small tool (no official announcement yet) that can help you to debug your scene (at runtime) : jme3_ext_spatial_explorer.

It creates a javafx window with scene tree, where you can plug your own commands in toolbar for scene, in popup for Spatial. It’s very basic and simple to extends.

1 Like

I won’t consider moving to IDEA until Xtend gets ported there (which should be soon hopefully). For me, programming started to be fun again thanks to it.

I’ve never heard of xtend prior to this day, I looked it up and it looks much like groovy, have you tried it?

I use IntelliJ IDEA together with Maven and JDK 8. I only ever use the SDK when I need to use any of it’s tools. I tend to make good use of the java.util.function package.

Yes, I have used groovy extensively. Unfortunately:

  • it is quite slow (used to be horribly slow, not it is just slow)
  • it has huge amount of magic happening on every step, which is very nice if you want to some heavy meta-programming, but not neccesarily when you try to understand it later
  • it has quite lose typing system; with less trivial constructs, IDEs are losing the context and you lose autocompletion/inspection which is a 100% requirement for me

Don’t get me wrong - I still use groovy for heavily specialized DSLs and interpreters, but it is not an option for me to replace java in general usage.

Xtend can be compared rather to Scala and Kotlin, not Groovy. And Scala has other issues for me, Kotlin is probably a direct IDEA alternative, but it lacks active annotations from Xtend, which is kind of killer feature for me.

1 Like

@abies
And what you think about lua?
Used in many games, have a java port, but I dont like the language syntax, looks a bit confusing…

I am still thinking on groovy, but not sure yet.

I care for making the game moddable, preferably highly moddable, even better if the engine have not to be restarted to apply scripts changes; I would like to not have to create a simple specific scripting lang to provide this feature…

EDIT: I am considering this also http://stackoverflow.com/questions/935175/convert-string-to-code

PS.offtopic: cant find where to click to reply to a post and not to the topic… the post reply buttons seems to make no diff

Reply button makes a difference - top right corner of the post shows reference to what you are replying to.

Certainly, do not try to create your own scripting language. For external scripting, groovy might be one of best options - it has very powerful DSL capabilities, can be loaded/reloaded at runtime etc. Only thing I’m slightly afraid of is security - if you have ‘trusted’ scripting it is not an issue, but if you expect people to run untrusted scripts from random sources and you want to guarantee they won’t be able to mess up things/cheat game engine, then it might be harder. This is where lua and javascript have more power - they are designed with having limited access to environment in mind.

So, my suggestion is:

  • for actual core jme3 programming - java 8, scala, xtend or kotlin
  • for scripting/prototyping/dsls from trusted sources - groovy
  • for scripting from untrusted sources, UI mods etc - lua or javascript
1 Like

If you’re looking for scripting and using Java 1.8 you could have a look at Javascript (I am) now that the new Nashorn engine is in place. It’s meant to be a lot faster than the old Rhino engine.

http://www.oracle.com/technetwork/articles/java/jf14-nashorn-2126515.html

Some performance stats available at http://java.dzone.com/articles/nashorn-new-rhino-block

1 Like

If you allow userside scripts, you should also consider any script as security thread. @Empire_Phoenix made tried to make the usage of LUA scripts more save: Hardened (LUA) Scripting useable in JME

1 Like

Using a purly interpreted language, like lua, makes it really hard to escape it.
Basically you need either:
LUA Interpreter bug that allows to run abitrary Java Bytecode (And as we are not in C this will be difficult to find, as the typical unsave pointers and array acesses do not exist)
Or
a Bug in the JVM that is triggerable by LUA code in the interpreter, + the ability to have native code as a payload.

In both cases you also need to ensure its valid lua, as else the interpreter will simply abort.

About lua itself, it is quite powerfull, dont dismiss it because it looks a bit strange.
Lua allows Procedual OO and Functional programming, and is language feature wise often more powerfull than java.

For usermods/scripting an additional benefit is, that lua is used by CryEngine, Garrysmod, Freelancer and some other games as a script basis.