Scripting language for JVM and DVM

Asked

Viewed 146 times

2

I intend to use a scripting language attached to Java SE applications, my fear is to develop something and later have difficulties in porting it to Android platform. I am not professional in the area, but I know the importance of portability, because the mobile world today is reality for a long time, and as I sometimes do some utilities to help in some tasks of the day, I would certainly like to port them to Android (The most popular currently regarding mobile).

I saw that Google did not include the javax package and in it we have the Scriptengine. Today I researched and found an alternative, the BSF Apache. The problem is that I don’t know if this business is still in active development...

What do you suggest? I’ve never dealt with games (it’s also not my interest here), but I know that people often use Lua for scripting (to extend the functionality of apps so they don’t need to recompile all of them). And on Android, as you do?


More details

I need a scripting language because:

  • sometimes I do web scraping and need to change the code frequently;
  • I do tests with Wikipedia and claim to test algorithms to detect vandalism (often has to be updated);
  • I like to have a REPL (Read Eval Print Loop) for prototyping, etc.

Once years ago I did a test of Java SE with Rhino, using Ecmascript same, I found it cool because I could develop even a called REPL in the application, it was very good for prototyping.

  • This a bit confusing, the Scriptengine serves to run Ecmascript scripts, just import the package from Scriptengine and compile, now Lua is not to build games, it has the ability to edit some Roms games but ae is something else. If you want to create games I recommend you use a tool for this as Unity3d (supports 2d too).

  • Moon as far as I know @Guilhermenascimento is not to create games, did not say that, said it is used as scripting language. No Scriptengine in Android.

  • @Guilhermenascimento, the Scriptengine also not only serves to run Ecmascript, it runs many more languages compatible with JSR 223. See http://stackoverflow.com/a/14864450/3697611

1 answer

3


There are many languages that can be emulated in Java, but when it comes to game portability the problem goes to another level. Some examples of difference:

  • Not only will you run the same language, but you’ll need both platforms to provide access to graphic features and other game development requirements through the same API.
  • The above implies that you will not be able to use common libraries and frameworks for game development unless it is available for target platforms.
  • Differences in screen size usually require different images for each resolution.
  • The input interfaces of the devices are also quite different, for example, touch screen mouse.

In short, even if the code is 100% portable, there will still be many aspects that require two distinct implementations.

Of course the differences can be diminished by imposing some limitations on the Game, such as displaying graphics with less quality in the desktop version, but I put the points above just to try to highlight some aspects that you may be ignoring.

As for the language used, it is true that it is complicated to do **scripting on Android, but there are at least two options:

  1. Javascript in Phonegap. I have some colleagues who have created simple games using this platform. There are even a tutorial that gives some ideas. I confess that I am not user of this technology, but apparently hybrid applications can be created for mobile and desktop devices. Of course the performance of these applications will never be able to compete with native code.
  2. Java. If your focus is limited to Android and desktop with Java SE, there is no technical reason for you to need a scripting language on top. The reasons why people use Lua over C and C++ is to have a higher level language while still enjoying the high performance of those languages when needed, only Java is already higher level than those languages and easy enough to work with, while still providing reasonable performance, something like a compromise.
  • 1

    Thank you so much for the @utluiz guidelines! As for comment number 2, I need a scripting language because sometimes I do web scraping, that way it becomes much easier for example I update my scraping code by scripts because if I go by compiling at all times I would need to change my code and compile (the web pages change frequently).

  • 1

    Look, I really liked the idea of Phonegap because I played with nodejs and I thought it was cool! You know if we can use npm with this phonegap? How dependency management works?

  • 1

    @guiwp It seems that it is possible to use with npm. See http://docs.phonegap.com/getting-started/1-install-phonegap/cli/

  • 1

    Yes, it works, so I saw only be compatible with Cordova, e.g.: http://node-modules.com/search?u=cordova&q=camera+ecosystem%3Acordova .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.