Packages

A. Sundararajan sundararajan.athijegannathan at oracle.com
Mon May 13 08:11:25 PDT 2013


Hi

     const android = Packages.android

does not work with nashorn. But the following should work:

     var android = Packages.android

You can still use "Packages.android" after defining the above. Not sure 
of the "conflict" that you mention.

-Sundar

On Monday 13 May 2013 05:31 PM, frank.westlake at gmail.com wrote:
> If Nashorn doesn't already have this ability please consider making 
> 'Packages' configurable -- perhaps by a system property. My hope is 
> that I can add 'android' to the list so that I can use it without it 
> being prefixed with 'Packages'. For example:
>
>  // In the host application:
>  java.lang.System.setProperty(keyAdditionalPackages, "android, js");
>
>  // In the script:
>  var x=android.content.Intent.ACTION_SCREEN_OFF;
>
> In the past I have done the following, but it produced conflicts so I 
> have abandoned it:
>
>  // In the script:
>  const android=Packages.android;
>  var x=android.content.Intent.ACTION_SCREEN_OFF;
>
>  // Conflicts with:
>  // var y=Packages.android.content.Intent.ACTION_SCREEN_ON;
>
> I apologize if this is already available -- I am not a programmer.
>
> Frank



More information about the nashorn-dev mailing list