Re: No source code is available for type java.io.File; did you forget to inherit a required module?
Hi Raghu, The GWT compiler complains because it doesn't support the full range of Java classes present in your run of the mill JRE. The reason for this can be found in asking the question; What does the GWT compiler produce as output?. Answering this question yields a far more pertinent question; Where does the resulting JavaScript execute?. The answer of course is the client's browser. Knowing this, it's fairly safe to assume that if we can achieve the same thing using pure JavaScript in the browser (i.e. we could port our Java code to JavaScript) then it's possible with GWT. Given that a browser has no native mechanism that supports file IO (besides perhaps the file input tag) then it makes sense that there would be no File class in GWT. The GWT developers know this and to this extent they've exposed a great deal of base Java classes (primarily the java.lang package) as native peers. This is relatively straight-forward for things like String which can easily be wrapped with a Java class that provides the expected API yet are manipulated underneath the covers using standard JS string functions. If you're ever unsure as to whether or not a native Java class is supported in GWT you can always refer back to the JRE emulation reference here: http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5s=google-web-toolkit-doc-1-5t=RefJreEmulation Regards, Dave On Mar 4, 4:07 am, Lothar Kimmeringer j...@kimmeringer.de wrote: raghu prashanth k b schrieb: Hi...I am new to GWT and i'm trying to develop a small application...but here i need to open a directory and count the no.of files in it...I'm doing it as follows: File dir = new File(file); String[] pages = dir.list(); int count = pages.length; If you do that on the client-side of your application, you should ask yourself, how you would do that with Javascript. If you can come up with an answer (you can't without the use of signed applets or other tweaks), the compiler can't either. This is a question that has been answered so many times already that searching for the error-message, in this group should bring up a lot of results, including ways how to solve your problem (that is dependent if you really want to have a file-list of the files residing on the client-side or if you want ot list files residing on the server-side). Regards, Lothar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
No source code is available for type java.io.File; did you forget to inherit a required module?
Hi...I am new to GWT and i'm trying to develop a small application...but here i need to open a directory and count the no.of files in it...I'm doing it as follows: File dir = new File(file); String[] pages = dir.list(); int count = pages.length; I have imported java.io.File but the GWT compiler gives me the following error.plz help No source code is available for type java.io.File; did you forget to inherit a required module? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: No source code is available for type java.io.File; did you forget to inherit a required module?
I have imported java.io.File but the GWT compiler gives me the following error.plz help No source code is available for type java.io.File; did you forget to inherit a required module? How are you compiling? shell script or ant build? In either case, your .java file has imported the code but the build script or ant build doesn't know where to find java.io.File. You'll have to pass in the .jar location to the script or ant build file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: No source code is available for type java.io.File; did you forget to inherit a required module?
Doesn't matter. You won't be able to use java.io.File on the client. You can't access the client's file system without using an Applet, Flash, ActiveX, or other component to which the user has granted permission. On Tue, Mar 3, 2009 at 11:57 AM, Shawn Brown big.coffee.lo...@gmail.com wrote: I have imported java.io.File but the GWT compiler gives me the following error.plz help No source code is available for type java.io.File; did you forget to inherit a required module? How are you compiling? shell script or ant build? In either case, your .java file has imported the code but the build script or ant build doesn't know where to find java.io.File. You'll have to pass in the .jar location to the script or ant build file. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: No source code is available for type java.io.File; did you forget to inherit a required module?
raghu prashanth k b schrieb: Hi...I am new to GWT and i'm trying to develop a small application...but here i need to open a directory and count the no.of files in it...I'm doing it as follows: File dir = new File(file); String[] pages = dir.list(); int count = pages.length; If you do that on the client-side of your application, you should ask yourself, how you would do that with Javascript. If you can come up with an answer (you can't without the use of signed applets or other tweaks), the compiler can't either. This is a question that has been answered so many times already that searching for the error-message, in this group should bring up a lot of results, including ways how to solve your problem (that is dependent if you really want to have a file-list of the files residing on the client-side or if you want ot list files residing on the server-side). Regards, Lothar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---