I was reading over the changes in Mark Mandels latest release of JavaLoader and noticed that it can now compile .java on the fly. That was pretty cool in itself but got me thinking.

I could now theoretically write java code inline, write it out to a file and let javaloader compile and load the class for me then clean up the file for the next run. I tried it and it worked.

I then ask Mark if it works with ColdFusion 9's VFS ( Virtual File System ). Mark hadn't tried this and wasn't sure so I gave it a go.

Guess what. Yep it works perfectly.

Here is the code and an image of the output:



Here is the actual code Running:

http://cf9.kukiel.net/demos/java/



8 comments:

billy said...

Now, that's cool! Nice work... How does package importing work?

Henry Ho said...

only for CF9?

Ben Nadel said...

Very cool Paul, very cool.

Mark Mandel said...

Nice work!

I have no idea how Java picks up the ram://, but I'm happy that it works!

Mark Mandel said...

Since you're having so much fun playing - what happens if you set the VFS as the location to compile the .jar file to? Does that work as well?

Paul Kukiel said...

@Billy - I'm not sure I will spend some more time with this soon.

@Henry - Yes the VFS is new in ColdFusion 9. It may work in Railo with there ram implementation I will have to try.

@Mark - I'll do some more reading on javaloader and see what happens and report my findings.

Marcos Placona said...

Now that's a really cool example Paul!

Dave Ferguson said...

Very nice. I can see some good uses for this. That is once VFS becomes less volatile.

Post a Comment