tweaking your script engine for Java 8

I may be doing something wrong, but after the switch to Java 8, scripts load extremely slowly (startup can take up to 5 minutes with around 20 scripts). I tried both OP's method as well as the engine.eval before calling the script, and I can only conclude that mozilla_compat is not a good workaround.

Had the same thing too. In fact scripts would start nicely as usual, but end up running slower and slower. Used a different method than the one here, but was disappointed this method doesn't work either.
 
Remember that you will also have to replace every occurrence of
importPackage(
with
importPackage(Packages.

in your scripts folder, otherwise your scripts won't work
 

Well, I had to. I dunno what source you're using (I was messing with ThePack), but even with the nashorn compatibility mode thing, importPackage could not find the net package, so I referred all imports to the Packages object which fixed the issue and the server now runs flawlessly on java 8.
 
You can probably simply do

Code:
                engine.eval("load('nashorn:mozilla_compat.js');");
Before loading the script file.

However search/replace seems like a much better idea as it does not **** with line numbers in the script.

Also: I don't get the Groovy fandom but whatever. Scala is a very solid JVM language though.
I know this is a REALLY old post but people probably still use this fix, this line here actually fixes it.
 
For those who are willing to use JDK 8, I will highly suggest to move to Rhino from Mozilla.

Nashorn is not the best tool for scripting in Maple Story, since it does not support pause/resume natively.

Thus, with Rhino you could easily implement common BMS methods like self.say, self.askAcceptDecline, askYesNo.
 
Back