By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,914 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,914 IT Pros & Developers. It's quick & easy.

Calling a DLL from a Java Applet

P: n/a
Hi,

I know this question has prob. been asked a million times, but I couldn't
find it in the FAQ, so here goes :

I'm trying to write a Java applet to call a dll that resides on the web
server (running IIS 6). I've written a little test applet that should call a
helloWorld function in the dll, but when I use System.loadLibrary, it gives
me this security warning :

java.security.AccessControlException : access denied
(java.lang.RuntimePermission loadLibrary.myLib)

I've read that it's not possible to run a dll on a client computer (except
perhaps by signing it?), but I can't find much information about dll's on a
web server. If anyone could give me any pointers, I'd really appreciate it
:-)

Thanks,

Rowland.
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Rowland wrote:
Hi,

I know this question has prob. been asked a million times, but I couldn't
find it in the FAQ, so here goes :

I'm trying to write a Java applet to call a dll that resides on the web
server (running IIS 6). I've written a little test applet that should call a
helloWorld function in the dll, but when I use System.loadLibrary, it gives
me this security warning :

java.security.AccessControlException : access denied
(java.lang.RuntimePermission loadLibrary.myLib)

I've read that it's not possible to run a dll on a client computer (except
perhaps by signing it?), but I can't find much information about dll's on a
web server. If anyone could give me any pointers, I'd really appreciate it
:-)


The applet runs on the client. If the applet spawns code, be it from a
jar, a dll or whatever, the code runs on the client. Therefore it would
be a security issue to allow the applet to execute code from a dll no
matter where the dll came from.

Now, did you want the dll code to be executed on the client or the
server? If you want the client, you'll have to sign the applet and I
would expect things to get messy. If you want the code to execute on
the server, then you need to write some sort of server program (servlet,
web service, simple socket-based server, etc.) to execute the code.
Then make the applet a client of that server.

Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #2

P: n/a
Have you tried to sign your applet ??? It solved the problem for me
when I tried exchanging SOAP data over SSL..... and even using an XML
parser requested my applet to be signed. It MAY solve your problem.
Let me know if it did!

Quiks
--------------
BTW: For those who have to do with monitoring, check the site:
http://www.metamindsolutions.com. It's a great multiplatform
monitoring solution and seems to have been adopted by large accounts
"Rowland" <ba*****@hotmail.com> wrote in message news:<cg*********@hercules.btinternet.com>...
Hi,

I know this question has prob. been asked a million times, but I couldn't
find it in the FAQ, so here goes :

I'm trying to write a Java applet to call a dll that resides on the web
server (running IIS 6). I've written a little test applet that should call a
helloWorld function in the dll, but when I use System.loadLibrary, it gives
me this security warning :

java.security.AccessControlException : access denied
(java.lang.RuntimePermission loadLibrary.myLib)

I've read that it's not possible to run a dll on a client computer (except
perhaps by signing it?), but I can't find much information about dll's on a
web server. If anyone could give me any pointers, I'd really appreciate it
:-)

Thanks,

Rowland.

Jul 17 '05 #3

P: n/a
"Raymond DeCampo" <rd******@spam.twcny.spam.rr.spam.com.spam> wrote in
message news:NW*******************@twister.nyroc.rr.com...
Rowland wrote:
Hi,

I know this question has prob. been asked a million times, but I couldn't find it in the FAQ, so here goes :

I'm trying to write a Java applet to call a dll that resides on the web
server (running IIS 6). I've written a little test applet that should call a helloWorld function in the dll, but when I use System.loadLibrary, it gives me this security warning :

java.security.AccessControlException : access denied
(java.lang.RuntimePermission loadLibrary.myLib)

I've read that it's not possible to run a dll on a client computer (except perhaps by signing it?), but I can't find much information about dll's on a web server. If anyone could give me any pointers, I'd really appreciate it :-)


The applet runs on the client. If the applet spawns code, be it from a
jar, a dll or whatever, the code runs on the client. Therefore it would
be a security issue to allow the applet to execute code from a dll no
matter where the dll came from.

Now, did you want the dll code to be executed on the client or the
server? If you want the client, you'll have to sign the applet and I
would expect things to get messy. If you want the code to execute on
the server, then you need to write some sort of server program (servlet,
web service, simple socket-based server, etc.) to execute the code.
Then make the applet a client of that server.

Ray

--
XML is the programmer's duct tape.


Thanks very much for you response - I'll explain the problem and you might
be able to guide me in the right direction :-).

