jrunscript in a target VM

Mustang's jrunscript is cool, but it just launches a new VM and runs your script. Sometimes you want to find out what is going on in an existing process, or control it somehow, using JavaScript. Now you can! Download jrunscriptin.jar and run with
java -jar jrunscriptin.jar
(on Mustang) for usage information, quoted here for your convenience:
Usage:
  java -jar jrunscriptin.jar <PID> 
    where <PID> is as in jps
  java -jar jrunscriptin.jar <match> <JavaScript>
    where <match> is some substring of the text after a PID visible in jps -lm
Example using NetBeans IDE (quoting as in Bourne Shell, adapt as needed):
  java -jar jrunscriptin.jar netbeans \\
  'Packages.org.openide.awt.StatusDisplayer.getDefault().setStatusText("Hello from abroad!"); \\
  java.lang.System.out.println("OK!")'
Requires Mustang (JDK 6) for both this tool and the target VM.
Sources
Comments:

sounds cool - if it has a GUI like JConsole then we can even use it as a dynamic debugging tool~

Posted by Alex Lam on February 17, 2006 at 11:18 PM EST #

I enhanced jrunscriptin. Now rather than taking one expression and running it, it produces a full read-eval-print loop on standard input and standard output. So you can interactively examine the target process.

Revised sources (binary JAR in same place)

Posted by Jesse Glick on February 18, 2006 at 12:45 PM EST #

Great idea indeed - keep up the good work!

Posted by Alex Lam on February 18, 2006 at 12:59 PM EST #

Now hosted on Kenai! http://kenai.com/projects/jrunscriptin

Posted by Jesse Glick on June 10, 2009 at 03:30 AM EDT #

Bye-bye Kenai. Now moved to: http://bitbucket.org/jglick/jrunscriptin/

Posted by Jesse Glick on February 02, 2010 at 02:58 AM EST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

jglick

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today