GWT import external jar

1,714 views
Skip to first unread message

Qing

unread,
Apr 4, 2009, 12:49:14 AM4/4/09
to Google Web Toolkit
Hi,

I'm now using gwt develop my web application. I create a gwt project
'OnlineBanker' in command line and import it into eclipse. The server
side code of OnlineBanker need to use the class in another java
project 'FinancialToolkit'. I export FinancialTookit as a jar file,
and import it into OnlineBanker by following away:
OnlineBanker->Properties->Java build path-> libraries -> Add external
Jars
and I add
<inherits name='FinancialFookit'/>into OnlineBanker.gwt.xml
I run it as OnlineBanker-shell, there's error
[ERROR] Unable to find 'FinancialTookit.gwt.xml' on your classpath;
could be a typo, or maybe you forgot to include a classpath entry for
source?

Any advice?

Nicanor Babula

unread,
Apr 4, 2009, 1:16:40 AM4/4/09
to Google-We...@googlegroups.com

Qing

unread,
Apr 4, 2009, 2:36:36 AM4/4/09
to Google Web Toolkit
I added FinancialToolkit.gwt.xml into the jar. Doesn't work. do I need
to put this file to the folder of OnlineBanker as well?

On Apr 4, 12:16 am, Nicanor Babula <nicanor.bab...@gmail.com> wrote:
> Hi,
>         It looks like you have to add to your jar file FinancialToolkit.gwt.xml.
> This may help:http://roberthanson.blogspot.com/2006/05/how-to-package-gwt-component...http://code.google.com/p/google-web-toolkit-incubator/wiki/PathsHandl...

Vitali Lovich

unread,
Apr 4, 2009, 2:58:01 AM4/4/09
to Google-We...@googlegroups.com
Wait, if you only have a dependancy in your server-side code, why are
you trying to integrate the client code?

Qing

unread,
Apr 4, 2009, 9:18:35 AM4/4/09
to Google Web Toolkit
You mean I don't need to add <inherits name='FinancialFookit'/> to the
OnlineBanker.gwt.xml?

On Apr 4, 1:58 am, Vitali Lovich <vlov...@gmail.com> wrote:
> Wait, if you only have a dependancy in your server-side code, why are
> you trying to integrate the client code?
>
> On Sat, Apr 4, 2009 at 2:36 AM,Qing<zq.zhangq...@gmail.com> wrote:
>
> > I added FinancialToolkit.gwt.xml into the jar. Doesn't work. do I need
> > to put this file to the folder of OnlineBanker as well?
>
> > On Apr 4, 12:16 am, Nicanor Babula <nicanor.bab...@gmail.com> wrote:
> >> Hi,
> >>         It looks like you have to add to your jar file FinancialToolkit.gwt.xml.
> >> This may help:http://roberthanson.blogspot.com/2006/05/how-to-package-gwt-component......

Jason Essington

unread,
Apr 6, 2009, 11:06:54 AM4/6/09
to Google-We...@googlegroups.com
That is correct, if your external library is only used on the server
side (Hibernate, axis, etc) then there is no need to reference it in
your gwt.xml file.

However, if you do need to use it in your client code then it must
contain source (.java files) as well as have a gwt.xml file of its
own, AND be "translatable" (not something that your average java lib is)

-jason

Qing

unread,
Apr 22, 2009, 12:53:29 PM4/22/09
to Google Web Toolkit
Oh, i see. Thank you! It works.

vogella

unread,
May 24, 2009, 8:27:24 PM5/24/09
to Google Web Toolkit
Hi,

I included a example description for including external jars / Java
projects into GWT projects (client side) in this tutorial:
http://www.vogella.de/articles/GWT/article.html

Best regards, Lars

On 22 Apr., 18:53, Qing <zq.zhangq...@gmail.com> wrote:
> Oh, i see. Thankyou! It works.
>
> On Apr 6, 10:06 am, Jason Essington <jason.essing...@gmail.com> wrote:
>
> > That is correct, ifyourexternal library is only used on the server  
> > side (Hibernate, axis, etc) then there is no need to reference it in  
> >yourgwt.xmlfile.
>
> > However, ifyoudo need to use it inyourclient code then it must  
> > containsource(.java files) as well as have agwt.xmlfile of its  
> > own, AND be "translatable" (not something thatyouraverage java lib is)
>
> > -jason
>
> > On Apr 4, 2009, at 7:18 AM,Qingwrote:
>
> > >Youmean I don't need to add <inherits name='FinancialFookit'/> to the
> > > OnlineBanker.gwt.xml?
>
> > > On Apr 4, 1:58 am, Vitali Lovich <vlov...@gmail.com> wrote:
> > >> Wait, ifyouonly have a dependancy inyourserver-side code, why are
> > >>youtrying to integrate the client code?
>
> > >> On Sat, Apr 4, 2009 at 2:36 AM,Qing<zq.zhangq...@gmail.com> wrote:
>
> > >>> I added FinancialToolkit.gwt.xmlinto the jar. Doesn't work. do I  
> > >>> need
> > >>> to put this file to the folder of OnlineBanker as well?
>
> > >>> On Apr 4, 12:16 am, Nicanor Babula <nicanor.bab...@gmail.com> wrote:
> > >>>> Hi,
> > >>>>         It looks likeyouhave to add toyourjar file  

Iqbal Singh

unread,
Apr 23, 2014, 1:25:42 PM4/23/14
to google-we...@googlegroups.com, Google Web Toolkit
Hi I am also facing this same problem.
i have a jar file that contains .class files which I need for my project
How do I import them to my GWT project?

Juan Pablo Gardella

unread,
Apr 24, 2014, 6:26:24 AM4/24/14
to google-we...@googlegroups.com
If you want to use this jar to be converted to javascript you need to add the sources no the .class. If you are using maven is easy:

<dependency>
<groupId>com.foo</groupId>
<artifactId>foo</artifactId>
<version>....</version>
                        <!-- Probably provided if you only use in the client side.-->  
</dependency>
<dependency>
<groupId>com.foo</groupId>
<artifactId>foo</artifactId>
<version>....</version>
                         <classifier>sources</classifier>
</dependency>

And in your GWT module add

<source path='com.foo' /> The package of the classes that you need.

BUT remember, not all classes can be converted to JS, check http://www.gwtproject.org/doc/latest/RefJreEmulation.html



--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages