On Tue, Nov 3, 2009 at 2:36 PM, Darin <[email protected]> wrote: > > Hi, Jeff. > > Thank you so much for responding to my question. > > Perhaps I'm getting confused by the jargon. The "SolverLibrary" that I > wrote is written in C/C++ and compiled by Visual Studio into a DLL. > This DLL is supposed to be run only on the server. The GWT code was > written in Eclipse and follows essentially the documentation on the > GWT web site. At the moment, the C/C++ DLL is only checking whether a > username and password sent it by the client exists within a file on > the server (nothing fancy; there is no reason to do this in C/C++ > other than to see if it will work) though I have plans to make much > more complicated native functions once I get this to work. I am not > sure where the "classpath" is. There is an environment variable in > Windows called the "PATH"; is that what you mean? I do call the > library via RPC. The calling code is as follows (written in Java in > Eclipse using GWT): > > public class SecurityServiceImpl extends RemoteServiceServlet > implements SecurityService { > > private static NativeCodeClass nativeCode=new NativeCodeClass(); > private CompressClass compression=new CompressClass(); > @Override > public CompressedMessage validatePassword(CompressedMessage m) { > String message=compression.Decompress(m); > String username=message.substring(0,message.indexOf(',')); > String password=message.substring(message.indexOf(',') > +1,message.length()); > String returnString=nativeCode.validatePassword(username, > password); > CompressedMessage > replyMessage=compression.Compress(returnString); > return replyMessage; > } > } > > Again, thanks for your help. Any other suggestions would be welcome. > Best, Darin > > All the above has to run on the server (because it uses classes defined in SolverLibrary). You'll want to modify the above to handle requests from your client for solver library routines. The code you've posted so far will only run as Javascript on the client when SolverLibrary exists as Javascript; which condition is not true. The above code will run (as Java) on the client in Hosted mode (because SolverLibrary will be loaded by the Java run-time in Hosted mode); which is no good for what you want in the Long Run.
On Nov 3, 7:27 am, Jeff Chimene <[email protected]> wrote: > > Darin: > > > > There is one other possibility. You mention that you "... tested the > > compiled code (including the native > > code) inside the Mozilla browser and it also runs as it should." > > > > What's happening is that the Java run-time is able to load and run your > > library in hosted mode. But, that doesn't mean that you can compile this > > library to Javascript. Try putting the library into the classpath, modify > > your code to instantiate whatever classes you need, and compile (rather > than > > run in hosted mode). You cannot use LoadLibrary on the client side: there > is > > no Java runtime. > > > > On Mon, Nov 2, 2009 at 4:37 PM, Darin <[email protected]> wrote: > > > > > Hello. > > > > > I have written a GWT project that uses native code. The class that > > > calls the code looks like this: > > > > > public class NativeCodeClass { > > > static { > > > System.loadLibrary("SolverLibrary"); > > > } > > > public native String validatePassword(String username, String > > > password); > > > } > > > > > When I compile and run this inside of Eclipse (hosted mode), the > > > native code runs (assuming that I uncheck the "Use Google App Engine") > > > just fine. I have also tested the compiled code (including the native > > > code) inside the Mozilla browser and it also runs as it should. > > > Unfortunately, when I deploy my code to the server, the Javascript > > > does not seem to be able to find my native library (SolverLibrary) > > > even though the Javascript is definitely working. I have tried copying > > > the library to every conceivable location that I could think of but > > > have thus far failed. I am running Windows XP and using Apache as my > > > http server. Any ideas for where I should put the native library so > > > that the Javascript can find it? > > > > > Disclaimer: I am a definite newbie with GWT and a mathematician by > > > trade. If I am doing something outrageously stupid, I apologize for > > > wasting everyone's time, but please let me know what I'm doing wrong > > > so that I don't wind up smashing my computer and scaring my son. > > > Thanks, Darin > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
