Skip to content

Commit

Permalink
Call Java from Perl using Inline::Java
Browse files Browse the repository at this point in the history
  • Loading branch information
PyjaErskell committed Dec 11, 2019
1 parent ef989c8 commit dedc25b
Show file tree
Hide file tree
Showing 5 changed files with 466 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@ECHO OFF
SETLOCAL

SET SC_KAPA_HM=C:\ProgramData\Bichon Frise\Kapa
SET SC_JAVA_HM=%SC_KAPA_HM%\19.11.01\Vindue\x64\Amazon\Corretto\8.232.09.1
SET Path=%SC_JAVA_HM%\jre\bin\server;%Path%

PUSHD "%~DP0"
CD "%~DP0"

SET SC_MILO_PN=%CD%
CD "%SC_MILO_PN%\..\..\..\.."
SET SC_PYJA_HM=%CD%
FOR %%F IN (%SC_PYJA_HM%\..) DO SET SC_PYJA_NM=%%~NXF
FOR %%F IN (%SC_PYJA_HM%) DO SET SC_PYJA_VR=%%~NXF

POPD

SET SC_ECU_PN=%SC_MILO_PN%\ecu
SET PERL5LIB=%SC_MILO_PN%\src\k-09001-perl

"%SC_KAPA_HM%\19.01.22\Vindue\x64\Strawberry\5.28.1\perl\bin\perl5.28.1.exe" "%SC_MILO_PN%\src\k-01001-run-me\SToa.pl" %*
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

export SC_KAPA_HM="/Library/Application Support/Bichon Frise/Kapa"
export SC_JAVA_HM=$SC_KAPA_HM/19.11.01/Mushama/x64/Amazon/Corretto/8.232.09.1
export LD_LIBRARY_PATH=$SC_JAVA_HM/jre/lib/server

export SC_MILO_PN=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

export SC_PYJA_HM=$( cd "$SC_MILO_PN/../../../.." && pwd )
export SC_PYJA_NM=$( basename "$( cd "$SC_PYJA_HM/.." && pwd )" )
export SC_PYJA_VR=$( basename "${SC_PYJA_HM}" )

export SC_ECU_PN=$SC_MILO_PN/ecu

"/opt/local/bin/perl5.26.3" -I "$SC_MILO_PN/src/k-09001-perl" "$SC_MILO_PN/src/k-01001-run-me/SToa.pl" "$@"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#---------------------------------------------------------------
# Global
#---------------------------------------------------------------

use v5.26;
use strict;
use warnings;

use File::Basename;

BEGIN { $ENV {'SC_DUCK_PN'} = dirname (__FILE__); }

use i191210::G010;

#---------------------------------------------------------------
# Your Source
#---------------------------------------------------------------

package WMain;

use v5.26;
use strict;
use warnings;

use utf8;
use Config;
use Wx qw( wxDefaultPosition wxMAJOR_VERSION wxMINOR_VERSION );
use Wx::Event qw( EVT_ACTIVATE EVT_CLOSE );

use i191210::G010;

use base qw(Wx::App);

sub OnInit {
my ($self) = @_;
GC_LOG -> info ( "${\ ref $self } : Initializing ..." );
$self->{wu_fra} = Wx::Frame -> new ( undef, -1, "${\GC_OLIM_NM} : ${\GC_MILO_NM}", wxDefaultPosition, [ 660, 250 ] );
$self->{wu_lbx} = Wx::ListBox -> new ($self->{wu_fra});
EVT_ACTIVATE ( $self->{wu_fra}, \&wn_fra_activate );
EVT_CLOSE ( $self->{wu_fra}, \&wn_fra_close );
$self -> SetTopWindow ($self->{wu_fra});
$self->{wu_fra} -> Center ();
$self->{wu_fra} -> Show (1);
$self -> wn_init ();
1;
}

sub wn_init {
my ($self) = @_;
$self -> wn_say ( "\$^V => $^V" );
$self -> wn_say ( "wxPerl version => $Wx::VERSION" );
$self -> wn_say ( "wxWidgets version => ${\wxMAJOR_VERSION}.${\wxMINOR_VERSION}" );
$self -> wn_say ( "Java version => ${\ java::lang::System -> getProperty ('java.version') }" );
$self -> wn_say ( "Perl hello (English) => ${\ main::sf_perl_hello ( 'PERL-', 6 ) }" );
$self -> wn_say ( "Perl hello (Korean) => ${\ main::sf_perl_hello ( '펄-', 25 ) }" );
$self -> wn_say ( "Java string format 'int : %,d, long : %,d' => ${\ J010 -> jf_sf ( 'int : %,d, long : %,d', gf_joa ( 314159265, 314159265358979 ) ) }" );
$self -> wn_say ( "Java string format 'English : %s, Korean : %s' => ${\ J010 -> jf_sf ( 'English : %s, Korean : %s', gf_joa ( 'JAVA', '자바' ) ) }" );
}

sub wn_say {
my ( $self, $x_line ) = @_;
$self->{wu_lbx} -> Append ($x_line);
}

sub wn_fra_activate {
my ( $self, $x_ev ) = @_;
GC_LOG -> debug ( "${\ ref $self } : Activated ..." );
$x_ev -> Skip;
}

sub wn_fra_close {
my ( $self, $x_ev ) = @_;
GC_LOG -> info ( "${\ ref $self } : Closing ..." );
$x_ev -> Skip;
}

package main;

sub sf_perl_hello {
my ( $x_it, $x_repeat ) = @_;
return 'Hello ' . $x_it x $x_repeat . ' !!!'
}

sub sp_body {
my $pu_m = WMain -> new ();
$pu_m -> MainLoop;
}

sub sp_main {
gp_run (\&sp_body);
}


sp_main ();
Loading

0 comments on commit dedc25b

Please sign in to comment.