Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » cannot use url openstream with jre 1.3
cannot use url openstream with jre 1.3 [message #147104] Tue, 21 October 2003 06:00 Go to next message
Eclipse UserFriend
Hi,

In my EditorPart i try to parse a file through the DocumentBuilder. The
method as shown below is working if i start my plugin wiht jre 1.4.1_02. If
i use jre 1.3.1_02 the "testUrl.openStream()" results in a
"java.net.UnknownHostException: C". (I have to use 1.3 because the plugins
are to run in IBM's WSAD.)

What am i doing wrong here. I saw some other threads using
Platform.resolve(URL).
Is that the path i should take, is it not legal (in a eclipse environment)
to create a url as in the excerpt below?

Again, it is working with jre 1.4.



public void init(IEditorSite site, IEditorInput input) throws
PartInitException {

....

IFile file = ((IFileEditorInput)input).getFile();

IPath rootPath = file.getLocation().removeLastSegments(1);

IPath testPath = rootPath.append("test.xml");

URL testURL = new URL("file://" + testPath.toOSString());

DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();

InputStream in = testUrl.openStream();

Document testDocument = builder.parse(in);

....
Re: cannot use url openstream with jre 1.3 [message #147637 is a reply to message #147104] Tue, 21 October 2003 09:03 Go to previous message
Eclipse UserFriend
found it :-)

i changed
> URL testURL = new URL("file://" + testPath.toOSString());

in
URL testUrl = new File(testPath.toOSString()).toURL();


"S.Witte" <switte@eniac.nl> wrote in message
news:bn2vue$6ii$1@eclipse.org...
> Hi,
>
> In my EditorPart i try to parse a file through the DocumentBuilder. The
> method as shown below is working if i start my plugin wiht jre 1.4.1_02.
If
> i use jre 1.3.1_02 the "testUrl.openStream()" results in a
> "java.net.UnknownHostException: C". (I have to use 1.3 because the plugins
> are to run in IBM's WSAD.)
>
> What am i doing wrong here. I saw some other threads using
> Platform.resolve(URL).
> Is that the path i should take, is it not legal (in a eclipse environment)
> to create a url as in the excerpt below?
>
> Again, it is working with jre 1.4.
>
>
>
> public void init(IEditorSite site, IEditorInput input) throws
> PartInitException {
>
> ...
>
> IFile file = ((IFileEditorInput)input).getFile();
>
> IPath rootPath = file.getLocation().removeLastSegments(1);
>
> IPath testPath = rootPath.append("test.xml");
>
> URL testURL = new URL("file://" + testPath.toOSString());
>
> DocumentBuilder builder =
> DocumentBuilderFactory.newInstance().newDocumentBuilder();
>
> InputStream in = testUrl.openStream();
>
> Document testDocument = builder.parse(in);
>
> ...
>
>
Previous Topic:Programmatically import files to a Java Project
Next Topic:help:about IFile
Goto Forum:
  


Current Time: Mon Jul 14 00:48:24 EDT 2025

Powered by FUDForum. Page generated in 0.31584 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top