execution from text box / area?

A

Ashanen

Hi

I am trying to develop a small Java program with simple GUI, the purpose of
which is to teach people very elementary java for absolute beginners. What I
would like to achieve is for the student to type in an expression or a very
simple set of expressions in a text box / area, and then push a button so that
those commands will be executed and they can see the outcome. But I am
uncertain how to actually get those expressions evaluated straight from the
text box or text area. Can anyone help out here? Thanks.
 
D

Dave Glasser

(e-mail address removed) (Ashanen) wrote on 01 Jan 2004 21:08:54 GMT in
comp.lang.java.programmer:
Hi

I am trying to develop a small Java program with simple GUI, the purpose of
which is to teach people very elementary java for absolute beginners. What I
would like to achieve is for the student to type in an expression or a very
simple set of expressions in a text box / area, and then push a button so that
those commands will be executed and they can see the outcome. But I am
uncertain how to actually get those expressions evaluated straight from the
text box or text area. Can anyone help out here? Thanks.



You might get some ideas from beanshell, at http://www.beanshell.org.
 
H

Harald Hein

Ashanen said:
I am trying to develop a small Java program with simple GUI, the
purpose of which is to teach people very elementary java for
absolute beginners.

See www.bluej.org for a free Java teaching IDE.
What I would like to achieve is for the student to type in an
expression or a very simple set of expressions in a text box /
area, and then push a button so that those commands will be
executed and they can see the outcome.

You would have to implement an expression parser. But the result
wouldn't be related to Java programming at all. Why not give them Java
in a controlled environment, like the BlueJ IDE?
 
A

Ashanen

Hello.

BlueJ sounds interesting BUT one of my personal aims is to develop an
application which can be marketed, and hence I don't want to fall foul of (or
pay commision to!) other people's licensing. A pre-existing app which is
licensed for non commericial use only is probably going to be no use to me.
 
S

Sudsy

Ashanen said:
Hello.

BlueJ sounds interesting BUT one of my personal aims is to develop an
application which can be marketed, and hence I don't want to fall foul of (or
pay commision to!) other people's licensing. A pre-existing app which is
licensed for non commericial use only is probably going to be no use to me.

Do you not see the dichotomy at play here? You're looking to develop
something which you can sell yet you don't want to pay anything! If
you want to write it then do so. You can hardly expect others to
help for free when you're being so magnanimous. ;-)
Ya gets what ya pays for!
 
H

Harald Hein

Ashanen said:
BlueJ sounds interesting BUT one of my personal aims is to develop
an application which can be marketed, and hence I don't want to
fall foul of (or pay commision to!) other people's licensing. A
pre-existing app which is licensed for non commericial use only is
probably going to be no use to me.

We should write something for you for free, so you can market it?
 
A

Ashanen

I'm not sure I understand these responses. First of all, I don't recall asking
anyone to *WRITE* anything for me (is this a flame board then?). Secondly,
given that I have never marketed anything before, the chances that I will make
money rather than ending up paying commisions and losing money are slim. What
is so wrong with wanting to develop your own application without strapping
other people's stuff onto it?

I didn't ask "how do I do this whole application". I was simply asking a
specific question relating to how to get a very simple input to a text area
interpreted and executed as a java program when a button on the GUI is pressed,
even if its just a heelo world program.
 
A

Andrew Thompson

Very useful. Thank you.

It is quite fun. :) To be honest I'd never tried it
until last night. After a few hiccups getting the
compiler to find the 'tools' jar, worked like a charm.

I am considering putting a 'compile from text
area' form on the web, since I will have to sort
out compiling on the server for some other
projects I have in mind.

It would be nice to get to the point where a
web-surfer could paste code in the text area,
compile it, then - get to play with, or download,
the class...

But for now, sleep.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top