• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Casting problem

 
Isaac Ferguson
Ranch Hand
Posts: 831
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try "HttpsURLConnection rc" instead of HttpURLConnection .
 
Paul Clapham
Sheriff
Pie
Posts: 20171
25
MySQL Database
  • 0
  • 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: 831
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved. Many thanks
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • 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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic