asdflkjadsf
asked on
compiling error (cannot reslove sysmbol)
I have get the following error when compiling. Could someone provide me with a working solution?
FYI: The rt.exec only works when I put the variables into an array.
ThreeParams.java:43: cannot resolve symbol
symbol : variable args
location: class ThreeParams
FileOutputStream fos = new FileOutputStream(args[0]);
^
1 error
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ThreeParams extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("t ext/html") ;
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
out.println(ServletUtiliti es.headWit hTitle(tit le) +
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=CENTER>" + title + "</H1>\n" +
"<UL>\n" +
" <LI><B>param1</B>: "
+ request.getParameter("Name ") + "\n" +
" <LI><B>param2</B>: "
+ request.getParameter("Text ") + "\n" +
" <LI><B>param3</B>: "
+ request.getParameter("Date ") + "\n" +
"</UL>\n" +
"</BODY></HTML>");
String Date = request.getParameter("Date ");
String command = "/scripts/Script.sh";
String Text = request.getParameter("Text ");
String cmd[] = new String[3];
cmd[0]=command;
cmd[1]=Text;
cmd[2]=Date;
System.out.println();
FileOutputStream fos = new FileOutputStream(args[0]);
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
}
}
FYI: The rt.exec only works when I put the variables into an array.
ThreeParams.java:43: cannot resolve symbol
symbol : variable args
location: class ThreeParams
FileOutputStream fos = new FileOutputStream(args[0]);
^
1 error
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ThreeParams extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("t
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
out.println(ServletUtiliti
"<BODY BGCOLOR=\"#FDF5E6\">\n" +
"<H1 ALIGN=CENTER>" + title + "</H1>\n" +
"<UL>\n" +
" <LI><B>param1</B>: "
+ request.getParameter("Name
" <LI><B>param2</B>: "
+ request.getParameter("Text
" <LI><B>param3</B>: "
+ request.getParameter("Date
"</UL>\n" +
"</BODY></HTML>");
String Date = request.getParameter("Date
String command = "/scripts/Script.sh";
String Text = request.getParameter("Text
String cmd[] = new String[3];
cmd[0]=command;
cmd[1]=Text;
cmd[2]=Date;
System.out.println();
FileOutputStream fos = new FileOutputStream(args[0]);
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(cmd);
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Great.
ASKER