Embedding perl in Java

Are there any good websites/tutorials about how to go about embedding/using perl code in Java?
How is it done?
thanks, B.

Are there any good websites/tutorials about how to go
about embedding/using perl code in Java?
How is it done?
thanks, B. Try these links:
http://www.perl.com/cs/user/query/q/6?id_topic=29
http://www.perldoc.com/perl5.6/pod/perlfaq3.html#How-can-I-compile-Perl-into-Java-

Similar Messages

  • Perl from java

    hi ..
    i want to generate a graphical report after anlysing a log file... i have parsed it with perl....but how do u get the return values into the java prog to generate the graphical report..
    pls help me... i am new to perl with java........

    How about writing the perl script such that it outputs a file of data, then write a java program that reads the data and plots it?

  • PDF Forms embedded in Webdynpro Java - Can eCATT recognize???

    Hi All,
               Will eCATT be able to identify the PDF forms embedded in Webdynpro Java applications.....
    Thanks in Advance
    Puru

    I think it will not. I am almost sure it will not. Any new complex screens are a challenge to eCATT. Flash, Flex and sometimes even trees.
    Says,
    Justin

  • Perl - c - java munmap_chunk(): invalid pointer

    I am trying to use the JNI invocation interface from within some C code which in turn is invoked from Perl (Perl -> C -> Java).
    The problem is, when the Perl process ends, i end up this:
    *** glibc detected *** /usr/bin/perl: munmap_chunk(): invalid pointer: 0xb68d3880 ***
    ======= Backtrace: =========
    /lib/i686/cmov/libc.so.6(+0x6b321)[0xb7e20321]
    /lib/i686/cmov/libc.so.6(+0x6c59e)[0xb7e2159e]
    /usr/bin/perl(perl_destruct+0x1290)[0x807dd30]
    /usr/bin/perl(main+0x95)[0x80642a5]
    /lib/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb7dcbc76]
    /usr/bin/perl[0x8064171]
    I am simply invoking this function once, which creates the JVM and later invokes DestroyJavaVM...
    static void test( void ) {
        JavaVM *jvm;
        JNIEnv *env;
        JavaVMInitArgs vm_args;
        JavaVMOption options[ 1 ];
        options[ 0 ].optionString = "-Djava.class.path=/tmp";
        vm_args.version = JNI_VERSION_1_6;
        vm_args.nOptions = 1;
        vm_args.options = options;
        vm_args.ignoreUnrecognized = 0;
        int ret = JNI_CreateJavaVM( &jvm, ( void** ) &env, &vm_args );
        if(ret < 0)
            printf("\nUnable to Launch JVM\n");
        else {
            if( (*env)->ExceptionOccurred( env ) )
               (*env)->ExceptionDescribe( env );
            (*jvm)->DestroyJavaVM( jvm );
    }Can anyone offer me any clues as to what may be happening here? I am guessing that DestroyJavaVM is not freeing the resources allocated by the JVM and this interferes with garbage collection in Perl...

    I am guessing that DestroyJavaVM is not freeing the resources allocated by the JVMThat definitely won't be it, as DestroyJavaVM() currently does nothing.
    I would take this in three steps:
    1. write a C main() that starts and stops the JVM correctly
    2. write a C test() that does nothing except get called by Perl correctly
    3. Have the test() start the JVM using the same code as at (1).
    I would also have a look at how you are building the C exe. In my experience on Windows, sharing the C RTL doesn't work in conjunction with the JVM. Some years ago I was a whizz at fixing this sort of thing but these days I just use a static library ;-)

  • Can i write on perl in java?

    can i write on perl in java?

    can i write on perl in java?Listen Sscotties, not to step on too many of your toes, but if you are going to answer the question, do it write. He did not ask how to write perl, but how to write on perl. So here is the REAL answer:
    public class IThinkThisIsHowWeWouldWritePerlInJava{
       public static void main(String []args){
         System.out.print("on perl"); // not 100% sure though, maybe someone else could help
    }

  • Embedding video in Java Application

    I'm a total newbie, trying to decide if Java is the way to go for our application.
    We want to be able to create an interactive application with buttons, drag & drop, data input fields, hot spots, etc
    AND also show video... windows format, apple format, flash format.
    We want our application to be deployable either as...
    1 - a standalone app... running on a system not on a network or the internet
    2 - a web app
    We want the video player to be embedded in the application and not launch a player in a seperate window... thus we want to maintain as much control within the confines of our application as possible.
    MY QUESTIONS:
    1 - Will the Java Media Framework allow us to embed movies in our application as described?
    2 - Is it fairly easy to code such in our Java application?
    3 - Any code snippets around?
    4 - Re: Standalone/CD distribution version: Can the JMF be installed along with the application so the client doesn't have to "go out and install more stuff" ??
    5 - Re: Web - must the user download and install more stuff... other than the Java Virtual Machine to have the JMF work on their system?
    6 - Is the JMF multi-platform... Windows, Apple, Unix/Linux, etc like the JVM ?
    thanks for any help on this. Will

    Yes all of what you require is doable in Java
    Try
    http://java.sun.com/products/java-media/jmf/2.1.1/solutions/index.html
    Check some of these samples
    Also for a web version check
    http://java.sun.com/dev/evangcentral/totallytech/jmf2.html
    (Haven't studied this myself - but should give you an idea or two)
    Platform-wise - check here
    http://java.sun.com/products/java-media/jmf/2.1.1/download.html
    In terms of CD distribution - you should be able to package most stuff into a Jar file
    Not completely sure as there are 'Windows Performance pack' downloads which I think toake advantage of native DLLs
    Have a read around the JMF Installation pages - should answer most of your questions

  • Embedding DSL in Java

    Hello everybody,
    I have developed a DSL. Now I want to embed this DSL in java.
    I am new in this concept (Embedding DSL in GPL or java).
    Is it possible?
    Can I write the code between java codes with my DSL keywords?
    Best regards
    Parisa

    On 30/06/2015 08:36, Christian Dietrich wrote:
    > you may have a look at https://github.com/LorenzoBettini/javamm as well
    Thanks for mentioning that, Christian :)
    In the near future, I'm planning to refactoring the plain expression
    part to be reusable in other DSLs.
    Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
    HOME: http://www.lorenzobettini.it
    Xtext Book:
    http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book

  • Embedding html in .java file comments

    for years now the convention has been to liberally use html in java source code comments
    to beautify javadocs. for example, i have taken this out of the source code for java.lang.System:
    * The <code>System</code> class contains several useful class fields
    * and methods. It cannot be instantiated.
    * <p>
    * Among the facilities provided by the <code>System</code> class
    * are standard input, standard output, and error output streams;
    * access to externally defined "properties"; a means of
    * loading files and libraries; and a utility method for quickly
    * copying a portion of an array.
    * @author Arthur van Hoff
    * @version 1.125, 12/03/01
    * @since JDK1.0
    the problem i see with this is that the tags must be stripped if one is producing
    documentation in formats other than html (swing doclet, or pdf doclet, or any
    application of xml).
    aren't we forever tying ourselves to html? is there any intention on the part of
    j2se/j2ee developers to discontinue this practice? i've begun working on a xul
    doclet and am having to enclose the documentation in cdata to maintain the
    validity of the document i produce (i could also just strip out the tags of course).
    thanks, eitan

    Hi Eitan,
    I see little problem as long we provide a way to
    parse whatever format is being used.
    Please take a look at the commentdom package in
    the "Doclet Refactoring Design" under "What's New"
    on the right side of the Javadoc home page:
    http://java.sun.com/j2se/javadoc/
    Here's its description:
    com.sun.tools.doclet.toolkit.util.commentdom
    DocComment to DOM Translator - Documentation comment contains embedded HTML,
    Javadoc inline tags as well as custom inline tags. This package will contain classes that will help
    generate a DOM tree for the documentation comment. This can be of great help for doclets that
    generate documentation in formats other than HTML. Such doclets don?t have to undergo the
    tedious task of parsing the documentation comments for all the tags. Doclets can then directly
    traverse the DOM tree and then convert the tags to appropriate format.
    The DOM tree will adhere to the doccomment DTD that will be published later. The DTD will
    allow required HTML tags along with their attributes as defined in HTML4.0 specifications. The
    DTD will also support Javadoc-defined inline tags as well as user-defined custom inline tags.
    We plan for the doclet toolkit other than this part to be in Tiger;
    we haven't committed dates to delivering this piece, but feel it
    would be an important part of the toolkit.
    -Doug Kramer
    Javadoc team

  • Creating an HTML page with an embedded image in JAVA

    is it possible to have a code in java that creates an HTML page,
    reads an image file and embeds this to the HTML page?
    can anyone give me a sample code? =)
    thank you very much!

    Just tried this out, and it doesn't do what I was hoping: embed the image into the HTML document as a byte stream, so that the HTML document will display the image, without a seperate file.
    When I did:
    import java.io.*;
    public class EmbeddedImageTest {
        public static void writeHTML(String htmlfile) {
            File htmf = new File(htmlfile);
            FileOutputStream fout;
            DataOutput dout;
            try {
                fout = new FileOutputStream(htmf);
                dout = new DataOutputStream(fout);
                dout.writeBytes("<html><head></head><body><img src=" +
                    "file:/C:/image.jpg></body></html>");
            catch(IOException ie) {
                ie.printStackTrace();
        public static void main(String[] args) {
            writeHTML("c:/embeddedImage.html");
    }I just got an HTML file containing "<html><head></head><body><img src=file:/C:/image.jpg></body></html>".
    I've seen images get embedded in MS Outlook HTML e-mails. Does anyone know if this is done in a standard way (ie not through some MS-proprietary way), and if it can be done with an HTML file made by Java?

  • Embedded Printer Webpage & Java Issues

    I work with many LaserJets daily and I also do a great deal of troubleshooting for them. I`ve been able to figure out or I just simply knew how to fix many of the problems our printers present. They are all very old devices. They are the following, along with the number of each that I`m responsible for:
    -HP LaserJet 4100 (12)
    -HP LaserJet 4050 (3)
    -HP LaserJet 3052 (23)
    -HP LaserJet M1522n (1)
    -HP LaserJet 1200 (1)
    -HP LaserJet 1300 (1)
    -HP Color LaserJet 4600 (4)
    -HP Color LaserJet 3700 (1)
    -HP Color LaserJet CP2025dn (1)
    -HP Color LaserJet 2605dn (1)
    It`s not a huge number of printers but there is high demand for printing and when I get calls for printers offline, it is almost always the same issue...the device has been assigned a new IP.
    Now I`m aware that setting the cinfiguration to Manual, or static, thge IP will stick to its printer and not change. I have set most of them to have a static IP but others use an old, external Jet Direct print server. You know, the kind that have the big paralell port. I can`t seem to access those device`s embedded webpages no matter what I do and I`ve done jkust about everything. I keep getting a message that says the Java plug-in needs to be updated. I updated it and nothing. Still blocks me from accessing the webpage. I need to access the webpage to more easily make changes without having to run around campus troubleshooting.
    Any idea on what could be causing the print server embedded webpage to not display? I get security warnings too, but tried alteringf those and still no luck. 
    Any help would be appreciated.

    Hello RaelS.
    To reset the EWS user name and password, you can try reset network settings to default.
    Setup - Network - Restore Network Defaults.
    Cheers!
    Wixma.
    I am an HP employee.
    Say thanks by clicking the Kudos star in the post.
    If my reply resolved your problem, please mark it as as Accepted Solution so that it can be found easier by other people.

  • How to use Embedded browser in Java using Linux Platform?(Very urgent.....)

    Hi,
    I'm trying to use the embedded browser in Linux, but it fails with the following error:
    Can't execute the native embedded browser. Error message:
    when I use it on a Windows machine, it works fine.
    i get this
    org.jdesktop.jdic.init.JdicInitException: java.lang.UnsatisfiedLinkError: no jdic in java.library.path
    at org.jdesktop.jdic.init.JdicManager.initBrowserNative(Unknown Source)
    at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
    at netsim.NetSimBasics.<init>(NetSimBasics.java:40)
    at netsim.NetSimBasics.main(NetSimBasics.java:64)
    Caused by: java.lang.UnsatisfiedLinkError: no jdic in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1030)
    at org.jdesktop.jdic.init.InitUtility.<clinit>(Unknown Source)
    ... 4 more
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no jdic in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:823)
    at java.lang.System.loadLibrary(System.java:1030)
    at org.jdesktop.jdic.browser.internal.WebBrowserUtil.<clinit>(Unknown Source)
    at org.jdesktop.jdic.browser.MsgClient.<init>(Unknown Source)
    at org.jdesktop.jdic.browser.NativeEventThread.<init>(Unknown Source)
    at org.jdesktop.jdic.browser.WebBrowser.<clinit>(Unknown Source)
    at netsim.NetSimBasics.<init>(NetSimBasics.java:40)
    at netsim.NetSimBasics.main(NetSimBasics.java:64)

    use JComboBox
    JComboBox liste = new JComboBox(new Object[]{"azerty","qwerty});the api documentation :
    http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html
    the turotial on combobox :
    http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html

  • Interacting with perl through java.

    I'm trying to do something with Java that I haven't managed to do until now. I'm trying to interact with a perl process giving him input and reading output.
    I have a perl module that has several functions and the idea is to launch a process in a java program with the following line :
    perl -e 'while(<STDIN>) { eval $_ ; }'
    and then give the process the necessary input and the read the given output.
    For instance with the above line you can do the following:
    [user@host ~]$ perl -e 'while(<STDIN>) { eval $_ ; }'
    print "Hello World\n";
    Hello World
    Here is the code I'm using:
    import java.io.BufferedReader;
    public class ExecProgram {
    private static Runtime runtime;
    private static Process process;
    public static void main(String[] args) {
         runtime = Runtime.getRuntime();
         try {
         process = runtime.exec("/usr/bin/perl -e 'while(<STDIN>) { eval $_ ; }'");
              process = runtime.exec(cmd);
         } catch (IOException e) {
              System.err.println("Error executing process");
         PrintWriter out = new PrintWriter(process.getOutputStream());
         String commandLine = "print \"Hello World\n\"";
         out.println(commandLine);
         BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
         try {
         String line;
         while ((line = in.readLine()) != null)
              System.out.println("Output: "+line);
         } catch (IOException e) {
         System.err.println("Error reading output");
    As you can see I'm using Runtime class to interact with the process but nothing happens if replace the exec line with:
    process = runtime.exec("ls");
    I can see in the output the listing of the current directory.
    Have you ever tried something like this? Is this the correct way for doing this?

    Have you ever tried something like this? I have. Here's a rough sample:
        public static void main(String[] args) throws Exception {       
            String[] cmd = new String[]{
                "/usr/bin/perl",
                "-e",
                "while(<>){ eval or die $@; }"
            final Process p = Runtime.getRuntime().exec(cmd);
            new Thread(){
                public void run(){
                    try{
                        BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
                        for(String line; (line = r.readLine()) != null; System.out.println("ProcessOUT:: "+line));
                    catch (Throwable t){
    //                    t.printStackTrace();
            }.start();
            new Thread(){
                public void run(){
                    try{
                        BufferedReader r = new BufferedReader(new InputStreamReader(p.getErrorStream()));
                        for(String line; (line = r.readLine()) != null; System.err.println("ProcessERR:: "+line));
                    catch (Throwable t){
    //                    t.printStackTrace();
            }.start();
            new Thread(){
                public void run(){
                    try{
                        OutputStream out = p.getOutputStream();
                        for(int ii = 0; ii < commands.length; ii++){
                            System.err.println("Sending command: "+commands[ii]);
                            out.write(commands[ii].getBytes());
                            out.write('\n');
                            out.flush();
                    catch (Throwable t){
    //                    t.printStackTrace();
            }.start();
            int exit = p.waitFor();
            System.err.println("Process exited with code: "+exit);
        static final String[]
            commands = {
                "print \"The road goes ever\\n\";",
                "print \"ever\\n\";",
                "print \"on.\\n\";",
                "exit 13;"
        ;

  • Perl in java

    hi guys
    is there is other way to call perl program in java without using exec command
    best regards

    Use could use JNI. You could even write a PERL interpreter in Java. I think using Runtime.exec is the best way, though (barring routes like "Don't use Java" or "Don't use PERL").

  • How to run Perl from Java

    Hi,
    I have a program written in Perl. I want to run the Perl program using Java. If there is a command which can allow me to call the perl program from Java program, please advise me.
    regards

    The most easy way is to use Runtime class to call "perl" to run your perl script.
    String sCmd = "c:\\yourPerlScriptLoc\\yourPerlScript.pl";
    Process p = Runtime.getRuntime().exec(sCmd);

  • Embedded OC4J Error : java.lang.OutOfMemoryError: PermGen space

    Hi all,
    When testing apps using embbed OC4J I experience the java.lang.OutOfMemoryError: PermGen space.
    If occur on OAS, I add :add -X:MaxPermSize=256m to the startup java options on opmn.xml, and problem solved.
    How can I set the startup jaav option for embedded OC4J ?
    Thank you,
    xtanto

    hi xtanto
    To set system properties for the embedded OC4J you could try "Project Properties" > "Run/Debug" > "Edit..." some "Run Configuration" and add your property to "Java Options" on the "Launch Settings" panel.
    success
    Jan Vervecken

Maybe you are looking for