Hi Walden,

Here's what I did:

1) My current project is set up with the source code as

*project
  - webroot (all JSP, WEB-INF, etc lie here)
  - src
     - package
          - subpackage
                   - Class1
                  -  Class2
                   - subpackage2
                        - Class3*

So now when adding GWT here's what i did:

1) I ran the applicationCreator command under the project directory,
so if
the name of my GWT module is going to be gwt_test

*project
  - webroot
  - src
  - gwt_test
*
So in order to import Class1, i created a subpackage.gwt.xml  under
the
subpackage directory
*     - subpackage
        - subpackage.gwt.xml
        - Class1
        - Class2....*

The contents of this were

*<module>
      <source path="Class1"/>
</module>*

Now in my GWT module

gwt_test
  - src
      - package1
            - subpackage
                 - gwt
                       - client
                             - Gwt_test.java

I added the import statement to the Gwt_test.java  as a regular
import  -
"import package.subpackage.Class1"
I modified the class path of gwt_test-compile.cmd to contain the
additional
path to the  subpackage.gwt.xml i.e  *C:/...../subpackage.gwt.xml *

Upon trying to GWT compile this, i still get the error

Removing units with errors
   [ERROR] Errors in
'file:/C:/eclipse_workspace/project/gwt_test/src/package1/
subpackage.gwt.client.Gwt_test.java'
      [ERROR] Line 12: The import package.subpackage.Class1 cannot be
resolved
Compiling module package1.subpackage.gwt.client.Gwt_test
Computing all possible rebind results for
'package1.subpackage.gwt.client.Gwt_test'
   Rebinding package1.subpackage.gwt.client.Gwt_test.java
      Checking rule <generate-with
class='com.google.gwt.user.rebind.ui.ImageBundleGenerator'/>
         [ERROR] Unable to find type
'package1.subpackage.gwt.client.Gwt_test'
            [ERROR] Hint: Previous compiler errors may have made this
type
unavailable
            [ERROR] Hint: Check the inheritance chain from your
module; it
may not be inheriting a r
equired module or a module may not be adding its source path entries
properly
[ERROR] Build failed

Actual class names have been substituted for privacy. Let me know what
I'm
doing wrong.
Also additionally, I'd still like to know how to deal with this if I
had to
be importing from a jar. I ask, because ideally I do not want to be
disturbing the current code structure too much and for curiosity I'd
like to
know the limitation of GWT with this regard. When I do import from a
jar,
does the jar being used need to have the source files as well as the
class
files for the project. So for example if I was trying to use some 3rd
party
or open source jar, then how would this work because most of the time
we'd
be downloading and using binaries right.

Thanks
Suri

- Hide quoted text -
- Show quoted text -

On Sep 29, 8:47 am, walden <[EMAIL PROTECTED]> wrote:
> Suri,
>
> If the current Java code is in the same project where you are adding
> GWT on the client, you don't need a jar.
>
> Your current Java code does have to be sanitized to meet the 'closed
> world' requirements of the GWT compiler.  Read the documentation on
> the GWT compiler and JRE emulation classes for details.
>
> Your current Java code will have to be findable by the GWT compiler,
> which means there must be a .gwt.xml file on the classpath when you
> run the GWT compiler (you'll need to create that), and it needs to
> indicate where the compile sources are.  There are basically two ways
> to approach this part:
>
> 1. keep your sources exactly where they are; place your Pkg1.gwt.xml
> file in the root folder of the smallest containing sub-tree for all
> the classes you need to include, and use the <source path="x"/> tag as
> many times as necessary to indicate (and hopefully isolate) just the
> classes you want compiled by GWT.
>
> 2. do a little folder reorganization so that the classes you will
> share between server and client side are isolated cleanly; have a
> 'client' folder at the root of that sub-tree, and place your
> Pkg1.gwt.xml file as a direct sibling to the client folder.  Then you
> don't need <source> tags.
>
> Try that, report any errors you get, and we'll sort it out from there.
>
> Walden
>
> On Sep 27, 3:30 pm, Suri <[EMAIL PROTECTED]> wrote:
>
> > Hi All,
> > I'm a GWT newbie and I've just come fresh after reading up the basics
> > from the Google GWT tutorial. Here's my situation:
>
> > I have an existing Java based web application (Struts based). Now I'm
> > trying to add a new module to it and figure I'd try to incorporate GWT
> > - mostly because I expect the new module to be a few very dynamic
> > pages communicating with the server often.
>
> > Now my first question is, how do I reference my current Java code in
> > this GWT program. i.e if i have the following
>
> > com.pkg1.Class1;
> > com.pkg1.pkg2.Class2;
>
> > in my existing Java code,
>
> > and in my GWT java class I import these 2 classes for implementation,
> > what are the exact steps I need to follow so that these are correctly
> > added to the GWT program and can compile. So far, I haven't seemed to
> > have found a definitive answer to this problem. I saw a few solutions
> > of people saying a jar needs to be included and it needs to have a
> > <name>.gwt.xml file which gets inherited or something but didn't quite
> > understand what exactly they meant.Some others spoke about source code
> > having to be available for the program to compile in order to convert
> > the javascript. The reading ended up leaving me in a half baked
> > situation which still doesn't help my GWT program compile.
>
> > I'd really appreciate some help and maybe a few fundamentals on what
> > needs to be happening.
>
> > Thanks
> > Suri
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to