Skip navigation

Tag Archives: helma

Ecco come far convivere i due nostri amici.

to be continue….

Annunci

Sempre piĆ¹ linguaggio a tutti gli effetti.
JSLIBS “a standalone JavaScript development runtime environment for using JavaScript as a general-purpose scripting language…..Some of these modules are simple wrappers for familiar libraries such as: zlib, SQLite, FastCGI, NSPR (Netscape Portable Runtime) , ODE (Open Dynamics Engine) , libpng, libjpeg, librsvg, SDL, libiconv, OpenGL, OpenAL, ogg vorbis, libTomCrypt, libffi (Foreign function interface) , …”, basato su SpiderMonkey

Un web application server, Helma, ecco le sue caratteristiche principali

Il mio primo esperimento di integrazione di Java e Javascript sotto Helma:
La classe Java che lancia un semplice “ls”:
import java.io.*;
public class ExecTest
{
public static void main(String [] args)
{
try {
String params[] = { "ls"};
Process pinger = Runtime.getRuntime().exec(params);
BufferedReader reader = new BufferedReader(new InputStreamReader(pinger.getInputStream()));
String lineRead = null;
while((lineRead = reader.readLine()) != null)
{
System.out.println(lineRead); //You can send output from here to a GUI display if needed
}
}catch(Exception e)
{
e.printStackTrace();
}
}
}

Ed una pagina per Helma che fa la stessa cosa:
var command = new java.lang.String("ls -l");
var proc = java.lang.Runtime.getRuntime().exec(command);
var reader = new java.io.BufferedReader( new java.io.InputStreamReader(proc.getInputStream()));
var str = reader.readLine();
res.data.title = str;
renderSkin("html");

GO JAVASCRIPT!! GOOOOOOO