Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

How to connect Java and Perl ?

Thread view: 
seenuvas - 24 Jan 2006 12:40 GMT
How to connect java and perl languages?

Notify the links which provides java and perl connectivity.

By
Seenu
opalpa@gmail.com opalinski from opalpaweb - 24 Jan 2006 12:55 GMT
How about executing one from the the other?

Opalinski
opalpa@gmail.com
http://www.geocities.com/opalpaweb/
Roedy Green - 24 Jan 2006 19:06 GMT
On 24 Jan 2006 04:55:01 -0800, "opalpa@gmail.com opalinski from
opalpaweb" <opalpa@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>How about executing one from the the other?

There are two approaches:

1. exec. java spawn perl which runs independently communication by the
command line parms and files left lying about.
See http://mindprod.com/jgloss/exec.html

2. JNI. Java calls C/C++. The you solve the problem of having C/C++
talk to Perl.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Jeffrey Schwab - 24 Jan 2006 13:03 GMT
> How to connect java and perl languages?
>
> Notify the links which provides java and perl connectivity.

What are you trying to do?
Chris Uppal - 24 Jan 2006 13:55 GMT
> How to connect java and perl languages?

You'll have to give more information.  There are many ways that a Perl and Java
can be connected, and which to use depends on what you want to do.

   -- chris
Stefan Schulz - 24 Jan 2006 16:17 GMT
I may not be the OP, but this topic does interest me. Is there any easy
way to call a perl script, giving it some string as input? (Without
resorting to Runtime.exec())

Now, if that is possible, how about calling a perl function directly
from java?

And if that is possible, finally how about allowing perl functions
called from java to make callbacks into java?

Is there any solution to the later 2 problems (the first could be
"solved" by just executing the interpreter, but i am looking for some
scripting language to embed in an application)
Juha Laiho - 24 Jan 2006 16:25 GMT
"Stefan Schulz" <schulz.stefan@gmail.com> said:
>I may not be the OP, but this topic does interest me. Is there any easy
>way to call a perl script, giving it some string as input? (Without
[quoted text clipped - 9 lines]
>"solved" by just executing the interpreter, but i am looking for some
>scripting language to embed in an application)

I haven't seen Java and Perl bridged anywhere, but if your need is just
"a scripting language embeddable in Java", you could take a look
at Jython - this should provide for both of your examples above.
Signature

Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
        PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

IchBin - 24 Jan 2006 19:09 GMT
> I may not be the OP, but this topic does interest me. Is there any easy
> way to call a perl script, giving it some string as input? (Without
[quoted text clipped - 9 lines]
> "solved" by just executing the interpreter, but i am looking for some
> scripting language to embed in an application)

How about:
 retVal = (String) xmlrpc.execute( methodName, params );

"Call Perl routines from Java, Use XML-RPC to call Perl routines from
your Java code"
http://www.javaworld.com/javaworld/jw-10-2004/jw-1011-xmlrpc.html

or

" Write CGI programs in Java, Learn how to program the server side of
your Web applications through Java"
http://www.javaworld.com/javaworld/jw-01-1997/jw-01-cgiscripts.html

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Rogan Dawes - 25 Jan 2006 15:38 GMT
> I may not be the OP, but this topic does interest me. Is there any easy
> way to call a perl script, giving it some string as input? (Without
[quoted text clipped - 9 lines]
> "solved" by just executing the interpreter, but i am looking for some
> scripting language to embed in an application)

Try looking at Apache Bean Scripting Framework, which supports BeanShell
(very Java like), Jython (Python in Java), Groovy, Jacl (Tcl in Java),
Rexx, etc

Using BSF allows the user to choose which scripting language they prefer
to use.

You can always provide a preferred language with your distro . . .

Rogan
Chris Uppal - 25 Jan 2006 16:06 GMT
> Try looking at Apache Bean Scripting Framework, which supports BeanShell
> (very Java like), Jython (Python in Java), Groovy, Jacl (Tcl in Java),
> Rexx, etc

That sounds good.  I hadn't heard of it before.

Saves me the effort of replying to Stefan too (I was just about to do so ;-)

BTW, an interesting example of using Jython as the scripting languager
(directly, not via the Apache framework) is GUESS ("The Graph Exploration
System"):

   http://graphexploration.cond.org/

   -- chris
seenuvas - 25 Jan 2006 05:43 GMT
In my project, for one of my module i implemented in java other three
modules i have implemented in perl..

So i have to run the module developed in java from perl programming..
Is it possible? Kindly reply..
IchBin - 25 Jan 2006 06:54 GMT
> In my project, for one of my module i implemented in java other three
> modules i have implemented in perl..
>
>  So i have to run the module developed in java from perl programming..
> Is it possible? Kindly reply..

There is a tutorial that talks about invoking Java from Perl and Perl
from Java here..

http://www.sunsite.ualberta.ca/Documentation/Misc/perl-5.6.1/jpl/docs/Tutorial.html

I do not work with perl all that much but there is a open source project
on Sourceforge call "Inline". This lets you code Java inline in a perl
script. Looks like the same idea as writing inline asem in C.

http://inline.perl.org/java/home.html

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Roedy Green - 25 Jan 2006 07:16 GMT
> So i have to run the module developed in java from perl programming..
>Is it possible? Kindly reply..

I have already answered what your options are. It really depends on
what the modules do and how much the interact whether what you propose
to do is feasible. If there were all three batch processes that read a
file and write a file there would be no problem at all, for example.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Jeffrey Schwab - 25 Jan 2006 13:54 GMT
> In my project, for one of my module i implemented in java other three
> modules i have implemented in perl..
>
>  So i have to run the module developed in java from perl programming..
> Is it possible? Kindly reply..

Double-ended pipes are easy to open in Perl.  If you just occasionally
need to grab some output, try system() or backticks.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.