I `ve heard rumors that Perl can be glued to other programming languages such as C++. I am interested how can this be done in Java, so I can use some tools from Perl I can`t normally use from Java, also, can I pack it into the jar file, so, let`s say, I can use a java program with Perl bindings on Android device?
I`d really appreciate some small examples and explanations.
Edit
Here is an example in Java with it`s defaults scripting engine(JS).
import javax.script.*; import java.io.*; class Jsc { public static void main(String[] args) { try { ScriptEngine engine = new ScriptEngineManager().getEngineByName("jav +ascript"); for ( String arg : args ) { FileReader fr = new FileReader(arg); engine.eval(fr); } } catch (IOException ioEX) { ioEX.printStackTrace(); } catch (ScriptException scrEX) { scrEX.printStackTrace(); } } //end of main } //end of class
Updated Passing a .js script file will result in executing it, also the js can interact with the program if programmed. Perl has Java modules from CPan, in Java cookbook by F.Darwin there is a topic: "Marrying Perl and Java" which gives a partial answer to my desire, but - it`s going from Perl, I need something as above code but with perls scripts so like I can program my java app with a small perl scirpt, let`s say perl script will search for files, java will read and execute them.(Just example, I won`t do exactly this).
I wonder if it can be done with Perl?
In reply to Java programming and Perl by heatblazer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |