hi, i need to add a script function like NativeBoolean written in nashorn 
jdk.nashorn.internal.objects; package , to javascript context.let say my 
function is ContextifyImpl.it work just fine when i added that ContextifyImpl 
class to jdk.nashorn.internal.objects package.i configure nasgen tool to 
generate $Constructor and $Prototype  and when i added my ContextifyImpl class 
to my own package let say jdk.nashorn.internal.Dilan it giving me error as 
follow.
Exception in thread "main" java.lang.IllegalAccessError: tried to access method 
jdk.nashorn.internal.objects.ScriptFunctionImpl.<init>(Ljava/lang/String;Ljava/lang/invoke/MethodHandle;Ljdk/nashorn/internal/runtime/PropertyMap;[Ljava/lang/invoke/MethodHandle;)V
 from class jdk.nashorn.internal.Dilan.ContextifyImpl$Constructor   at 
jdk.nashorn.internal.Dilan.ContextifyImpl$Constructor.<init>(Unknown Source) at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
 at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:414)      at 
java.lang.Class.newInstance(Class.java:432)  at 
jdk.nashorn.internal.Dilan.contextify.initConstructors(contextify.java:70)   at 
jdk.nashorn.internal.Dilan.contextify.makeContextImpl(contextify.java:54)    at 
jdk.nashorn.internal.Dilan.contextify.makeContext(contextify.java:110)       at 
jdk.nashorn.internal.scripts.Script$buddhi.runScript(/home/buddhi/Desktop/buddhi.js:4)
       at 
jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:518)
  at 
jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:204)  at 
jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:365)     at 
jdk.nashorn.tools.Shell.apply(Shell.java:373)        at 
jdk.nashorn.tools.Shell.runScripts(Shell.java:302)   at 
jdk.nashorn.tools.Shell.run(Shell.java:166)  at 
jdk.nashorn.tools.Shell.main(Shell.java:130) at 
jdk.nashorn.tools.Shell.main(Shell.java:109) i need to send a javascript 
function to javascript exection environment which is written inside my own 
package.in my projecr consider nashorn is an dependancy.for sake of 
maintainability i need to place all my code in my own package not in  nashorn 
packages.how could i do that thank.
if u can please send me the proper way to configure javascript function using 
nashorn
thanks and best regards                                           

Reply via email to