Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import my Java packages into a js file

Tags:

javascript

I was wondering how to import my java packages into a js file and then call class methods on created object.

The reason I need to import is I wish to get data from a connection to my database, regarding dates and I have a class that lets me do so. So I need to import the Package, then create a class object, then call methods on my object.

I would appreciate your help, Thank you, John

like image 471
John Avatar asked Sep 22 '10 09:09

John


1 Answers

The questions does not specify that this is a browser-based question. Java ships with Rhino since version 6. So, on the off chance that someone wants to know how to do this - e.g., using JavaScript as a scripting language for 3rd party tools like soapUI or PTC Integrity - it's incredibly simple.

importPackage(java.io);

Check out Wikipedia:Rhino (JavaScript engine) as a good starting point.

like image 103
Scott Offen Avatar answered Oct 02 '22 21:10

Scott Offen