Jive - Compiling Java on the fly
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Jive - Compiling Java on the fly
by mtgrares » 20 Oct 2009, 19:34
I wanted to mention to you that compile Java on the flying using either Jive or the GNU Java compiler. I know that Jive is just one exe file although it doesn't support newer Java features like templates.
I think it would be nice to stick some Java code in cards.txt and then compile it on the fly on the user's computer.
I think it would be nice to stick some Java code in cards.txt and then compile it on the fly on the user's computer.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: Jive - Compiling Java on the fly
by silly freak » 20 Oct 2009, 19:59
what do you mean by templates?
by the way, compiling on the fly is also possible without an external exe (or whatever) but with pure java. i dunno if it requires the program to run in a JDK rather than a JRE.
it is based around javax.tools.JavaCompiler, and of course java.lang.ClassLoader, to use the classes afterwards. I have found a package on the internet, and would post it here. My Space on the forums is low, however... PM me if you're interested
by the way, compiling on the fly is also possible without an external exe (or whatever) but with pure java. i dunno if it requires the program to run in a JDK rather than a JRE.
it is based around javax.tools.JavaCompiler, and of course java.lang.ClassLoader, to use the classes afterwards. I have found a package on the internet, and would post it here. My Space on the forums is low, however... PM me if you're interested
___
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
- silly freak
- DEVELOPER
- Posts: 598
- Joined: 26 Mar 2009, 07:18
- Location: Vienna, Austria
- Has thanked: 93 times
- Been thanked: 25 times
Re: Jive - Compiling Java on the fly
by Huggybaby » 21 Oct 2009, 02:04
You can post any file to Mediafire or Rapidshare.
-
Huggybaby - Administrator
- Posts: 3207
- Joined: 15 Jan 2006, 19:44
- Location: Finally out of Atlanta
- Has thanked: 701 times
- Been thanked: 594 times
Re: Jive - Compiling Java on the fly
by mtgrares » 22 Oct 2009, 20:37
I think, Jikes (not Jive) doesn't support
- Code: Select all
ArrayList<String> list = new ArrayList<String>();
- Code: Select all
ArrayList list = new ArrayList();
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: Jive - Compiling Java on the fly
by silly freak » 22 Oct 2009, 21:54
i just realized that the code I wanted to upload is still on the forums from some earlier post - here's the link to the
post
it lets you compile java classes that are stored in a string and load the classes in the program
post
it lets you compile java classes that are stored in a string and load the classes in the program
___
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
- silly freak
- DEVELOPER
- Posts: 598
- Joined: 26 Mar 2009, 07:18
- Location: Vienna, Austria
- Has thanked: 93 times
- Been thanked: 25 times
Re: Jive - Compiling Java on the fly
by mtgrares » 24 Oct 2009, 20:09
Thanks for reminding me about your previous post. It is very interesting.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: Jive - Compiling Java on the fly
by mtgrares » 12 Nov 2009, 22:06
The user has to have the Java JDK and not the runtime only, more common Java JRE. Below is taken from the Javadocs for land.compiler. (I don't think I've posted this before, but if I did, sorry.)
The Compiler class is provided to support Java-to-native-code compilers and related services. By design, the Compiler class does nothing; it serves as a placeholder for a JIT compiler implementation.
When the Java Virtual Machine first starts, it determines if the system property java.compiler exists. (System properties are accessible through getProperty, a method defined by the System class.) If so, it is assumed to be the name of a library (with a platform-dependent exact location and type); the loadLibrary method in class System is called to load that library. If this loading succeeds, the function named java_lang_Compiler_start() in that library is called.
If no compiler is available, these methods do nothing.
The Compiler class is provided to support Java-to-native-code compilers and related services. By design, the Compiler class does nothing; it serves as a placeholder for a JIT compiler implementation.
When the Java Virtual Machine first starts, it determines if the system property java.compiler exists. (System properties are accessible through getProperty, a method defined by the System class.) If so, it is assumed to be the name of a library (with a platform-dependent exact location and type); the loadLibrary method in class System is called to load that library. If this loading succeeds, the function named java_lang_Compiler_start() in that library is called.
If no compiler is available, these methods do nothing.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: RobertGer and 77 guests