Prev: Gosling has left Oracle
Next: servlets and jsp doubt
From: NickPick on 12 Apr 2010 21:47 The following code works well: ObjectFile f = new ObjectFile(); Scene loadedShip = null; try { loadedShip = f.load("C:/Users/Nicolas/Documents/ NetBeansProjects/3dGame/src/Gamestar/obj.obj"); However, if I chagne teh file path to "http://www....obj.obj" I get an error message: java.io.FileNotFoundException: http:\www.......obj.obj (The filename, directory name, or volume label syntax is incorrect) When I type in the file name, it works fine. Can't I use f.load if the file is on the internet? And why is it changing the http:// into http \. Could this be a problem? thanks
From: John B. Matthews on 12 Apr 2010 23:04 In article <ec18f403-8391-4654-bd3b-66fab06ca2ea(a)z11g2000yqz.googlegroups.com>, NickPick <dickreuter(a)yahoo.com> wrote: > The following code works well: > ObjectFile f = new ObjectFile(); > Scene loadedShip = null; > try { > loadedShip = f.load("C:/Users/Nicolas/Documents/ > NetBeansProjects/3dGame/src/Gamestar/obj.obj"); > > However, if I chagne teh file path to "http://www....obj.obj" I get an > error message: > java.io.FileNotFoundException: http:\www.......obj.obj (The filename, > directory name, or volume label syntax is incorrect) > > When I type in the file name, it works fine. Can't I use f.load if the > file is on the internet? And why is it changing the http:// into http > \. Could this be a problem? The three overloads of load() each require a specific parameter: Reader, String or URL. You might try import java.net.URL; .... URL url = new URL("http://www...obj"); loadedShip = f.load(url); .... <http://download.java.net/media/java3d/javadoc/1.5.0/com/sun/j3d/loaders/ objectfile/ObjectFile.html> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
From: Lew on 12 Apr 2010 23:07 NickPick wrote: > The following code works well: > ObjectFile f = new ObjectFile(); > Scene loadedShip = null; > try { > loadedShip = f.load("C:/Users/Nicolas/Documents/ > NetBeansProjects/3dGame/src/Gamestar/obj.obj"); > > However, if I chagne teh file path to "http://www....obj.obj" I get an > error message: > java.io.FileNotFoundException: http:\www.......obj.obj (The filename, > directory name, or volume label syntax is incorrect) > > When I type in the file name, it works fine. Can't I use f.load if the > file is on the internet? And why is it changing the http:// into http > \. Could this be a problem? What does the documentation for 'ObjectFile' say? For that matter, what is 'ObjectFile'? I guess you figure people reading this list are familiar with every Java class ever written? But given that you got a 'java.io.FileNotFoundException' I'll take a risk and guess that 'ObjectFile' is a class designed to work on file systems. Internet connections are not file systems, so yes, it will fail to grok an "http:" URL. Or so I surmise. As to why it changes the slashes, again based on the total lack of information you give about 'ObjectFile', I venture to guess that under the hood it's attempting to normalize file paths for your host platform. I'd say it's not so much a problem as a symptom of the effort to use a file I/O class for 'Net access. -- Lew
From: Daniel Pitts on 13 Apr 2010 13:22 On 4/12/2010 8:07 PM, Lew wrote: > NickPick wrote: >> The following code works well: >> ObjectFile f = new ObjectFile(); >> Scene loadedShip = null; >> try { >> loadedShip = f.load("C:/Users/Nicolas/Documents/ >> NetBeansProjects/3dGame/src/Gamestar/obj.obj"); >> >> However, if I chagne teh file path to "http://www....obj.obj" I get an >> error message: >> java.io.FileNotFoundException: http:\www.......obj.obj (The filename, >> directory name, or volume label syntax is incorrect) >> >> When I type in the file name, it works fine. Can't I use f.load if the >> file is on the internet? And why is it changing the http:// into http >> \. Could this be a problem? > > What does the documentation for 'ObjectFile' say? > > For that matter, what is 'ObjectFile'? I guess you figure people reading > this list are familiar with every Java class ever written? > > But given that you got a 'java.io.FileNotFoundException' I'll take a > risk and guess that 'ObjectFile' is a class designed to work on file > systems. Internet connections are not file systems, so yes, it will fail > to grok an "http:" URL. Or so I surmise. > > As to why it changes the slashes, again based on the total lack of > information you give about 'ObjectFile', I venture to guess that under > the hood it's attempting to normalize file paths for your host platform. > I'd say it's not so much a problem as a symptom of the effort to use a > file I/O class for 'Net access. > It looks likely to be part of the Java3d API. http://download.java.net/media/java3d/javadoc/1.3.2/com/sun/j3d/loaders/objectfile/ObjectFile.html As was mentioned elsewhere, there is an overload of "load" which takes a URL object. -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
From: NickPick on 13 Apr 2010 15:06
On Apr 13, 4:04 am, "John B. Matthews" <nos...(a)nospam.invalid> wrote: > In article > <ec18f403-8391-4654-bd3b-66fab06ca...(a)z11g2000yqz.googlegroups.com>, > > > > NickPick <dickreu...(a)yahoo.com> wrote: > > The following code works well: > > ObjectFile f = new ObjectFile(); > > Scene loadedShip = null; > > try { > > loadedShip = f.load("C:/Users/Nicolas/Documents/ > > NetBeansProjects/3dGame/src/Gamestar/obj.obj"); > > > However, if I chagne teh file path to "http://www....obj.obj" I get an > > error message: > > java.io.FileNotFoundException: http:\www.......obj.obj(The filename, > > directory name, or volume label syntax is incorrect) > > > When I type in the file name, it works fine. Can't I use f.load if the > > file is on the internet? And why is it changing the http:// into http > > \. Could this be a problem? > > The three overloads of load() each require a specific parameter: Reader, > String or URL. You might try > > import java.net.URL; > ... > URL url = new URL("http://www...obj"); > loadedShip = f.load(url); > ... > > <http://download.java.net/media/java3d/javadoc/1.5.0/com/sun/j3d/loaders/ > objectfile/ObjectFile.html> > > -- > John B. Matthews > trashgod at gmail dot com > <http://sites.google.com/site/drjohnbmatthews> Thanks! That worked! |