Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How do I compile a Java string and get teh class file

  Asked By: Bertha    Date: Oct 19    Category: Java    Views: 949
  

Problem : How do I compile a Java string and get teh class file

Consider this class.Just a sudo codes.........

public class MainClass {
public static void main(String[] args) {
//s is stored in a database
String s1=getStringFromBatabase(s);
//Consider s="class Hello{ public static void main(String[] args){
System.out.println(2);}}"
s2=compile(s1);
execute(s2);
}
}
//op is equal to 2


note:
String "s" is stored in a database.First we need to retreive it.Say s="class
Hello{ public static void main(String[] args){ System.out.println(2);}}"
Then wot i need is, compile this string without write it into a file.

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on How do I compile a Java string and get teh class file Or get search suggestion and latest updates.




Tagged: