New to java: where do i put new classes?
Sorry, I'm a c# transplant. I want a create a class that will be used on server side only. In c# I would just create a new class in the project... learning that java doesn't work that way. I have created a class within the main package of my GWT project (not client, not server, not shared, the main package). But I don't think this works. It wants to find a .gwt.xml file for this java class. So... what is the correct way to do this? Thanks. -- 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-tool...@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: New to java: where do i put new classes?
Nothing should be preventing you from creating non-client classes anywhere in the hierarchy, AFAIK. The gwt.xml file is just some meta- data used by the GWT compiler to build the client-side js code; includes of other modules, pointers to the client code etc. There should be no restrictions on server side code, so what errors are you seeing? On May 25, 9:41 am, m phillip...@gmail.com wrote: Sorry, I'm a c# transplant. I want a create a class that will be used on server side only. In c# I would just create a new class in the project... learning that java doesn't work that way. I have created a class within the main package of my GWT project (not client, not server, not shared, the main package). But I don't think this works. It wants to find a .gwt.xml file for this java class. So... what is the correct way to do this? Thanks. -- 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-tool...@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: New to java: where do i put new classes?
Actually, its nothing to do with the Java language explicitly. GWT is cleverly organized to make it quick and comparatively easy to build sophisticated Ajax apps without having to get too much into the details of Javascript. In a GWT project the GWT compiler cross-compiles a subset of the Java language to Javascript for downloading to the client browser. You have to tell it which classes to cross-compile and so the GWT project layout by convention has three separate sub-packages whose names end with 'client', 'server', 'shared'. You can also add sub-packages to these. 'client' and 'shared' packages are both compiled by the JRE for use in hosted mode, AND cross-compiled by GWT for use in production mode. 'client' is for code ONLY used in the client. 'shared' is for code (typically DTOs, or validation objects) which are used on both client and server. You should put classes which are server side only in x.x.x.server or sub packages. Then you should make sure that the classpath includes any libraries used by these packages by placing the libraries in the war/WEB-INF/lib folder and make sure that the JRE looks there. The exact configuration can be controlled from within a gwt.xml file. I suggest that you read the http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html section. See also the sections on Modules and Compile and Debug. Be warned! There's a learning curve in using Java, a STEEP learning curve in using Java in web projects and another significant learning curve to using GWT for client/server web applications. I suggest that you think carefully about the scope and requirements of your application before taking these 3 steps. Good luck! HTH Alan m wrote: Sorry, I'm a c# transplant. I want a create a class that will be used on server side only. In c# I would just create a new class in the project... learning that java doesn't work that way. I have created a class within the main package of my GWT project (not client, not server, not shared, the main package). But I don't think this works. It wants to find a .gwt.xml file for this java class. So... what is the correct way to do this? Thanks. -- 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-tool...@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: New to java: where do i put new classes?
Well I'm also doing it on App Engine if that adds a 4th learning curve ;) Java code looks pretty much like C# so I think I can easily learn that part of it. I moved the code to the server package. When I start the server I get this message: Loading modules com.mycomp.foo.bar.bar [ERROR] Unable to find 'com/mycomp/foo/bar/bar.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? I had previously tried moving the bar class into it's own package. I think this is what it is referring to here. However I've since moved the class to the server package as per your suggestion. So there must be a reference to this non-existant package some where. Where would I look? On May 26, 10:24 am, Alan Chaney a...@mechnicality.com wrote: Actually, its nothing to do with the Java language explicitly. GWT is cleverly organized to make it quick and comparatively easy to build sophisticated Ajax apps without having to get too much into the details of Javascript. In a GWT project the GWT compiler cross-compiles a subset of the Java language to Javascript for downloading to the client browser. You have to tell it which classes to cross-compile and so the GWT project layout by convention has three separate sub-packages whose names end with 'client', 'server', 'shared'. You can also add sub-packages to these. 'client' and 'shared' packages are both compiled by the JRE for use in hosted mode, AND cross-compiled by GWT for use in production mode. 'client' is for code ONLY used in the client. 'shared' is for code (typically DTOs, or validation objects) which are used on both client and server. You should put classes which are server side only in x.x.x.server or sub packages. Then you should make sure that the classpath includes any libraries used by these packages by placing the libraries in the war/WEB-INF/lib folder and make sure that the JRE looks there. The exact configuration can be controlled from within a gwt.xml file. I suggest that you read thehttp://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjec... section. See also the sections on Modules and Compile and Debug. Be warned! There's a learning curve in using Java, a STEEP learning curve in using Java in web projects and another significant learning curve to using GWT for client/server web applications. I suggest that you think carefully about the scope and requirements of your application before taking these 3 steps. Good luck! HTH Alan m wrote: Sorry, I'm a c# transplant. I want a create a class that will be used on server side only. In c# I would just create a new class in the project... learning that java doesn't work that way. I have created a class within the main package of my GWT project (not client, not server, not shared, the main package). But I don't think this works. It wants to find a .gwt.xml file for this java class. So... what is the correct way to do this? Thanks. -- 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-tool...@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: New to java: where do i put new classes?
Ok, this is just a simple GWT setup issue. When you start GWT, the main argument is the module you're running, in your case com.mycomp.foo.bar.bar. This isn't a java class, but an xml file that has the metadata to tell GWT about your client app, and potentially any servlet you want run, discussed here: http://code.google.com/webtoolkit/doc/latest/tutorial/create.html#components. I'd strongly recommend you run through the tutorial in the docs, or one of the sample projects, as these give you a great understanding of how GWT is actually working, and also provide a template so you can see all the components needed for your project. On May 26, 2:58 pm, m phillip...@gmail.com wrote: Well I'm also doing it on App Engine if that adds a 4th learning curve ;) Java code looks pretty much like C# so I think I can easily learn that part of it. I moved the code to the server package. When I start the server I get this message: Loading modules com.mycomp.foo.bar.bar [ERROR] Unable to find 'com/mycomp/foo/bar/bar.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? I had previously tried moving the bar class into it's own package. I think this is what it is referring to here. However I've since moved the class to the server package as per your suggestion. So there must be a reference to this non-existant package some where. Where would I look? -- 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-tool...@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.