angellus Posted April 13, 2015 Share Posted April 13, 2015 This is not an issue that is directly related to Forge, but it is something someone here might be able to help me with. When we updated our mod to 1.7.10, we noticed some people started having issues with running our content scripts which we use for mob drops and some other things. Well, now, it is happening to everything. I am pretty sure now that everyone is on Java 8, it does not work for anyone. It does not even work in our dev environment anymore for intelliJ. This is the code that is messing up and it seems that it is a pretty standard way of doing things. "getEngineByName" is returning null which is only support to happen if that Engine does not exist. Except JavaScript should exist. import javax.script.*; new ScriptEngineManager().getEngineByName("JavaScript"); UPDATE: After a lot more research, it looks like in Java 8 that nashorn.jar, which contains the JavaScript engine, is a Java Extension and it is not being loaded by the Minecraft Launcher. Does anyone know how to force load this extension using either Gradle or the code or something else? The mod is being built with JDK8 targeting JRE 8. If I load it inside of IntelliJ it all works fine, it is simply because the extension is not being loaded by the launcher. Quote Link to comment Share on other sites More sharing options...
angellus Posted April 13, 2015 Author Share Posted April 13, 2015 Java 8 targeting 7. Quote Link to comment Share on other sites More sharing options...
larsgerrits Posted April 13, 2015 Share Posted April 13, 2015 Try targeting Java 8. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/ Link to comment Share on other sites More sharing options...
angellus Posted April 13, 2015 Author Share Posted April 13, 2015 It looks like it is a classpath issue. It was not set up right. I finally got it working now though. Thanks guys! Quote Link to comment Share on other sites More sharing options...
angellus Posted April 14, 2015 Author Share Posted April 14, 2015 Updated OP. Quote Link to comment Share on other sites More sharing options...
angellus Posted April 14, 2015 Author Share Posted April 14, 2015 Yeah, nashorn is definitely there. I am pretty sure the Minecraft launcher it just not loading it. I know you can do classpath injection, but I do not really know how. Can I force Java to load it somehow? Quote Link to comment Share on other sites More sharing options...
angellus Posted April 14, 2015 Author Share Posted April 14, 2015 For IntelliJ? No. It is just there. It should just be there. Quote Link to comment Share on other sites More sharing options...
angellus Posted April 15, 2015 Author Share Posted April 15, 2015 It looks like it might be modloader that is causing the issue. The following code works in Java 7 in both IntelliJ AND Minecraft, whereas in Java 8, it only works in IntelliJ import javax.script.*; new ScriptEngineManager().getEngineByName("JavaScript"); However, if I tell ScriptEngineManager to use the Forge Mod Loader, it only works in Java 7 and no longer in Java 8 at all. import cpw.mods.fml.common.Loader; import javax.script.*; new ScriptEngineManager(Loader.instance().getModClassLoader()).getEngineByName("JavaScript"); In Java 7, rhino.jar is located inside of JRE\lib, in Java 8, nashorn.jar is located in JRE\lib\ext. It looks like Forge is not loading the Java extension Jars. Quote Link to comment Share on other sites More sharing options...
angellus Posted April 15, 2015 Author Share Posted April 15, 2015 In that case, is it possible to get Forge to load a jar from a Maven repo if it cannot find it? i.e. Can I upload and host a copy of rhino.jar that it needs to use Rhino and make it so Forge will download and use it if it is on Java 8+? Quote Link to comment Share on other sites More sharing options...
angellus Posted April 15, 2015 Author Share Posted April 15, 2015 I just determined it is not. Forge is not loading it. Nashorn is a Java Extension and it is not loading it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.