Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Libraries

    PBJ::JNI 0.1

    Download button

    No screenshots available
    Downloads: 607  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Ping Liang | More programs
    Perl Artistic License / FREE
    June 5th, 2007, 00:05 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    PBJ::JNI description

    PBJ::JNI is a Perl module with full access to and from Java virtual machine from Perl.

    PBJ::JNI is a Perl module with full access to and from Java virtual machine from Perl.

    SYNOPSIS

    use PBJ::JNI::JavaVM;

    my ($env, $jvm, @vm_opts);
    my ($cls, $fid, $mid, $out);

    # Create the Java VM
    @vm_opts = ("-Xrs", "-Xcheck:jni");
    $jvm = new PBJ::JNI::JavaVM();
    $env = $jvm->get_env(@vm_opts);

    $env->PushLocalFrame(16) == 0 or die;
    $cls = $env->FindClass("java/lang/System") or die;
    $fid = $env->GetStaticFieldID($cls, "out", "Ljava/io/PrintStream;") or die;
    $out = $env->GetStaticObjectField($cls, $fid) or die;
    $cls = $env->GetObjectClass($out) or die;
    $mid = $env->GetMethodID($cls, "println", "(I)V") or die;
    $env->CallVoidMethod($out, $mid, $env->cast("I", 12345));
    $env->PopLocalFrame(0);

    WARNING

    This software is still in alpha stage. It may not be reliable and its features and APIs may change in the future releases.

    The PBJ::JNI package allows you to link with your Java virtual machine and directly access Java classes from Perl. It also allows a mechanism to create callbacks from Java program to Perl subroutines.

    The package focuses on providing a set of APIs that closely resemble the native JNI interface. This basically means that you can write an ordinary JNI program in Perl instead of in C or C++. This provides a quicker way to writing wrappers to invoke programs written in Java and therefore introduce Java libraries to the Perl without the trouble of writing low level C/C++ programs.

    You will need to know how JNI works in order to use this package. This package is by definition very primitive. If you don't understand thoroughly on how JNI works and try to use the feature of this package, you can easily crash your program or create memory leaks. So don't do that.

    It is my hope that somebody with proper skills in JNI and Perl can write wrappers for a set of popular Java libraries, such as JDBC, XML parser, JMS (that I am working on), and other useful Java packages so that a Perl programmer can use them directly in a pure Perl environment without knowing anything about JNI.

    Requirements:

    · Perl



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    Java VM access | virtual machine | Perl module | PBJ::JNI | Java | VM

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM