Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pre-compiling a script

 
Vinicius Souza
Ranch Hand
Posts: 70
1
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im creating a program where I need to execute the same script continuously so I was wondering if I can pre compile it ? My code below
package com.xcreator;


Thanks in advance!
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can compile a script at runtime if the ScriptEngine implements the Compilable interface.
If so, you can cast it to Compilable and invoke either of the compile() methods to obtain a CompiledScript instance, which you can then re-use as often as you like.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic