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 .
-
The jsoup 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– Rich Henry2015-02-05 01:12:14 +00:00Commented Feb 5, 2015 at 1:12
-
Also if you need a method to load HTTP from a site, you could use Apache HTTPClient.Rich Henry– Rich Henry2015-02-05 01:13:39 +00:00Commented Feb 5, 2015 at 1:13
Add a comment
|
1 Answer
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)