Results 1 to 8 of 8
  1. #1
    phyzix5761 is offline Member
    Join Date
    Nov 2012
    Posts
    43
    Rep Power
    0

    Default Convert user input into code

    Is there a built in way to convert user input into code and run it? If not, how would I go about creating something like that?

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    760
    Rep Power
    9

    Default Re: Convert user input into code

    Hi,

    Can you be more specific? What is the user input that you want to convert into code? For example if a user input his name what code then you want to create and run it?

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    27

  4. #4
    phyzix5761 is offline Member
    Join Date
    Nov 2012
    Posts
    43
    Rep Power
    0

    Default Re: Convert user input into code

    Thank you for your responses. Just to clarify I ultimately want to make something like what is showed on this website: livecoding

    One part of the window shows the code while the other shows, in real time, the changes made to the code.

  5. #5
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,708
    Rep Power
    13

    Default Re: Convert user input into code

    Either take the user's input, compile and run it.

    Or interpret the input as Java code. Beanshell is a java interpreter that has been around for a while and is stable.

    Either way, may God have mercy on your server.

    If you're just playing around I'd suggest Beanshell as the documentation is good. I've used it as a way of embedding Java within plain text as a sort of PHP like text processor.

  6. #6
    phyzix5761 is offline Member
    Join Date
    Nov 2012
    Posts
    43
    Rep Power
    0

    Default Re: Convert user input into code

    Thank you for your suggestion pbrockway2. I will definitely be looking into Beanshell. But you said, "... take the user's input, compile and run it." How is this possible to do within a program?

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,937
    Rep Power
    20

    Default Re: Convert user input into code

    Take a look at the contents of the javax.tools package. Note that use of this package requires that a JDK (not just a JRE) be installed.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,048
    Blog Entries
    7
    Rep Power
    23

    Default Re: Convert user input into code

    Maybe you like this article.

    kind regards,

    Jos
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. user input on gui
    By JoePenguin in forum New To Java
    Replies: 5
    Last Post: 01-26-2012, 08:27 PM
  2. User input
    By the ole buc in forum New To Java
    Replies: 16
    Last Post: 12-11-2011, 08:08 PM
  3. Need help getting input(first/last name) from user
    By nightrise420 in forum New To Java
    Replies: 11
    Last Post: 09-11-2010, 03:09 AM
  4. User Input
    By brmcdani in forum New To Java
    Replies: 2
    Last Post: 02-05-2010, 02:59 AM
  5. User input- Pop Up Box
    By dedachi in forum AWT / Swing
    Replies: 3
    Last Post: 03-23-2009, 05:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •