I have a java web app where i need to use a simple web crawler to read html from webpages. I could not find any simple solution for this in java. But got a very simple python script that solve my problem. Now how to call that python script (.py) from my java class and also get the returned value from the python script .Thanks in advance .
Asked
Active
Viewed 367 times
0
-
The [jsoup](http://jsoup.org/cookbook/input/parse-document-from-string) library looks very simple, you can load HTML in one call and it has selectors so you can pull out elements easily. I think getting python integrated will be much harder than using such a library. – Rich Henry Feb 05 '15 at 01:12
-
Also if you need a method to load HTTP from a site, you could use [Apache HTTPClient](http://hc.apache.org/httpclient-3.x/methods/get.html). – Rich Henry Feb 05 '15 at 01:13
1 Answers
1
First check out Calling Python in Java?
Another approach might be to call the python interpreter from the command line with a Java Process. See Java Process with Input/Output Stream and Call python script within java code (runtime.exec)

Ben Holland
- 2,309
- 4
- 34
- 50