views:

130

answers:

4

I am building my project using GWT plugin for Eclipse Galileo. When I was done with RPC between the server and client, I tried to make a reference in the GWT project to a normal Java class in non-GWT project, but everytime when I create an object of this class I get a ClassNotFoundException. I did the buildpath for the GWT project, but it still gives me the same exception. Is there a way to get it to work?

A: 

i did the buildpath for the gwt project, but still gives me the same exception

Likely you did it wrong. Those libraries should after all end up in /WEB-INF/lib. In Eclipse, you need to ensure that the GWT project is a Dynamic Web Project and that the non-GWT project is a Java Project. Then in the Buildpath properties of the GWT project, you need to add the non-GWT project in Projects tab. In the Java EE Module Dependencies you need to select the non-GWT project as well.

alt text

If that doesn't solve the problem, then please update your question to include the entire stacktrace.

BalusC
thanks BalusC for replaymy GWT is Dynamic web project and the non-gwt project is java project, i make sure that i did the build path correctly from the gwt project side, but the missed thing is the Java EE Module Dependencies, i cant find it, maybe because im using Eclipse IDE for Java Developers, not Eclipse IDE for Java EE Developers.do i need to use Eclipse IDE for Java EE Developers ?
Mohammed_Q
No you don't have to (but I strongly recommend it)
Xorty
In a default installation of Eclipse for Java (which lacks the WTP) you can't create a *Dynamic Web Project*. If you are certain that you created a *Dynamic Web Project* then you already have Eclipse for Java EE or you've installed WTP separately. The *Java EE Module Dependencies* should be listed in the left column of the project properties.
BalusC
It's by the way ["reply"](http://www.thefreedictionary.com/reply) not ["replay"](http://www.thefreedictionary.com/replay).
BalusC
thanks for reply again..lolim downloading Eclipse IDE for Java EE Developers and i hope everything will be oki will keep you updated
Mohammed_Q
in GWT project properties there is no Java EE Module Dependencies appear, i can see it for Dynamic web projects only, what i should do?
Mohammed_Q
Create a new dynamic web project, copy/move/backup the source and trash the old non-dynamic web project.
BalusC
the problem is im building my project using GWT, i cant change my GWT project to dynamic web project....anyway, thanks a lot for helping
Mohammed_Q
A: 

GWT compiles the code to Javascript, it is then run on the browser. You can write some Java classes that run inside a Servlet engine, the only way to get them to communicate is to use some form of RPC.

Romain Hippeau
but what i know the server side code not translate to JavaScript, only the client side, you also can specify which packages you want to translate to JavaScript, you can done that from the module. (correct me if im wrong)
Mohammed_Q
@Mohammed_Q If you want your stuff in GWT to be both visible to both the client and the server you need to put the files under the client folder
Romain Hippeau
A: 

I found the solution, to make any object from any non-gwt-project in gwt-project you should make sure to disable the Google App Engine, its somehow make that class invisible. thanks for all the suggestions

Mohammed_Q
A: 

Better to show some code to understand that what u actually want.

Basically in GWT java class u can create object of non gwt java class if dat is with serialization , which help Help u to interact with data as encapsulated manner from client server or server to client.

And In other hand In non-GWT project u can not create object instance of GWT java class, practically there is no such meaning comes out.

GWT java class gives an enhancement capability to create web based GUI components as a java like syntax which will be compiled only in GWT compiler and become Javascript code after compilation.

Subhrajyoti Majumder