Closed rmalla1 closed 9 years ago
Hi Ratnakar,
We lock down the Nashorn engine and restrict access to the Java API and have no plans to change this at the moment. The purpose is to encourage only basic stubbing to be modelled, and to steer clear of over-engineering the stubs.
I see. I have a requirement to send out email, and I was thinking about using java mail api. How can I achieve this?
Hey,
Can't achieve that as it stands at the moment, you could extend the runtime yourself to enable the Java APIs and then call out to Java to achieve what you want. However that obviously won't work in the hosted product (on getsandbox.com).
Interesting require though to be able to call out to send an email, something we might consider adding in the future. What is the scenario you are testing that you want to send an email? A user sign up or something?
Yes, this is for user sign up. I will extend the runtime.
The line in question is this: https://github.com/getsandbox/sandbox/blob/master/src/main/java/com/sandbox/runtime/config/Context.java#L137
If you remove the --no-java parameter, standard Java apis should be accessible.
Hello, I would like to invoke custom Java classes within the JS file. I understand that nashorn supports calling Java APIs. My question is how can I add my custom jars to sandbox classpath? Thanks, Ratnakar