I want to use jSoup on GWT server side code to be able to scrape web pages. The documentation of GWT does not help in installing external jars. Can anyone tell me how do I install the jSoup jar (downloaded from the official jSoup site) in GWT and use it in the server-side code?
Asked
Active
Viewed 997 times
5
-
1see this answer http://stackoverflow.com/questions/13988653/gwt-using-external-jar/13988769#13988769 – Saeed Zarinfam Jan 09 '13 at 07:07
-
2@Saeed the jar is a server side jar and not gwt client related!!! – appbootup Jan 09 '13 at 07:10
-
1Please don't close the question, II need it answered! – SexyBeast Jan 09 '13 at 07:12
3 Answers
3
By using eclipse you can do the following:
- Download the jsoup.jar
- Copy the file to the lib library of the project WEB-INF/lib
- Right click on the lib folder inside eclipse Refresh to see the new library.
- Add the library to the class path: Right click on the Project -> Build Path -> Configure Build Path -> Add external jar. Browse and add the jar
- Write the import jsoup statement inside any server side class and you can use it as usual.

Athanasios Kataras
- 25,191
- 4
- 32
- 61
2
If you are using it via simple GPE eclipse project then keep it in the WEB-INF/lib .
If you are using it via a maven GPE eclipse project then add to runtime classpath scope in dependencies.
Client server interaction in either of the above scenarios:
Step 1 - RPC Call to request processing of URL.
Step 2 - RPC Server side code i.e servlets for requesting and scraping a url http://vjdef.com/home/2011/06/scraping-html-using-java-servlets-and-tagsoup/
Step 3 - RPC Server side code sends back required message post processing to client.
Step 4 - onSucess callback of the Step 1 RPC invocation will receive message.

appbootup
- 9,537
- 3
- 33
- 65
-
I am not doing anything related to Maven. Just think of the default StockWatcher web app which comes with GWT. I just want to be able to import jSoup in the `GreetingServiceImpl.java` file, use it to scrape web page, gather some text info, and send it back to the client instead of the text sent there (something like Hello Cupidvogel..) – SexyBeast Jan 09 '13 at 07:12
-
2
If you want to use external jar then follow these steps
- Download jar
- copy that jar and paste to lib folder.(create a lib folder in root directory if you don't have lib folder)
- click Build Path-> Configure Build Path->Libraries->Add JARs then choose jar from lib folder.
- click Order and Support then tick the jars that you added
- Click ok
Now you can use it like other jars.

Parvathy
- 2,275
- 3
- 24
- 39