I want to update the device using my own library (DLL) that I developed. The library works great using the MFC application. However, the twist is that we have to make this work in the browser .
My idea was to use an applet and then call the native DLL to make this work. Everything works fine with my test Java application. Then I tried the applet, and then nothing worked.
I narrowed the problem down to 32bit VS 64bits JVM. Let me explain: The Eclipse IDE that I use uses a 64-bit JVM since I am on Windows 7 64bit . However, the browser uses a 32-bit JVM and this does not work.
The difference between these two parameters is passed to my function. Here are some examples of the functions that a DLL provides:
bool UPGRADELIB_API Connect( const char* serverAddress, unsigned short serverPort );
bool UPGRADELIB_API Upgrade( const char* pFilePath );
Accordingly, they match in Java:
boolean Icon_ConnectClientNode( String serverAddress, int serverPort );
boolean Icon_Upgrade( String pFilePath );
My test GUI for Java navigates to this native lib "192.168.xx" for the IP address and 50005 for the port. In the 64-bit version, everything is fine, as I said earlier. In 32bit, if I print serverAddress and serverPort in C, it shows
(zero): 62384
As you can see, even the port is not transferred correctly.
, , ... , !