Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

how to convert a string to a java expression ??

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
i have a following string :
"if ( ((X < 20 ) && ( Y > 50)) | | ( Z ==56) ) "
i want to convert it to a java condtional expression...how can i do that ??
as a matter of fact i want to know is there any generic way to convert any string to a corresponding java expression or statement or variable declaration.
thanks
Oni
I am sorry if you read this question again
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I don't this is possible. A JAVA expression is compiled into bytecode and evaluated by the JVM. What you're proposing to do is have a psuedo-JIT inside your code. If you figure out how, let me know!
-Peter
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Let's see if I can get this straight... what you are proposing is to take a String or even a whole file full of Strings and feed them into some program (let's call it javac.exe for arguments sake) and then have this javac.exe produce executable byte code? Sounds completely implausable.
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I'm closing this topic here, because Oni has posted it about 3 other forums.
    Bookmark Topic Watch Topic
  • New Topic