caoccao / GraalJS-vs-Javet-vs-Nashorn

A simple performance comparison of GraalJS, Javet and Nashorn.
https://www.caoccao.com/Javet/
Apache License 2.0
4 stars 0 forks source link

How to call java Class from javascript without preinjection ? #3

Closed changkejun closed 2 months ago

changkejun commented 2 months ago

At nashorn, I can call java from javascript like the next sample. Any java class can be called with the "Packages" or "java" keyword. At the sample, FileInputStream and FileManager are java class.

var br = new java.io.FileInputStream(Packages.efw.file.FileManager.get(this._path));

At javet, I know I can inject a class in java and use it in javascript. https://www.caoccao.com/Javet/tutorial/advanced/java_and_javascript_interop.html

At javet, is there a way to call any java class from javascript like in nashorn?