add a own ScriptFunction to the nashorn global

buddhi mihara buddhi.mihara at
Wed Dec 4 21:43:33 PST 2013

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 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(	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(	at java.lang.reflect.Constructor.newInstance(	at java.lang.Class.newInstance(	at jdk.nashorn.internal.Dilan.contextify.initConstructors(	at jdk.nashorn.internal.Dilan.contextify.makeContextImpl(	at jdk.nashorn.internal.Dilan.contextify.makeContext(	at jdk.nashorn.internal.scripts.Script$buddhi.runScript(/home/buddhi/Desktop/buddhi.js:4)	at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(	at jdk.nashorn.internal.runtime.ScriptFunction.invoke(	at jdk.nashorn.internal.runtime.ScriptRuntime.apply(	at	at	at	at	at i need to send a javascript function to javascript exection environment which is written inside my own 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 could i do that thank.
if u can please send me the proper way to configure javascript function using nashorn
thanks and best regards 		 	   		  

More information about the nashorn-dev mailing list