Basically, I'm writing an administration program for a database. I've
already written the program in VB, but our client wants to convert it so
that it will be deployed from their web-server. For this reason it was
decided to investigate Java. However, to save time (and for other reasoons),
I was hoping to be able to use an existing DLL within the Java program. I've
done this with a Java application before, but I've very little experience
with applets, servlets, etc. The dll will be executing code to talk to a
database, so it would prob. be best to have it server side for security.

So my question is this : What would be the best way to solve this problem.
Can I have a client applet written using the AWT talking to a server servlet
using my dll? Are there other, better options?

Many thanks,

Rowland.
Jul 17 '05 #4

P: n/a
"Rowland" <ba*****@hotmail.com> wrote in message
news:ch**********@sparta.btinternet.com...
"Raymond DeCampo" <rd******@spam.twcny.spam.rr.spam.com.spam> wrote in
message news:NW*******************@twister.nyroc.rr.com...
Rowland wrote:
Hi,

I know this question has prob. been asked a million times, but I couldn't find it in the FAQ, so here goes :

I'm trying to write a Java applet to call a dll that resides on the web server (running IIS 6). I've written a little test applet that should call a helloWorld function in the dll, but when I use System.loadLibrary, it gives me this security warning :

java.security.AccessControlException : access denied
(java.lang.RuntimePermission loadLibrary.myLib)

I've read that it's not possible to run a dll on a client computer (except perhaps by signing it?), but I can't find much information about dll's on a web server. If anyone could give me any pointers, I'd really
appreciate
it :-)

The applet runs on the client. If the applet spawns code, be it from a
jar, a dll or whatever, the code runs on the client. Therefore it would
be a security issue to allow the applet to execute code from a dll no
matter where the dll came from.

Now, did you want the dll code to be executed on the client or the
server? If you want the client, you'll have to sign the applet and I
would expect things to get messy. If you want the code to execute on
the server, then you need to write some sort of server program (servlet,
web service, simple socket-based server, etc.) to execute the code.
Then make the applet a client of that server.

Ray

--
XML is the programmer's duct tape.


Thanks very much for you response - I'll explain the problem and you might
be able to guide me in the right direction :-).

Basically, I'm writing an administration program for a database. I've
already written the program in VB, but our client wants to convert it so
that it will be deployed from their web-server. For this reason it was
decided to investigate Java. However, to save time (and for other

reasoons), I was hoping to be able to use an existing DLL within the Java program. I've done this with a Java application before, but I've very little experience
with applets, servlets, etc. The dll will be executing code to talk to a
database, so it would prob. be best to have it server side for security.

So my question is this : What would be the best way to solve this problem.
Can I have a client applet written using the AWT talking to a server servlet using my dll? Are there other, better options?

Many thanks,

Rowland.

Scratch that - I think I've found the way that will work best for me. I have
a client applet as before, but I also have a server listening on port nnn
for commands from this client. The client creates a socket connection to the
server (which would have to be the same server as the client class files are
located on due to applet security restrictions) which 'does stuff' based on
what commands are passed to it.

I found a good tutorial on how to set up the basics here:
http://www.javaworld.com/javaworld/j...ockets-p2.html

If this idea won't work, I'd be grateful if someone points it out to me
before I get too far into developing it ;-)

Thanks,

Rowland.

Jul 17 '05 #5

P: n/a
Rowland wrote:
"Rowland" <ba*****@hotmail.com> wrote in message
news:ch**********@sparta.btinternet.com...

Thanks very much for you response - I'll explain the problem and you might
be able to guide me in the right direction :-).

Basically, I'm writing an administration program for a database. I've
already written the program in VB, but our client wants to convert it so
that it will be deployed from their web-server. For this reason it was
decided to investigate Java. However, to save time (and for other


reasoons),
I was hoping to be able to use an existing DLL within the Java program.


I've
done this with a Java application before, but I've very little experience
with applets, servlets, etc. The dll will be executing code to talk to a
database, so it would prob. be best to have it server side for security.

So my question is this : What would be the best way to solve this problem.
Can I have a client applet written using the AWT talking to a server


servlet
using my dll? Are there other, better options?

Many thanks,

Rowland.


Scratch that - I think I've found the way that will work best for me. I have
a client applet as before, but I also have a server listening on port nnn
for commands from this client. The client creates a socket connection to the
server (which would have to be the same server as the client class files are
located on due to applet security restrictions) which 'does stuff' based on
what commands are passed to it.

I found a good tutorial on how to set up the basics here:
http://www.javaworld.com/javaworld/j...ockets-p2.html

If this idea won't work, I'd be grateful if someone points it out to me
before I get too far into developing it ;-)

Thanks,

Rowland.


Rowland,

That should work fine; I think it is the best option if you are locked
into a Java front-end. You may also want to consider an ActiveX plug-in
for IE, it should be able to execute code from a DLL.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.