Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-29-2008, 03:42 PM
Member
 
Join Date: Dec 2007
Posts: 19
JavaEmpires is on a distinguished road
[B] How to call Perl script from Java [/B]
Hi all,
Can anyone tell me how to call Perl scripts in Java?
I googled for a long time and came to know about JPL...what it is and how to use it? . Is there any alternative to JPL?
In most of the tutorials I saw the perl scripts were embeded into java class. wat if the script written in another file to be used?

Please try to guide me. Its urgent. If possible try to provide a working example.


Thanks in advance.

Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-29-2008, 03:46 PM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Calling perl script means executing perl script?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-29-2008, 06:21 PM
Member
 
Join Date: Dec 2007
Posts: 19
JavaEmpires is on a distinguished road
:-) I am not aware of perl at all so fell short of proper words....

I wanted to ask, how to execute perl scripts and how to call perl modules from Java.... Hope i have used proper words :-)

Actually I want to call perl modules as if they were java methods so that i can pass or return data types.

When I googled I got something called as JPL and Inline::Java..
JPL works on UNIX platforms but Inline::Java on windows as well... I tried to install Inline::Java but couldnt succeed.

If you could help me to solve my problem I would be thankful to u. and its really urgent.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-30-2008, 06:06 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Hmm, when you install what happened. I've never use that. But may be I can give a hint.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-30-2008, 08:04 AM
Member
 
Join Date: Dec 2007
Posts: 19
JavaEmpires is on a distinguished road
the INSTALL file is says ,

nmake
nmake test
nmake install

nmake completes successfully.
nmake test fails miserably
nmake install gives following error:

Code:
nmake -f Makefile all -nologo dlltool --def JNI.def --output-exp dll.exp g++ -o ..\blib\arch\auto\Inline\Java\JNI\JNI.dll -Wl,--base-file -Wl,dll .base -mdll -L"D:\SoftwareInstallFolder\Perl5.10\lib\CORE" JNI.o -Wl,--image-bas e,0x2e220000 D:\SoftwareInstallFolder\Perl5.10\lib\CORE\perl510.lib D:\Software InstallFolder\Dev-Cpp\lib\libkernel32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\lib user32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libgdi32.a D:\SoftwareInstallFolde r\Dev-Cpp\lib\libwinspool.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libcomdlg32.a D :\SoftwareInstallFolder\Dev-Cpp\lib\libadvapi32.a D:\SoftwareInstallFolder\Dev-C pp\lib\libshell32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libole32.a D:\SoftwareI nstallFolder\Dev-Cpp\lib\liboleaut32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libn etapi32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libuuid.a D:\SoftwareInstallFolde r\Dev-Cpp\lib\libws2_32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libmpr.a D:\Softw areInstallFolder\Dev-Cpp\lib\libwinmm.a D:\SoftwareInstallFolder\Dev-Cpp\lib\lib version.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libodbc32.a D:\SoftwareInstallFol der\Dev-Cpp\lib\libodbccp32.a D:\SoftwareInstallFolder\Dev-Cpp\lib\libmsvcrt.a d ll.exp JNI.o(.text+0x9ef):JNI.c: undefined reference to `_imp__JNI_GetCreatedJavaVMs@12 ' JNI.o(.text+0xd66):JNI.c: undefined reference to `_imp__JNI_CreateJavaVM@12' collect2: ld returned 1 exit status NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x1' Stop. NMAKE : fatal error U1077: 'C:\WINNT\system32\cmd.exe' : return code '0x2' Stop.
I found that Inline::Java is only useful when you embed your perl code into java source file.

In my case, there are already written perl scripts and i need to call modules from those scripts through java.

Is there any way to do that?

Thanks..
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 05-30-2008, 08:10 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 5,075
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Why can't you use Runtime.getRuntime().exec("perl_script_with_execut ion_path);
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Someone helped you?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.
Help:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Resources:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Web:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Tips:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 05-30-2008, 10:22 AM
Member
 
Join Date: Dec 2007
Posts: 19
JavaEmpires is on a distinguished road
Initially i thought the same thing..
But wat if the perl subroutine returns an array or other complex structure?
and using Runtime.exec() we execute only the script file as a whole and not a single subroutine from the script file..

I found another wrapper called EPerl [sourceforge.net/projects/eperl/] for windows.
I installed it and tried a simple Java program to load the EPerl library.. and I got the UnSatisfiedlink Error. The EPerl.dll is in the java.libray.path as well.

If you could please try executing java program using EPerl I would be thankful to you.

Heres is a simple demo for Eperl...
[codeproject.com/KB/library/EPerlQuickIntroduction.aspx]


Please give it a try...

Thanks
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 12-19-2008, 05:10 PM
Member
 
Join Date: Dec 2008
Location: Ireland, Dublin
Posts: 1
wahmed is on a distinguished road
calling the script can be done by Runtime.exec().

But I believe you have to share data/arrays manually by writing to a common file or by sockets. I am not sure about Perl but works with .exe's written in C++.

let us know if you give it a try.

Thanks,

Waqas
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
logout using java script pankajagar2001 JavaServer Pages (JSP) and JSTL 1 01-03-2008 08:37 AM
calling a perl script in Java(using a OK Button) Yaya B NetBeans 0 12-20-2007 11:50 PM
Use Perl function with java lenny Advanced Java 1 08-07-2007 08:25 AM
How to instantiate Class, into jsp, java script silvia JavaServer Pages (JSP) and JSTL 1 08-07-2007 07:45 AM
The lasted java script silvia JavaServer Pages (JSP) and JSTL 1 08-07-2007 07:44 AM


All times are GMT +3. The time now is 11:54 AM.


VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org