Results 1 to 4 of 4
Thread: Create *.java file dynamicaly
- 07-01-2011, 12:51 PM #1
Member
- Join Date
- Jul 2011
- Location
- Mumbai
- Posts
- 1
- Rep Power
- 0
Create *.java file dynamicaly
Hi all,
I am writing a code which is generating .java and .xml files dyanamically.
For xml files I am using javax.xml.parsers.DocumentBuilderFactory .
My xml files are generating correctly but I have some queries regarding genrerating .java files.
I want to create a java file which will have some methods and variables.
Is there any way to do this?
Is there any java classes or libraries to do this?
- 07-01-2011, 01:58 PM #2
A .java file contains text written in Java syntax. You can write a .java file with any class that writes Strings.I want to create a java file which will have some methods and variables.
Are you asking if there is a Java statement generator engine? The only one I know of is the one in front of the keyboard.
- 07-02-2011, 12:05 AM #3
I've used Sun's Codemodel API to generate Java source from an XML specification. It seems to have been abandoned when Oracle acquired Sun, and it's not very well documented, but it's worked well for me.
CodeModel — Java.net
Codemodel 2.4 APIGet in the habit of using standard Java naming conventions!
- 07-02-2011, 12:09 AM #4
Here's an example of how I used it. Note that although I defined the classes, methods, and fields the "right" way, when it came to generating the method bodies, I mostly cheated and used JBlock.directStatement(...).
http://szprotocol.svn.sourceforge.ne...Generator.javaGet in the habit of using standard Java naming conventions!
Similar Threads
-
How to create java executable file through CMD
By Riaz Ali in forum New To JavaReplies: 4Last Post: 08-03-2010, 08:20 AM -
Create a file specifying the size JAVA
By Harbox in forum New To JavaReplies: 5Last Post: 07-26-2010, 01:42 PM -
How to create an exe file in java
By pads in forum New To JavaReplies: 4Last Post: 07-09-2010, 05:20 PM -
How to create exe file in java
By radix in forum New To JavaReplies: 8Last Post: 11-06-2008, 04:17 PM -
Need to dynamicaly get all parameters in a method call.
By DavidJohns in forum Advanced JavaReplies: 2Last Post: 05-21-2008, 07:15 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks