troubleshooting Question

compiling error (cannot reslove sysmbol)

Avatar of asdflkjadsf
asdflkjadsf asked on
Java
3 Comments1 Solution197 ViewsLast Modified:
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("text/html");
    PrintWriter out = response.getWriter();
    String title = "Reading Three Request Parameters";
    out.println(ServletUtilities.headWithTitle(title) +
                "<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);
        }
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros