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

  • SEARCH
  • Home
  • 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 8050593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:07:14+00:00 2026-06-05T07:07:14+00:00

The following code is throwing the exception below: URL u = new URL(file://D:/abc.xml); InputStream

  • 0

The following code is throwing the exception below:

URL u = new URL("file://D:/abc.xml");
InputStream input = u.openStream();

Exception thrown:

Exception in thread "main" java.net.UnknownHostException: D
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.NetworkClient.openServer(NetworkClient.java:118)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:488)
at sun.net.ftp.FtpClient.openServer(FtpClient.java:475)
at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:270)
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:352)
at java.net.URL.openStream(URL.java:1010)
at com.nuance.nlu.JavaApiExmaple.main(Exmaple.java:191)
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183):  [../../../src/share/back/util.c:820]

However if I use:

  • URL u = new URL("file:///D:/abc.xml"); (3 slashes after file), or:
  • URL u = new URL("file:/D:/abc.xml"); (1 slash after file:)

the line of code InputStream input = u.openStream(); executes fine.

  • 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-06-05T07:07:16+00:00Added an answer on June 5, 2026 at 7:07 am

    First see: What is the reason that file URLs start with three slashes: “file:///” etc? for a detailed description.

    Excerpt from that answer:

    The complete syntax is file://host/path.

    If the host is localhost, it can be omitted, resulting in file:///path.

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

Sidebar

Related Questions

All the variations of wait(...) are throwing the below exception from the following code.
There is unsurprisingly a run time exception thrown by the following code : data
i got the following exception when i run the code below. this is an
My code is throwing the above exception on the following line (line 2 of
I have the following code. In that fn2 is actually throwing an exception and
The following code throws an exception terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_function_call>
The following code is throwing exception because string field has the SQL reserved word
In the following code t.schedule(timertask, d.getDate(), 1000); is throwing NullPointer exception help me out
We have following code: try { // some code throwing MyException } catch (MyException
The following code is throwing the error this.element is null. However, the wid_cont is

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.