-
- system( "export GAPSLITE_HOME=$GAPSLITE_HOME; export JAVA_HOME=$JAVA_HOME; ".
- "cd $dir; $GAPSLITE_HOME/bin/encode.sh $mac $filename $dir/cfg$mac"
- ) == 0
- or die "grandstream encode failed: $!";
+
+ #system( "export GAPSLITE_HOME=$GAPSLITE_HOME; export JAVA_HOME=$JAVA_HOME; ".
+ # "cd $dir; $GAPSLITE_HOME/bin/encode.sh $mac $filename $dir/cfg$mac"
+ # ) == 0
+ # or die "grandstream encode failed: $!";
+ my $out_and_err = '';
+ my @cmd = ( "$JAVA_HOME/bin/java",
+ '-classpath', "$GAPSLITE_HOME/lib/gapslite.jar:$GAPSLITE_HOME/lib/bcprov-jdk14-124.jar:$GAPSLITE_HOME/config",
+ 'com.grandstream.cmd.TextEncoder',
+ $mac, $filename, "$dir/cfg$mac",
+ );
+ run \@cmd, '>&', \$out_and_err
+ or die "grandstream encode failed: $out_and_err";