Compiling / Running a Java file in JSP
ok, I have a jsp page, which we will call page 1. Once I go to that page, I all I want it to do is compile a certain file.java, and then run the file.java. The user doesn't actually know that this is going on in the background. Page 1 automatically redirects the user to page 2 (also a jsp page).
so, right now, I'm trying to figure out how to write the jsp code that will tell how to compile and run a java file. I was thinking about using javabeans before, but I think you HAVE to actually display the contents of the java file into the jsp (I think). Anyhow, thanks for the help!
sorry about being ambiguous before. What I mean by
running a java file was that I already created a java
file. I don't want to hava my java statements inside
the jsp file. I just want the jsp file have a command
in it that would call a java file, tell the java file
to compile and run. All the jsp file would do
(hopefully) is just give commands for a seperate java
file to compile and run. Thanks again for any help!Ok, so this other java file has some entry-point method, like main(), right? So call it...
or better yet, it's an object you can use:
YourJavaClass x = new YourJavaClass();
You don't need the jsp file to "compile" this java file, you'd already have compiled it beforehand, and it's class bytecode needs to be in your classpath (on the server side) of course.