JPad
Snippets
Download
Help
Contact
Run Command Line Statements JPad.cmd
Run command line statements from JPad.
Code
// JPad.cmd runs commands as if entered at the command line. // Run command line in array format // useful to reduce need for escaping quotes etc. Dump(JPad.cmd(new String[] { "echo","hello world!"} )); // Run command - String format as you would write at terminal Dump(JPad.cmd("java -version"));
Result
Console
hello world! java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
Bytecode
Compiled from "RunnContainer.java" public class io.jpad.scratch.RunnContainer { public io.jpad.scratch.RunnContainer(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return public static void main(java.lang.String...) throws java.lang.Exception; Code: 0: iconst_2 1: anewarray #2 // class java/lang/String 4: dup 5: iconst_0 6: ldc #3 // String echo 8: aastore 9: dup 10: iconst_1 11: ldc #4 // String hello world! 13: aastore 14: invokestatic #5 // Method io/jpad/scratch/JPad.cmd:([Ljava/lang/String;)Ljava/lang/String; 17: invokestatic #6 // Method io/jpad/scratch/Dumper.Dump:(Ljava/lang/Object;)Ljava/lang/Object; 20: pop 21: ldc #7 // String java -version 23: invokestatic #8 // Method io/jpad/scratch/JPad.cmd:(Ljava/lang/String;)Ljava/lang/String; 26: invokestatic #6 // Method io/jpad/scratch/Dumper.Dump:(Ljava/lang/Object;)Ljava/lang/Object; 29: pop 30: return }
Jpad Version:1.06
viewCount:3824
Creator:
admin
Latest Editor:
admin
Tags
jpad
cmd
Download
Copy As Markdown:
**code [Run Command Line Statements JPad.cmd.java](/example/1z/run-command-line-statements-jpad-cmd)** // JPad.cmd runs commands as if entered at the command line. // Run command line in array format // useful to reduce need for escaping quotes etc. Dump(JPad.cmd(new String[] { "echo","hello world!"} )); // Run command - String format as you would write at terminal Dump(JPad.cmd("java -version")); **Result:** hello world! java version "1.8.0_31" Java(TM) SE Runtime Environment (build 1.8.0_31-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)