Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reference javax.script.ScriptEngine in android or evaluate a javascript expression

Is it possible to reference the javax.script.ScriptEngine library when developing an android application? If not is there anyway possible to evaluate a javascript expression in android?

like image 610
Tawani Avatar asked Sep 21 '09 13:09

Tawani


People also ask

What is javax Script ScriptEngine?

ScriptEngine is the fundamental interface whose methods must be fully functional in every implementation of this specification. These methods provide basic scripting functionality. Applications written to this simple interface are expected to work with minimal modifications in every implementation.

Can I run JavaScript on Android?

Introduction. Javascript works on android by default, but if you have turned it off then you can follow these instructions to enable javascript on android phones.


1 Answers

According to this post, javax.script.ScriptEngine is not available in Android SDK. You can try the steps below to include the library, but the code may not run, even though it will compile.

Using Android Development Toolkit in Windows, I performed the following steps to get javax.script library.

  1. Right-clicked on the project, went to Properties (Project).
  2. Under the Java Build Path, I chose Libraries tab.
  3. Select Add Library located on the middle right of the Tab
  4. Select JRE System Library under Add Library and click Next...
  5. Select Workspace Default JRE (jre 7)
  6. Click Finish.
  7. Click Ok on the Java Build Path to exist project properties.

Javax.script was then loaded.

like image 123
John Avatar answered Oct 05 '22 23:10

John