Compile in memory java source?  
Author Message
exits funnel





PostPosted: 2006-9-28 23:42:00 Top

java-programmer, Compile in memory java source? Hello,

Does anyone know of a java compiler which can be launched in process to
compile an in memory representation of a java source file? Essentially,
I generate some source on the fly and I'd like to avoid having to write
it to disk and all the messiness (permissions, cleanup, etc) that come
with that. I was surprised to find that javac didn't (as far as I could
tell) support this interaction. Can anyone point me towards a tool
which does what I need? Thanks in advance.

-exits
 
Robert Klemme





PostPosted: 2006-9-29 0:06:00 Top

java-programmer >> Compile in memory java source? On 28.09.2006 17:42, exits funnel wrote:
> Hello,
>
> Does anyone know of a java compiler which can be launched in process to
> compile an in memory representation of a java source file? Essentially,
> I generate some source on the fly and I'd like to avoid having to write
> it to disk and all the messiness (permissions, cleanup, etc) that come
> with that. I was surprised to find that javac didn't (as far as I could
> tell) support this interaction. Can anyone point me towards a tool
> which does what I need? Thanks in advance.

http://www.google.com/search?q=java+expression+compiler

FUP to c.l.j.s

robert
 
TechBookReport





PostPosted: 2006-9-29 0:12:00 Top

java-programmer >> Compile in memory java source? Robert Klemme wrote:
> On 28.09.2006 17:42, exits funnel wrote:
>> Hello,
>>
>> Does anyone know of a java compiler which can be launched in process
>> to compile an in memory representation of a java source file?
>> Essentially, I generate some source on the fly and I'd like to avoid
>> having to write it to disk and all the messiness (permissions,
>> cleanup, etc) that come with that. I was surprised to find that javac
>> didn't (as far as I could tell) support this interaction. Can anyone
>> point me towards a tool which does what I need? Thanks in advance.
>
> http://www.google.com/search?q=java+expression+compiler
>
> FUP to c.l.j.s
>
> robert

Also look at Java 6 (Mustang), which gives you access to the Java
compiler API.

--
TechBookReport Java: http://www.techbookreport.com/JavaIndex.html
 
 
exits funnel





PostPosted: 2006-9-29 22:54:00 Top

java-programmer >> Compile in memory java source? Robert Klemme wrote:
> On 28.09.2006 17:42, exits funnel wrote:
>> Hello,
>>
>> Does anyone know of a java compiler which can be launched in process
>> to compile an in memory representation of a java source file?
>> Essentially, I generate some source on the fly and I'd like to avoid
>> having to write it to disk and all the messiness (permissions,
>> cleanup, etc) that come with that. I was surprised to find that javac
>> didn't (as far as I could tell) support this interaction. Can anyone
>> point me towards a tool which does what I need? Thanks in advance.
>
> http://www.google.com/search?q=java+expression+compiler
>
> FUP to c.l.j.s
>
> robert

Thanks Robert for taking the time to reply. One of the tools that
showed up in the search was Janino which looks promising. Thanks again.

-exits
 
 
Arne Vajh鴍





PostPosted: 2006-10-1 4:14:00 Top

java-programmer >> Compile in memory java source? exits funnel wrote:
> Does anyone know of a java compiler which can be launched in process to
> compile an in memory representation of a java source file? Essentially,
> I generate some source on the fly and I'd like to avoid having to write
> it to disk and all the messiness (permissions, cleanup, etc) that come
> with that. I was surprised to find that javac didn't (as far as I could
> tell) support this interaction. Can anyone point me towards a tool
> which does what I need? Thanks in advance.

Part of Java 1.6 !

Arne
 
 
ddimitrov





PostPosted: 2006-10-1 8:25:00 Top

java-programmer >> Compile in memory java source? Check also Javassist http://www.jboss.org/products/javassist