Go to Post Save the frustration for build season. :p - Brian C [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-01-2015, 14:08
michaelwm's Avatar
michaelwm michaelwm is offline
Integrated Systems Lead
AKA: Michael Midura
FRC #4976 (Rebel Robotics)
Team Role: Programmer
 
Join Date: Dec 2013
Rookie Year: 2010
Location: Georgetown
Posts: 23
michaelwm is a jewel in the roughmichaelwm is a jewel in the roughmichaelwm is a jewel in the roughmichaelwm is a jewel in the rough
nashorn Script Engine NullPointerException

Hello! Our team is trying to use Java 8s new nashorn engine on the new roboRIO, as it runs Java 8. However, we have encountered a NullPointerException every time we call new ScriptEngineManager().getEngineByName("nashorn"). After a little debugging, we know it is the method getEngineByName that is returning null. We have tried rhino, simply getting every javascript engine, but we keep getting returned null. Is this a problem with the fact the roboRIO is running an embedded version of Java 8? Can another team try this?
__________________
Integrated Systems
Reply With Quote
  #2   Spotlight this post!  
Unread 20-01-2015, 15:44
fsilberberg fsilberberg is offline
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 146
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
Re: nashorn Script Engine NullPointerException

Quote:
Originally Posted by michaelwm View Post
Is this a problem with the fact the roboRIO is running an embedded version of Java 8?
Correct. You can take a look at the API's included in our profile for the JRE here: http://www.oracle.com/technetwork/ja...w-2157132.html. We use the compact 2 profile when creating the JRE. If you need to use Nashorn, you can create your own JRE and install it in /usr/local/frc/JRE. Take a look here for stuff about creating custom JREs: http://docs.oracle.com/javase/8/embe...e.htm#A1161602. We use the following options when running JRECreate:
Code:
private static String[] JRE_CREATE_COMMAND = {"java",
            "-jar",
            "", // This is the JRECreate jar location
            "--dest", "JRE", // This is the folder that you need to put in /usr/local/frc
            "--profile", "compact2",
            "--vm", "client",
            "--keep-debug-info",
            "--debug"
};
Reply With Quote
  #3   Spotlight this post!  
Unread 20-01-2015, 22:02
Qormix Qormix is offline
Programming Captain
AKA: Marc Levesque
FRC #4976 (Rebel Robotics)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Canada
Posts: 9
Qormix is an unknown quantity at this point
Re: fsilberberg

Thanks for the documentation I was able to create a jre haven't tested it on the RoboRio yet.

I have another question. Is this legal for competition? I don't want to ruin the spirit of FIRST

hears what I added

Code:
private static String[] JRE_CREATE_COMMAND = {"java",
            "-jar",
            "", // This is the JRECreate jar location
            "--dest", "JRE", // This is the folder that you need to put in /usr/local/frc
            "--profile", "compact2",
            "--vm", "client",
            "--keep-debug-info",
            "--debug"
            "--extension", "nashorn"
};
__________________
Team 4976
-------------------------------------------
Marc Levesque - Programmer

Last edited by Qormix : 21-01-2015 at 10:54.
Reply With Quote
  #4   Spotlight this post!  
Unread 20-01-2015, 22:10
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: fsilberberg

Quote:
Originally Posted by Qormix View Post
Thanks for the documentation I was able to create a jre haven't tested it on the RoboRio yet.

I have another question. Is this legal for competition? I don't want to ruin the spearit of FIRST

hears what I added

Code:
private static String[] JRE_CREATE_COMMAND = {"java",
            "-jar",
            "", // This is the JRECreate jar location
            "--dest", "JRE", // This is the folder that you need to put in /usr/local/frc
            "--profile", "compact2",
            "--vm", "client",
            "--keep-debug-info",
            "--debug"
            "--extension", "nashorn"
};
"spearit"....

This should be totally legal for FIRST. The Linux kernel on the roboRIO is simply an interface to the FPGA, the important stuff (sending PWM signals, etc) is done outside of the power of the kernel.

The spirit* of FIRST is to inspire technology, learning how to embed java runtimes on linux kernels is certainly inspiring
Reply With Quote
  #5   Spotlight this post!  
Unread 21-01-2015, 08:20
fsilberberg fsilberberg is offline
WPILib Developer
AKA: Fred Silberberg
FRC #0190
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Redmond
Posts: 146
fsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura aboutfsilberberg has a spectacular aura about
Re: fsilberberg

Quote:
Originally Posted by Qormix View Post
Thanks for the documentation I was able to create a jre haven't tested it on the RoboRio yet.

I have another question. Is this legal for competition? I don't want to ruin the spearit of FIRST

hears what I added

Code:
private static String[] JRE_CREATE_COMMAND = {"java",
            "-jar",
            "", // This is the JRECreate jar location
            "--dest", "JRE", // This is the folder that you need to put in /usr/local/frc
            "--profile", "compact2",
            "--vm", "client",
            "--keep-debug-info",
            "--debug"
            "--extension", "nashorn"
};
As far as I am aware, it should be legal. One thing you'll need to be careful of, though, is memory usage. One problem we had when we first started experimenting with java (this was before java 8 was out) was that the jvm used too much memory and crashed on startup. I'm not saying that it will for you, and we haven't seen this issue since we upgraded to java 8, just be aware of it.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 23:02.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi