Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use feature qw(say);
- use strict;
- use warnings;
- my $wrap_name = 'Wrapper';
- my $source = <<"END_JAVA";
- import com.utilties.SampleClass;
- class $wrap_name {
- public static void main(String[] args) throws Exception {
- String result = com.utilties.SampleClass.SampleMethod("string1", "string2");
- System.out.print("Result: " + result);
- }
- }
- END_JAVA
- my $fn = $wrap_name . '.java';
- open ( my $fh, '>', $fn ) or die "Could not open file '$fn': $!";
- print $fh $source;
- close $fh;
- system 'javac', '-cp', '.:/opt/apps/batch/utilities/Utilities.jar', $fn;
- my $output = `java -cp .:/opt/apps/batch/utilities/Utilities.jar ${wrap_name}`;
- say "Got output: '$output'";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement