I wanted to compile a class or a code when my application is in run-time !
but I couldn't find any thing!
now I think I found it ! I'm working on it but I'm not sure enough!
I want you every body to help me!!
It says you can add method to a class or even make a new class in run-time
and compile it without need to down the application!
do you think it is really true?
it is a class in util package named Jcompiler!
util is a package in Shine that seems to be a pattern!
I found it at:
Browse Shine-Enterprise-Pattern Files on SourceForge.net
note:you should download all parts of its library !
It's a little strange for me! any body can help me?
I'll try to find out it too if I found out any thing new I'll let you know too!
Run-time compiler!!!
Started by afra, Jul 12 2010 04:04 AM
22 replies to this topic
#1
Posted 12 July 2010 - 04:04 AM
|
|
|
#2
Posted 12 July 2010 - 04:23 AM
By reading the API it indeed looks like you can compile at runtime. I do wonder why you would need it, and i assume it isn't possible to change classes you're currently runnnig tho ;)
It probably works like:
It probably works like:
File file = new File("MyClass.java");
File outputDir = new File("c:/some/path/to/dir");
JCompiler compiler = new JCompiler();
compiler.setTargetDir(outputDir);
compiler.compile(file);
And hopefully a .class file is created in the output directory.
#3
Posted 12 July 2010 - 04:38 AM
I want to deploy a program could change by users! you know something like an AI that could learn!
so I was interested to find some thing could help me!
yes I have think same as you but it says it can do it and it works! I'm testing if I can do a hello world! if you do too and help me I really appreciate you! It's unbelievable for me because if it's true I will catch my dream!
thanks a lot!
I'll let you know if I will successful!
so I was interested to find some thing could help me!
yes I have think same as you but it says it can do it and it works! I'm testing if I can do a hello world! if you do too and help me I really appreciate you! It's unbelievable for me because if it's true I will catch my dream!
thanks a lot!
I'll let you know if I will successful!
#4
Posted 12 July 2010 - 04:49 AM
I can't compile java here on this computer. So that'll have to wait for ~4hrs :(
I do indeed wonder what would happen if you overwrite a .class file that the program uses... if it doesn't lock those.
I do indeed wonder what would happen if you overwrite a .class file that the program uses... if it doesn't lock those.
#5
Posted 12 July 2010 - 04:57 AM
Thanks a lot I will wait impatiently! it's really your favor!
#6
Posted 12 July 2010 - 05:06 AM
By the way, i don't think that AI code would actually write its own code and then use the new code. AI software is based on predefined variables and uses those variables to make decisions. Dependent on the result of that decision, it will change his decision-making variables. These variables may also be named "weights".
...And that's about all i know about AI :P
...And that's about all i know about AI :P
#7
Posted 12 July 2010 - 05:17 AM
you're right but I am working on an advance theory that says AI should have ability to learn same as a human! so I need sth to let me compile at run-time! I think it will be closer to a real human! what do you think?
#8
Posted 12 July 2010 - 05:20 AM
I think it's more riscful to let a computer decide what it's going to run. Imagine this code
Disc.format("C");
It wouldn't be very fun if the AI eventually wrote and ran that :)
Disc.format("C");
It wouldn't be very fun if the AI eventually wrote and ran that :)
#9
Posted 12 July 2010 - 05:31 AM
yes but we can define some predefined rules for it to prevent it from probable mistakes too! both together! like a human when somebody learn you how to kill yourself you will never do that because it had been defined for you that makes you destroyed forever!
Its seems hard but it's really interesting for me!
Its seems hard but it's really interesting for me!
#10
Posted 12 July 2010 - 10:06 AM
dear oxano
did you find anything? I'm really curious about it!
did you find anything? I'm really curious about it!
#11
Posted 12 July 2010 - 11:27 AM
Yea, i found that i get errors, even when i follow their tutorial.
#12
Posted 12 July 2010 - 11:30 AM
thank you !
what were your errors?
what were your errors?


Sign In
Create Account


Back to top









