Hi, Jeff. Again, thanks for the responses. I have researched what the
classpath means (and I assume you mean the directory or directories
where the JRE looks for possible libraries to use) and I have manually
set the classpath to be the directory where the library resides.
Unfortunately, that still did not change anything.

To the best of my knowledge, the server itself isn't supposed to run
the code. According to the GWT website (please correct me if I am
wrong, and it is very possible that I am wrong), the code is executed
as Javascript from within the browser. The Javascript that is already
theoretically executing from within the browser is supposed to execute
the native code. For some reason, it finds the code on the computer on
which I am developing the app, but cannot find the native code when I
copy it directly to another machine (into the directory where Apache
looks for its source files). I have copied the SolverLibrary into
every subdirectory of the main Apache library that I can find but the
native code still refuses to execute. I'm going to try installing
Eclipse and GWT on the server machine and see if that helps. Wish me
luck...

Best, Darin

On Nov 3, 2:14 pm, Jeff Chimene <[email protected]> wrote:
> Hi Darin:
>
> After re-reading your first post, I think you're already in a client-server
> environment. I am confused by the following:> 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?
>
> Your Apache installation probably doesn't run Java
> I think the reason it works in hosted mode is that your hosted mode server
> is a Java server: Tomcat.
>
> On Tue, Nov 3, 2009 at 2:59 PM, Jeff Chimene <[email protected]> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to