Results 1 to 8 of 8
- 05-29-2008, 02:42 PM #1
Member
- Join Date
- Dec 2007
- Posts
- 19
- Rep Power
- 0
[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.
- 05-29-2008, 02:46 PM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Calling perl script means executing perl script?
- 05-29-2008, 05:21 PM #3
Member
- Join Date
- Dec 2007
- Posts
- 19
- Rep Power
- 0
:-) 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.
- 05-30-2008, 05:06 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Hmm, when you install what happened. I've never use that. But may be I can give a hint.
- 05-30-2008, 07:04 AM #5
Member
- Join Date
- Dec 2007
- Posts
- 19
- Rep Power
- 0
the INSTALL file is says ,
nmake
nmake test
nmake install
nmake completes successfully.
nmake test fails miserably
nmake install gives following error:
Java 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.
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..
- 05-30-2008, 07:10 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,370
- Blog Entries
- 1
- Rep Power
- 26
Why can't you use Runtime.getRuntime().exec("perl_script_with_execut ion_path);
- 05-30-2008, 09:22 AM #7
Member
- Join Date
- Dec 2007
- Posts
- 19
- Rep Power
- 0
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
- 12-19-2008, 04:10 PM #8
Member
- Join Date
- Dec 2008
- Location
- Ireland, Dublin
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
How to instantiate Class, into jsp, java script
By silvia in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 01-04-2014, 09:08 AM -
calling a perl script in Java(using a OK Button)
By Yaya B in forum NetBeansReplies: 1Last Post: 01-07-2011, 08:20 AM -
logout using java script
By pankajagar2001 in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 01-03-2008, 07:37 AM -
Use Perl function with java
By lenny in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 07:25 AM -
The lasted java script
By silvia in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 08-07-2007, 06:44 AM
Bookmarks