Take the 2-minute tour ×

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?

share|improve this question
@Saeed the jar is a server side jar and not gwt client related!!! –  SSR Jan 9 '13 at 7:10
Please don't close the question, II need it answered! –  Cupidvogel Jan 9 '13 at 7:12
add comment

3 Answers

up vote 2 down vote accepted

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.

share|improve this answer
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..) –  Cupidvogel Jan 9 '13 at 7:12
Please explain how do I import the jSoup jar file in my server side code.. –  Cupidvogel Jan 9 '13 at 7:22
Is the above set up showing errors for jsoup import statements? –  SSR Jan 9 '13 at 8:44
Lemme check, will let you know... –  Cupidvogel Jan 9 '13 at 8:47
add comment

By using eclipse you can do the following:

  1. Download the jsoup.jar
  2. Copy the file to the lib library of the project WEB-INF/lib
  3. Right click on the lib folder inside eclipse Refresh to see the new library.
  4. 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
  5. Write the import jsoup statement inside any server side class and you can use it as usual.
share|improve this answer
add comment

If you want to use external jar then follow these steps

  1. Download jar
  2. copy that jar and paste to lib folder.(create a lib folder in root directory if you don't have lib folder)
  3. click Build Path-> Configure Build Path->Libraries->Add JARs then choose jar from lib folder.
  4. click Order and Support then tick the jars that you added
  5. Click ok

Now you can use it like other jars.

share|improve this answer
add comment

Your Answer


