Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 353817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:51:57+00:00 2026-05-12T11:51:57+00:00

(I have a problem that I illustrated in this question but had no correct

  • 0

(I have a problem that I illustrated in this question but had no correct answers. I refined my problem and tried to edit the initial question to reflect that but I guess because of the way SO displays unanswered questions it lost momentum and there is no way to revive it. So I am posting my correct question again).


I have a file that resides on a shared network location :

"\\KUROSAVVAS-PC\Users\kuroSAVVAS\Desktop\New     Folder\Warsaw    Panorama.JPG"

(The spaces are there intentionally)

The following code :

import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

public class Test {

    public static void main(String[] args) {
        try {
            String s = "\\\\KUROSAVVAS-PC\\Users\\kuroSAVVAS\\Desktop\\New     Folder\\Warsaw    Panorama.jpg";
            File f = new File(s);
            System.out.println(f.exists());
            Desktop.getDesktop().open(f);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}

Prints to the console that the file exists (System.out.println(f.exists());) but throws this exception! :

java.io.IOException: Failed to open file:////KUROSAVVAS-PC/Users/kuroSAVVAS/Desktop/New%20%20%20%20%20Folder/Warsaw%20%20%20%20Panorama.jpg. Error message: The system cannot find the file specified.

    at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:59)
    at sun.awt.windows.WDesktopPeer.open(WDesktopPeer.java:36)
    at java.awt.Desktop.open(Desktop.java:254)
    at Test.main(Test.java:13)

Has anyone any idea why something like this may happen? I have tried everything from creating URIs to decoding them afterwards… Nothing works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:51:57+00:00Added an answer on May 12, 2026 at 11:51 am

    It seems that there is a bug when you try to access a resource on a network drive with spaces in the path. See this entry in Sun’s bug database.

    Since the bug is already a year old, I don’t think you’ll get a fix anytime soon. Try the latest VM. If that doesn’t help, try to get the source for WDesktopPeer. Instead of encoding the path, try to keep it as it was (with backslashes and all) and put quotes around it. That might work.

    [EDIT] Specifically, don’t replace \ with /, do not prepend file:// and leave the spaces as they are (instead of replacing them with %20)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would be certain that this question addresses something that would have been brought
I have a problem that confuses my users, being that although an item is
I have the problem that an specific step in Ant can only be executed
I have a problem that I would like have solved via a SQL query.
I have a problem that I feel is best implimented in a stand alone
I have a problem that seems like its a result of a deadlock-situation. Whe
I have the odd problem that I am not able to open the properties
I have encountered a problem that I have not come accross yet when setting
I have a tricky problem that I've been messing about with for a few
I have a problem with the jquery-ui dialog box . The problem is that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.