how to access methods from my class inside javascript in Nashorn
In Nashorn it is possible to access predefined classes of java , var ArrayList = Java.type('java.util.ArrayList'); var list = new ArrayList(); list.add('a'); list.add('b'); list.add('c'); Like wise it is possible to access my classes in java script , If so how can it be done and should i be adding my jar in the classpath for referencing it ???? var ArrayList = Java.type('com.example.exa'); You must use the -classpath option of jrunscript or jjs . -cp, -classpath (-cp path. Specify where to find user class files.) The Java class: package de.lhorn.so; public class Foo { public final static int