Accessing Java Classes
Attila Szegedi
szegedia at gmail.com
Wed Nov 9 12:59:37 UTC 2022
How is it not working? What is the exception you’re getting?
> On 2022. Nov 9., at 11:48, Simon Besenbäck <simon.besenbaeck at gmail.com> wrote:
>
> You should be able to create Java classes in Nashorn like this:
>
> var HashMap = Java.type("java.util.HashMap")
> var mapDef = new HashMap()
> var map100 = new HashMap(100)
> source: https://docs.oracle.com/javase/9/nashorn/nashorn-java-api.htm#JSNUG115 <https://docs.oracle.com/javase/9/nashorn/nashorn-java-api.htm#JSNUG115>
> However when I try to use the jakarta.servlet.http.Cookie class it does not work.
>
> My Code:
>
> var Cookie = Java.type("jakarta.servlet.http.Cookie");
> var newCookie = new Cookie("lastVisit", "Test");
> Does anyone know why this is not working or what I`m doing wrong?
>
> Best Regards
> Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/nashorn-dev/attachments/20221109/571f6fa7/attachment-0001.htm>
More information about the nashorn-dev
mailing list