Delete a File given an url using java
<pre><code>        URL urlImage = new URL(candidateImagePath);
    BufferedImage image = ImageIO.read(urlImage);
    String imageName = urlImage.getFile().split("/")[3];

    String pathImage = messageSource.getMessage("consultant.image", null,   Locale.ENGLISH)+messageSource.getMessage("system.slash", null, Locale.ENGLISH)+candidateid;
    File fileDir = new File(pathImage); 
    fileDir.mkdirs();
    ImageIO.write(image, "jpg" ,new File(pathImage+messageSource.getMessage("system.slash", null, Locale.ENGLISH)+imageName));
</code></pre>

<p>I am trying to get an image uploaded by iphone guys to a temporary url .
I read the image and write it to my desired location which is 'pathImage'. 
Till here everything works fine.</p>

<p>I want to delete the temporary file in the url.</p>

<p>I want to know how can I delete the image when the url is given in java. Kindly help on this .</p>
