creating a class with coding_?.
-
hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).
-
hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).
quartaela wrote:
you will say i am working on a silly project
No, you said that.
Unrequited desire is character building. OriginalGriff
-
quartaela wrote:
you will say i am working on a silly project
No, you said that.
Unrequited desire is character building. OriginalGriff
-
hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).
-
hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).
Yes you can do this. Java 1.6 has an interface JavaCompiler that lets you call the compiler from within code. There is an article here: The Java 6.0 Compiler API[^] Depending on what you are trying to achieve (it's not entirely clear to me), you may find something like BeanShell a better solution. BeanShell[^]
-
Createing code at runtime and then compiling it is possible. Certainly sounds like you are missing the second part of that. You can find examples of that. However nothing in your post really suggests why you need that.
-
Createing code at runtime and then compiling it is possible. Certainly sounds like you are missing the second part of that. You can find examples of that. However nothing in your post really suggests why you need that.
yess i mean this. well i am taking java courses and i want some java homework so he told me that i can work on this subject.: ) finally i created the code and it creates the files which must be compiled. so only the problem is how can i compile them : )
-
Yes you can do this. Java 1.6 has an interface JavaCompiler that lets you call the compiler from within code. There is an article here: The Java 6.0 Compiler API[^] Depending on what you are trying to achieve (it's not entirely clear to me), you may find something like BeanShell a better solution. BeanShell[^]