Commits

Miki Tebeka  committed d35e0d2

Embed jar in a script

  • Participants
  • Parent commits 59a9302

Comments (0)

Files changed (1)

+#!/usr/bin/env perl
+# Standalone script with embedded jar
+
+# Jar file, we use the user name to avoid collision with other users
+$jar = "/tmp/lp-$ENV{USER}.jar";
+
+# Extract jar if not there
+unless (-e $jar) {
+    open DECODE, "|base64 -d > $jar" or die "can't open base64 pipe";
+    print DECODE <DATA>;
+}
+
+# This will replace the current process with the java one
+exec "java", "-jar", $jar, @ARGV
+
+__DATA__
+YOUR BASE64 ENCODED DATA GOES HERE