public static void main(String[] args) { try { System.out.println("Using outputdir:" + ClassLoader.getSystemResource("").getPath()); Instrumentation instrumentation = new Instrumentation(); instrumentation.setOutputDirectory(ClassLoader.getSystemResource("").getPath()); instrumentation.instrument(); } catch (Exception e) { e.printStackTrace(); } }
/** * Detects the directory of the binary Java files (which is the working directory if started from * Eclipse) and performs the instrumentation step. * * @param args command line parameters (not required) */ public static void main(String[] args) { try { Instrumentation instrumentation = new Instrumentation(); String outputDir = ClassLoader.getSystemResource("").getPath(); try { // replace e.g. %20 by space, which is required for the instrumentation to work outputDir = URLDecoder.decode(outputDir, "UTF-8"); } catch (UnsupportedEncodingException e) { } instrumentation.setOutputDirectory(outputDir); instrumentation.instrument(); } catch (Exception e) { e.printStackTrace(); } }