Runtime.getRuntime().exec(...) with Servlets!!!

Hi Guys!!

I am trying to use Runtime.getRuntime().exec(cmd) with servlets, where 'cmd' is a command to remove html tags using some external program. This is working fine without servlets but servlets are not doin any conversion.

I read somewhere that for this, I have to change the permission settings in 'catalina.policy' file. If thats true, please tell me how can I do that?

Alternatively tell me some way to remove all html tags from a text file & just getting the useful text.

Thnks in advance!!

[540 byte] By [ranam1a] at [2007-10-3 1:10:24]
# 1
Removing the HTML tahgs of what? I dont think that it is something deficult to do with the java code itself. Try to do it in java.
LRMKa at 2007-7-14 18:07:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Actually I m using URL class to open a Url & saving the result in a text file.

As this text file contains html tags which I dont want, I am using html-to-text converter.

I tried using java code to remove tags as well, but the output is not as good as its coming up with external program.

I just want the useful text out of that file ignoring very other thing.

ranam1a at 2007-7-14 18:07:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

As far as my understanging the tool you are using should be used at the client side after saving the output to a file you can use it to conver to text. Correct me If I am wrong.

In order for same to work with your servlet first you will have to give the absolute/relative path to the executable (most cases) and also the servers security policy must allow your servlet to create a new process.

And the platform that your server suns on should support your tool.

If this external tools is in java you can decompile it or download its source and see what is the class and method that does actual dirty work and you can directly invoke it in your code.

Otherwise there are many Java HTML parsers out there you can use one of them.

LRMKa at 2007-7-14 18:07:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Solved the problem!!Changed some security settings in catalina.policy file, which allowed exec() method to work with servlets.The external tool wasnt in Java, otherwise I could have used its API.Anyways.. thnks a lot for ur help
ranam1a at 2007-7-14 18:07:17 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...