Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Java module

by parthi7 (Initiate)
on Feb 16, 2013 at 19:38 UTC ( #1019066=perlquestion: print w/ replies, xml ) Need Help??
parthi7 has asked for the wisdom of the Perl Monks concerning the following question:

Hi All I want to access Java libraries from Perl.
So, I tried to install Java
But I got some error.

I googled to find no good solution.
So, I am trying here.

Following shows the installation command and error logs.

cpan[2]> i Java Module id = Java DESCRIPTION A Perl front-end for JVM communication CPAN_USERID METZZO (Mark Ethan Trostler <mark@zzo.com>) CPAN_VERSION 4.7 CPAN_FILE M/ME/METZZO/Java-4.7.tar.gz UPLOAD_DATE 2004-02-25 DSLIP_STATUS RdhOl (released,developer,hybrid,object-oriented,LGPL +) INST_FILE (not installed) + + cpan[3]> install Java Running install for module 'Java' Running make for M/ME/METZZO/Java-4.7.tar.gz Checksum for /home/parthiban/.local/share/.cpan/sources/authors/id/M/M +E/METZZO/Java-4.7.tar.gz ok Scanning cache /home/parthiban/.local/share/.cpan/build for sizes ...................................................................... +......DONE CPAN.pm: Building M/ME/METZZO/Java-4.7.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Java Writing MYMETA.yml and MYMETA.json cp Java.pm blib/lib/Java.pm cp JavaArray.pm blib/lib/JavaArray.pm cp java_server_install.pl blib/lib/java_server_install.pl cp java_server_install.pl blib/script/java_server_install.pl /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/java +_server_install.pl Manifying blib/man3/Java.3pm Manifying blib/man3/JavaArray.3pm METZZO/Java-4.7.tar.gz /usr/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl 1..33 WARNING: You cannot run these tests unless JavaServer is running! Do you want to continue? (Y/n) Y Client socket error: Connection refused at test.pl line 21 (in cleanup) Can't call method "send_command_and_get_response" on +an undefined value at Java.pm line 640, <STDIN> line 1. not ok 0 - is JavaServer on localhost running? Have you ran 'java_server_install.pl' yet? JavaServer must be running for these tests to function. make: *** [test_dynamic] Error 111 METZZO/Java-4.7.tar.gz /usr/bin/make test -- NOT OK //hint// to see the cpan-testers results for installing this module, t +ry: reports METZZO/Java-4.7.tar.gz Running make install make test had returned bad status, won't install without force Failed during this command: METZZO/Java-4.7.tar.gz : make_test NO


Please help me.
Thanks and regards.

Comment on Java module
Download Code
Re: Java module
by tobyink (Abbot) on Feb 16, 2013 at 20:28 UTC
      Hi tobyink

      Thanks for the comments.
      I have Inline::C module installed in my system.

      Despite the environment variables $JAVA_HOME and $PERL_INLINE_JAVA_J2SDK are set properly, I couldn't be able to install Inline::Java
      I wonder why it doesn't recognize JAVA_HOME?

      Please see the following logs.
      $ perl -e ' while(my($k, $v) =each(%ENV)) { print "$k\t$v\n" if $k =~ /J/; } ' JAVA_HOME /usr/lib/jvm/default-java PERL_INLINE_JAVA_J2SDK /usr/lib/jvm/java-6-openjdk-i386 $ $JAVA_HOME/bin/java -version java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12 +.04.1) OpenJDK Server VM (build 20.0-b12, mixed mode) $ $PERL_INLINE_JAVA_J2SDK/bin/java -version java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~12 +.04.1) OpenJDK Server VM (build 20.0-b12, mixed mode) $ sudo cpan Inline::Java CPAN: Storable loaded ok (v2.27) Reading '/home/parthiban/.local/share/.cpan/Metadata' Database was generated on Sat, 16 Feb 2013 01:07:21 GMT Running install for module 'Inline::Java' Running make for P/PA/PATL/Inline-Java-0.53.tar.gz CPAN: Digest::SHA loaded ok (v5.61) CPAN: Compress::Zlib loaded ok (v2.033) Checksum for /home/parthiban/.local/share/.cpan/sources/authors/id/P/P +A/PATL/Inline-Java-0.53.tar.gz ok CPAN: File::Temp loaded ok (v0.22) CPAN: Parse::CPAN::Meta loaded ok (v1.4404) CPAN: CPAN::Meta loaded ok (v2.120921) CPAN.pm: Building P/PA/PATL/Inline-Java-0.53.tar.gz CPAN: CPAN::Reporter loaded ok (v1.2009) Welcome to the Inline::Java installation procedure. A Java 2 SDK is required to install and use Inline::Java. Please specify your Java 2 SDK installation directory using the J2SDK option to Makefile.PL as such: perl Makefile.PL J2SDK=/path/to/your/j2sdk/installation You can set the JAVA_HOME environment variable to specify your Java 2 SDK installation directory. For example, if you are using the CPAN installer you can do: JAVA_HOME=/path/to/your/j2sdk/installation cpan Inline::Java (/usr/bin/perl Makefile.PL INSTALLDIRS=site exited with 256) CPAN::Reporter: Makefile.PL result is 'unknown', Stopped with an error +. CPAN::Reporter: preparing a CPAN Testers report for Inline-Java-0.53 Do you want to review or edit the test report? (yes/no) [no] Do you want to send the report? (yes/no) [yes] no CPAN::Reporter: test report will not be sent Warning: No success on command[/usr/bin/perl Makefile.PL INSTALLDIRS=s +ite] CPAN: YAML loaded ok (v0.77) PATL/Inline-Java-0.53.tar.gz /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install Could not read metadata file. Falling back to other methods to determi +ne prerequisites
Re: Java module
by Plankton (Priest) on Feb 17, 2013 at 01:48 UTC
    I noticed this in the output you posted:
    WARNING: You cannot run these tests unless JavaServer is running! Do you want to continue? (Y/n) Y
    Maybe you should have answered 'n', unless of course the JavaServer is running. Is the JavaServer running? What is a JavaServer?
      Hi Plankton

      I am afraid that without running the tests, we cannot get the module installed.
      Also, as per the 1st reply from tobyink, I am trying Inline::Java and there also I encounter error.
      Please see my reply to tobyink.

      Thanks and regards
        I noticed this in the output you posted:
        You can set the JAVA_HOME environment variable to specify your Java 2 SDK installation directory. For example, if you are using the CPAN installer you can do: JAVA_HOME=/path/to/your/j2sdk/installation cpan Inline::Java
        ... did you happen run cpan as it discusses. Looks like you executed:
        $sudo cpan Inline::Java
        But the message you got says you should do something like:
        $ sudo JAVA_HOME=/path/to/your/j2sdk/installation cpan Inline::Java
Re: Java module
by Khen1950fx (Canon) on Feb 17, 2013 at 22:33 UTC
    FWIW, Java should be installed manually. It can be installed via CPAN, but make test should not be run until after the install. You could do:
    perl Makefile.PL make make install
    That will install the 'Frontend".
    perl java_server_install.pl
    From the cpan shell:
    cpan> test Java
    That will get the 'Backend' up and going. See the README for more info.
Re: Java module
by parthi7 (Initiate) on Feb 20, 2013 at 04:08 UTC
    Hi All

    I got the module installed with the following command.
    sudo JAVA_HOME=/usr/lib/jvm/default-jvm cpan Inline::Java
    But still puzzled how the $JAVA_HOME environment variable is not recognized automatically.
    Consider this thread as a closed one.

    Thanks everyone for the help.
      On centos 6.x I had to: change my path to: JAVA_HOME=/usr/java/default cpan Inline::Java

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1019066]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2014-07-28 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (204 votes), past polls