PBJ::JNI::Native - Perl interface to Java JNI
# use through the PBJ::JNI::JavaVM module, not directly. 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);
This is the native interface to JNI library. All function names are closely resembling the ones in the Java JNI library, with some necessary exceptions. This module should not be used directly. All subroutines are called via the PBJ::JNI::JNIEnv module.
None.
Ping Liang, <ping@cpan.org>
perl.
Copyright (c) 2001 Ping Liang All rights reserved.
THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
This program is licensed under the same terms as Perl itself. For more information see the README or Artistic files provided with the Perl distribution.
To install PBJ::JNI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PBJ::JNI
CPAN shell
perl -MCPAN -e shell install PBJ::JNI
For more information on module installation, please visit the detailed CPAN module installation guide.