From a JSP page, I am trying to run a shell script.
From the command line, I call the script like:
First Code Example
It processes just fine in this scenario.
Within the .jsp page, I originally tried
2nd Code Example
this scenario did not work. The variable that is argument1 does not get populated and the program that is being called by the shell script gives me Null-Value error. (this does not happen in the first coding example.
A co-worker told me this would be the solution:
3rd Code Example
However, this gives me the same results as in the 2nd code example.
Any suggestions on what I'm doing wrong here? The shell-script argument is not getting picked up by the Runtime Call, but I don't know how to make sure it does get picked up.
(If relevant, I'm doing this on Solaris 10 using Tomcat).
thank you for your help and insights.
posted 9 years ago
Is there a different sub-forum that would have been more appropriate for this question? I didn't see one that I thought was, but the question itself is not very specific to JSP other than that is the what the code is being implemented.
I just didn't see a SE General forum that I thought would be better.
Not the type of thing you should be doing in a JSP (there shouldn't be any code in a JSP), but bear in mind that within a web app, there's no concept of a "current directory" and so you must always use full paths when referring to the file system.