Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / November 2006

Tip: Looking for answers? Try searching our database.

new URL("c:/dir/file") OR new URL("c:\dir\file") OR new URL("file://c:/dir/file")

Thread view: 
FreeStyler - 03 Nov 2006 08:51 GMT
new URL("c:/dir/file") OR new URL("c:\dir\file") OR new
URL("file://c:/dir/file")

What is the correct syntax ? Is it the same as a new File ?FileDialog send:
"c:\Program Files\dir\file".
I have the feeling that different classes (File, URL, URl) have the
different syntax. Please say a), b) or c) and answer me does it is same for
all java classes which ask for a file path?
hiwa - 03 Nov 2006 09:08 GMT
FreeStyler のメッセージ:

> new URL("c:/dir/file") OR new URL("c:\dir\file") OR new
> URL("file://c:/dir/file")
[quoted text clipped - 4 lines]
> different syntax. Please say a), b) or c) and answer me does it is same for
> all java classes which ask for a file path?
Try File.toURI().toURL() and see the result, or use this expression as
is.
Paul Hamaker - 03 Nov 2006 09:19 GMT
URL("file://c:/dir/file") is okay, since it includes a valid protocol,
'file:' , and forward slashes .
See http://java.sun.com/j2se/1.5.0/docs/api/java/net/URL.html
and
http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
amo
FreeStyler - 03 Nov 2006 19:11 GMT
"Paul Hamaker" <ph@semm.tmfweb.nl> je napisao u poruci interesnoj
grupi:1162541943.141983.106490@f16g2000cwb.googlegroups.com...
> URL("file://c:/dir/file") is okay, since it includes a valid protocol,
> 'file:' , and forward slashes .
> See http://java.sun.com/j2se/1.5.0/docs/api/java/net/URL.html
> and
> http://www.gbiv.com/protocols/uri/rfc/rfc3986.html
> amo

this works:
URL
maxFile=TestMaxJmeWrite.class.getClassLoader().getResource("jmetest/data/mod
el/Character.3DS");

and this don't:
URL maxFile=new URL("file://d:/Character.3ds");
FreeStyler - 04 Nov 2006 16:00 GMT
"FreeStyler" <pascal@po.t-com.hr> je napisao u poruci interesnoj
grupi:eig0o8$9m7$1@ss408.t-com.hr...

> "Paul Hamaker" <ph@semm.tmfweb.nl> je napisao u poruci interesnoj
> grupi:1162541943.141983.106490@f16g2000cwb.googlegroups.com...
[quoted text clipped - 7 lines]
> this works:
> URL

maxFile=TestMaxJmeWrite.class.getClassLoader().getResource("jmetest/data/mod
> el/Character.3DS");
>
> and this don't:
> URL maxFile=new URL("file://d:/Character.3ds");

Finally this works:
URL maxFile=new URL("file:/d:/Character.3ds"); //not file://
but still can't figure out why all classes don't have the same syntax.
Somewhere "fille://" works
Tor Iver Wilhelmsen - 04 Nov 2006 16:17 GMT
> URL maxFile=new URL("file:/d:/Character.3ds"); //not file://
> but still can't figure out why all classes don't have the same syntax.
> Somewhere "fille://" works

The semantics is that // indicates a remote resource, e.g. a file on a
remote server could be

file://servername.foo.com/ExportedFolder/theFile.txt

Implicitly an empty server indication means the local machine, so

file:///d:/Character.3ds

should work.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.