Groovy - Opening system applications

 In Java we have exec() method for opening system applications. In groovy this is more easier than Java. This is groovier way for opening notepad application.
"notepad.exe".execute()
 When you called the execute() method on String object, Groovy created the instance that extends java.lang.Process , just like exec() method of RunTime did in the Java code. You can verify this by using following code.
println "notepad.exe".execute().class.name
 This will print "java.lang.Process"

Comments

Popular Posts