Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scripting / eval 1

Status
Not open for further replies.

stormbind

Technical User
Mar 6, 2003
1,165
GB
Hi,

Can Java evaluate or execute strings as though they were miniature applications?


--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Humn. Well thank you for the reply - though it doesn't sound like very good news [3eyes]

The strings cannot be sandboxed or in another language, as I kind of wanted them to call Java methods.

--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Hi

With the Rhino library you extend/implement classes/interfaces to make them accessible from the JavaScript code. So the JavaScript syntax is just a wrapped around the real Java world.

Feherke.
 
stormbind: could you explain more about what you're trying to do?

Maybe we can find a sollution without pure scripting.

Cheers,
Dian
 
Hi

Or you could think to something like JasperReports' solution. They store the report ( including expressions with own syntax and Java code ) in a an XML file. Then just convert the XML file into Java source code, compile it, load it and execute it.

Feherke.
 
No worries. It was not as complicated as I had imagined :)

My objective was to inject new arbitrary code after the application is compiled and while it is running.

If you have some wonderfully elegant thoughts on that, please share them, but I now see a very simple workaround ;-)

--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top