Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Casting problem  RSS feed

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the code




Then import is:

import sun.net.www.protocol.http.HttpURLConnection;


and the error ;



Any idea?

Many Thanks, Isaac
 
Alexei Kaigorodov
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "HttpsURLConnection rc" instead of HttpURLConnection .
 
Paul Clapham
Sheriff
Posts: 22374
42
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angus Ferguson wrote:import sun.net.www.protocol.http.HttpURLConnection;


Why that class? Just use the class from the standard API:

 
Isaac Ferguson
Ranch Hand
Posts: 1063
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved. Many thanks
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16006
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Angus Ferguson wrote:Then import is:

import sun.net.www.protocol.http.HttpURLConnection;

You should not be using classes in sun.* packages directly.

Explanation from Oracle: Why Developers Should Not Write Programs That Call 'sun' Packages
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!