Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Scripting language (macro) to embed into a Java desktop application

I am writing a graphics application in Java. Eventually I would like to build in a scripting language so things are programmable. Which language library do you recommend?

Likely suspects are:

  • Rhino (JavaScript)
  • JRuby (Ruby)
  • Jython (Python)

Less likely candidates are:

  • Whip up my own language using JavaCC
  • LuaJava (Lua)
  • Groovy
  • JavaFX
  • Script-Fu

The target audience are probably not hardcore programmers, so less arcane language is preferred. My guess is that JavaScript is more acceptable by them even with its quirks just because they've seen it more.

Lua seems to be popular in C/C++, but at least LuaJava requires additional .dll/.so, which makes deployment complicated.

EDIT: PhiLho wrote that there's a Java implementation of Lua called kahlua.


Related questions:

  • Which scripting language to support in an existing codebase? (in C/C++)
  • Adding Scripting functionality to .net Apps
  • What is the best scripting language to embed in a C# desktop application.
like image 263
Eugene Yokota Avatar asked Sep 27 '08 10:09

Eugene Yokota


2 Answers

if the target audience is "no programming skills...." choose jython (python) it is easy to learn. (my 7 year old daugther learned it very quick)

Bruce Eckel made a chapter with jython in "thinking in java".

at the danger getting a "down-vote" python is easier as BASIC :-)

like image 113
Blauohr Avatar answered Sep 28 '22 20:09

Blauohr


Lua is appreciated, among other things, by the simplicity of the language, making it easy to learn. LuaJava uses the original Lua implementation, making it complete, but as you point it, maybe delicate to install. I know at least a pure Java implementation of Lua: Kahlua. It is not complete (lacking coroutine support among other things, but one can do much without them) but perhaps already usable for your goal.
Unlike, say, Groovy, it shouldn't add much overhead to your application...

like image 27
PhiLho Avatar answered Sep 28 '22 18:09

PhiLho