SHARE
TWEET

Untitled

a guest Feb 21st, 2019 124 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void main(String[] args) {
  2.         try {
  3.             ProcessBuilder pb =
  4.                     new ProcessBuilder("cmd.exe", "/C", "javap", "-verbose", "<path_to_class_file>");
  5.             Map<String, String> env = pb.environment();
  6.             env.put("Path", "C:\Program Files\Java\jdk-11.0.1\bin");
  7.             Process p = pb.start();
  8.             BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
  9.             String line = "";
  10.             while ((line = br.readLine()) != null) {
  11.                 System.out.println(line);
  12.             }
  13.             int exitValue = p.waitFor();
  14.             System.out.println("nnExit Value is " + exitValue);
  15.         } catch (InterruptedException | IOException e) {
  16.             e.printStackTrace();
  17.         }
  18.     }
  19.      
  20. Classfile /D:/HelloWorld.class
  21.      Last modified 21-Feb-2019; size 425 bytes
  22.      MD5 checksum 29fe59b7ca108f7691a1f144ccd37c90
  23.      Compiled from "HelloWorld.java"
  24.     public class HelloWorld
  25.      minor version: 0
  26.      major version: 55
  27.      ...
  28.     public HelloWorld();
  29.        descriptor: ()V
  30.        flags: (0x0001) ACC_PUBLIC
  31.     Code:
  32.       stack=1, locals=1, args_size=1
  33.          0: aload_0
  34.          1: invokespecial #1                  // Method java/lang/Object."<init>":()V
  35.          4: return
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top