Class: Jerbil::JavaTask
Description
Runs a Java program, either in-vm or as separate process (forked or replacing current process).
Example (forked)
Jerbil::JavaTask.new(:run, "jerbil.sample.Main") do |t|
t.classpath = CLASSPATH
t.parameters = [ "--quiet" ]
t.max_mem = 64
t.fork = true
t.depends_on :compile
end
Example (in-vm)
Jerbil::JavaTask.new(:run, "jerbil.sample.Main") do |t|
t.parameters = [ "-foo", "baz" ]
t.in_vm = true
t.depends_on :compile
end
Attributes
| Name | Read/write? | Description | ||
|---|---|---|---|---|
| classname | RW | Class to run | ||
| classpath | RW | |||
| fork | RW | |||
| in_vm | RW | |||
| name | RW | Name for task | ||
| parameters | RW | Program args | ||
Public Class methods
new (name, classname) {|self if block_given?| ...}
# File lib/jerbil/java_task.rb, line 41 41: def initialize(name, classname) 42: @name = name || classname 43: @classname = classname 44: @parameters = [] 45: @classpath = "." 46: @in_vm = false 47: @fork = false 48: yield self if block_given? 49: define 50: end
Public Instance methods
debug (port=8000, suspend="n")
Runs program in debug mode, listening on port port.
# File lib/jerbil/java_task.rb, line 73 73: def debug(port=8000, suspend="n") 74: add_extra_args "-Xdebug", "-Xnoagent", 75: "-Xrunjdwp:transport=dt_socket,address=#{port},server=y,suspend=#{suspend}" 76: end
logging_conf= (file)
# File lib/jerbil/java_task.rb, line 62 62: def logging_conf=(file) 63: sys_property("java.util.logging.config.file", file) 64: end
max_mem= (mem)
The max. amount of memory (in MB) the new Java process is allowed to take.
# File lib/jerbil/java_task.rb, line 68 68: def max_mem=(mem) 69: add_extra_args "-Xmx#{mem}M" 70: end
sys_property (name,value)
Adds a system property to the command line.
# File lib/jerbil/java_task.rb, line 58 58: def sys_property(name,value) 59: add_extra_args "-D#{name}=#{value}" 60: end