title: UnknownHostException java
body: <p>My program runs perfectly for sometime time, but after that I get an error</p>
  
  <pre><code>java.net.UnknownHostException: www.sears.com
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
  at java.net.Socket.connect(Socket.java:589)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
  at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:666)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1534)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
  at extractData.ReviewsSearch.getJsonResponse(ReviewsSearch.java:28)
  at main.java.DepartmentCategories_Main.main(DepartmentCategories_Main.java:110)
  
  java.net.UnknownHostException: www.sears.com
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
  at java.net.Socket.connect(Socket.java:589)
  at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
  at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
  at sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:211)
  at sun.net.www.http.HttpClient.New(HttpClient.java:308)
  at sun.net.www.http.HttpClient.New(HttpClient.java:326)
  at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1167)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1103)
  at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:997)
  at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:931)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1511)
  at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439)
  at extractData.productHierarchySearch.getHierarchy(productHierarchySearch.java:27)
  at main.java.DepartmentCategories_Main.main(DepartmentCategories_Main.java:115)
  </code></pre>
  
  <p>Any idea, what can be the reason? Let me know if more information is required</p>
  
  <p>edit: 
  I tried ping command and I realized it is the internet connection. I am running the program in an ssh server and want to know how can I keep the code from stopping. I want it to wait for the connection.</p>