revanthb3000 0 Newbie Poster

I'm having trouble trying to run the unoconv command in a .jsp file.

Here's my code :

String pyfilelocation = request.getRealPath ("/") ;
String[] cmd = new String[4];
cmd[0] = "unoconv";
cmd[1] = "-f";
cmd[2] = "html";
cmd[3] = "temp.doc";
Runtime rt = Runtime.getRuntime ();
Process pr;
String helplocation = request.getRealPath ("/") + "helpdesk/";
File cwd = new File (helplocation);
try
{
    pr = rt.exec (cmd, null, cwd);
    pr.waitFor ();
    BufferedReader reader = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String line = reader.readLine();
    while (line != null)
    {
        out.println(line);
        line = reader.readLine();
    }
    pr.destroy ();
}
catch(Exception e)
{
    out.println(e);
}

This piece of code should convert the file temp.doc to temp.html.

I tested this file on Ubuntu and it works like a charm !! But after migrating to Fedora, it doesn't work anymore. I don't get any exceptions, I don't get any errors. Absolutely nothing.

BTW unoconv works well using terminal.

Here a few things I tried:
1. Simple commands like ls,pwd,who and even python work.
2. A simple unoconv -h doesn't work as well.
3. I tried using shell scripts. I used the following file :

uname
ls
who
w
ls -l
unoconv -h

I tried executing the file using the terminal and it worked. But when I tried running the file using the ./file.sh command in jsp I got the output of all the commands except the last one(unoconv -h).

I've been trying different stuff but to no avail. I think I might have to change the second argument of rt.exec() but I'm not sure what to do with it.

Hope someone can help me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.