sforbes
asked on
IE's version of the netscape Capabilities classes?
I have been having trouble with Netscape's Capabailities classes (See my other question) so I want to try the MS Solution.
Is there a way to cause a security request dialog to come up in IE to request permssion to load and execute code from a dll using JNI in a signed applet?
I
Is there a way to cause a security request dialog to come up in IE to request permssion to load and execute code from a dll using JNI in a signed applet?
I
look
http://java.sun.com/docs/books/tutorial/native1.1/index.html
http://www.pbs.mcp.com/ebooks/1575211025/ch30.htm
http://www.sys-con.com/java/iss1/javan.htm
http://bogart.sip.ucm.es/demos/javawn/native.html
http://developer.netscape.com/viewsource/
http://codeguru.developer.com/java/JNI/index.shtm
http://www.cs.pdx.edu/~antoy/Courses/Advanced/units/jni/
http://www.swtech.com/java/native/
Java Tip 17: Integrating Java with C++
http://www.javaworld.com/javatips/jw-javatip17.html
Enhance your Java application with Java Native Interface (JNI)
http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni-2.html
Use native methods to expand the Java environment
http://www.javaworld.com/javaworld/jw-07-1997/jw-07-javadev.html
http://java.sun.com/docs/books/tutorial/native1.1/index.html
http://www.pbs.mcp.com/ebooks/1575211025/ch30.htm
http://www.sys-con.com/java/iss1/javan.htm
http://bogart.sip.ucm.es/demos/javawn/native.html
http://developer.netscape.com/viewsource/
http://codeguru.developer.com/java/JNI/index.shtm
http://www.cs.pdx.edu/~antoy/Courses/Advanced/units/jni/
http://www.swtech.com/java/native/
Java Tip 17: Integrating Java with C++
http://www.javaworld.com/javatips/jw-javatip17.html
Enhance your Java application with Java Native Interface (JNI)
http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni-2.html
Use native methods to expand the Java environment
http://www.javaworld.com/javaworld/jw-07-1997/jw-07-javadev.html
Hi,
for IE-Applets put the DLL in the search-Path, sign the Applet with the needed Permissions and use it, no Problem.
for Netscape-Applets create a Env.-Var. LD_LIBRARY_PATH put the DLL in the right Directory and use the dll.
to get the Permissions i try this (it Works):
if (AppletContextInfo.isNetsc apeNavigat or()) <----- My Class....
try {
PrivilegeManager.enablePri vilege("30 Capabiliti es");
PrivilegeManager.enablePri vilege("Un iversalFil eAccess");
} catch (Exception exc){
System.out.println(" dont get Privilege ");
}
if (AppletContextInfo.isMicro softIntern etExplorer ())<----- My Class...
try {
if (Class.forName("com.ms.sec urity.Poli cyEngine") != null) {
PolicyEngine.assertPermiss ion(Permis sionID.FIL EIO);
PolicyEngine.assertPermiss ion(Permis sionID.NET IO);
PolicyEngine.assertPermiss ion(Permis sionID.PRO PERTY);
PolicyEngine.assertPermiss ion(Permis sionID.UI) ;
}
} catch (Throwable cnfe) {
System.out.println(" dont get Permisions ");
}
Greetimgs
Christo
for IE-Applets put the DLL in the search-Path, sign the Applet with the needed Permissions and use it, no Problem.
for Netscape-Applets create a Env.-Var. LD_LIBRARY_PATH put the DLL in the right Directory and use the dll.
to get the Permissions i try this (it Works):
if (AppletContextInfo.isNetsc
try {
PrivilegeManager.enablePri
PrivilegeManager.enablePri
} catch (Exception exc){
System.out.println(" dont get Privilege ");
}
if (AppletContextInfo.isMicro
try {
if (Class.forName("com.ms.sec
PolicyEngine.assertPermiss
PolicyEngine.assertPermiss
PolicyEngine.assertPermiss
PolicyEngine.assertPermiss
}
} catch (Throwable cnfe) {
System.out.println(" dont get Permisions ");
}
Greetimgs
Christo
oops not a comment ;)
Blob changed the proposed answer to a comment
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am accepting this answer here in this question, but please see my other question because the overall thing is still not working.
signed(your browser gives authority)
From: hkfung Title: "DLL Loading in JAVA"
Status: Answered.This question is locked until hkfung evaluates the answer.
Points: 50 Points (Easy) Date: Tuesday, November 16 1999 - 04:23PM CST
I have a DLL in win32 and i need to execute its function from JAVA. I dont not have the codes
to the DLL.
Please provide sample codes with some explaination.
Proposed Answer
From: mbormann
Date: Tuesday, November 16 1999 - 05:11PM CST
Text below...
Question History
Proposed Answer
From: mbormann
Date: Tuesday, November 16 1999 - 05:11PM CST
first off if u have any problem pls ask.
u can read the following good links
look
https://www.experts-exchange.com/bin/Q.10211064
but i think that this will solve ur problem.
https://www.experts-exchange.com/bin/Q.10081643
copying text from there to here so u save 10 points.
:-)
Previously Asked Java Programming Question
From: angelany Title: "Writing Java code using native methods in dll file"
Points: 10 Points Date: Thursday, September 17 1998 - 08:35AM PDT
Hi,
I am working on WindowsNT 4.0 and need to write Java code that invokes a computation core
already implemented in C,
but the core is only available as a dll file, no source
code.
I read about JNI on Sun's Java tutorial, but that would
require re-writing original C functions such that the signature matche the header file
declaratoins. This
header file is generated by "javah -jni MyFile.java" and
its signature is fixed. And since I don't have the option
to touch the core dll implementation, I can't make the
match.
How can this be done?
Any help is appreciated.
Angelany
Accepted Answer
From: msmolyak
Date: Thursday, September 17 1998 - 09:45AM PDT
Text below...
Question History
Accepted Answer
From: msmolyak
Date: Thursday, September 17 1998 - 09:45AM PDT
You can do it as long as you have an API to the third party DLL. All you have to do is to
create your own DLL which contains native implementations of Java methods where C or C++
routines will have signatures generated by javah. All those routines would do is to invoke
the appropriate functions in the target DLL with known API. I did it earlier for ODBC
(where ODBC driver manager was the third party DLL) and we created our own DLL calling the
ODBC methods.
Comment
From: angelany
Date: Thursday, September 17 1998 - 10:26AM PDT
msmolyak,
Thanks for your answer. There are still a few things that I
don't quite understand. Would you please elaborate a little more?
Suppose I have these files:
test.dll -- the core dll file
TestMain.java -- the test application in Java, it calls class and methods in "Rate.java"
Rate.java -- the Java file that contains definition of native methods
Rate.h -- generated by "javah -jni Rate.java"
Rate.c -- generated by "javah -stubs Rate.java"
Now, should I write a code called something like "RateImp.c"
to implement all the signatures in "Rate.h"? How are the Java
specific types handled? How does the "Rate.c" come into play?
Thanks.
Angelany
Comment
From: msmolyak
Date: Thursday, September 17 1998 - 10:33AM PDT
First of all you do need stubs if you are using JNI, stubs were needed for the old native
interface. Thus you just take Rate.h and create a C file (e.g., RateImp.c) where you will
implement the methods according to their signatures. You do not need your Rate.c
Comment
From: angelany
Date: Friday, September 18 1998 - 09:48AM PDT
Hi msmolyan,
I still have trouble passing data types to and from Java.
Could you please give an example on passing an object and
a string? Thanks a lot.
Angelany
Comment
From: msmolyak
Date: Friday, September 18 1998 - 10:41AM PDT
Here is an example. The first two parameters (JNIEnv and jobject) are present in all teh calls. The first is the environment, the second is pointer to the invoker object. In this example I pass file name as a parameter and convert it from Java string to C string. Then I invoke a C function using that string.
Go to the JNI Spec and tutorial on Javasoft's Web site, a lot of useful info.
/**
* This function opens specified configuration file for reading or writing.
*/
JNIEXPORT void JNICALL Java_com_excalib_rw_CfgObj
(JNIEnv * env, jobject obj, jstring jFileName)
{
char *cfgFileName;
// Convert Java string to C string
cfgFileName = (*env)->GetStringUTFChars(
// Call RetrievalWare API function openning configuration file.
cq_open_conquest_cfg(cfgFi
}
Comment
From: mbormann
Date: Tuesday, November 16 1999 - 05:18PM CST
Oops forgot to paste URL's
Apart from the JNI tutorial from Sun at
http://java.sun.com/docs/books/tutorial/native1.1/index.html
,see from a PAQ at EE ,again pasting from there to here.
from https://www.experts-exchange.com/bin/Q.10203703
See these
http://www.math.tau.ac.il/system/java/jdk1.0.2/tutorial/native1.1/
This is one of the Best and I used it at Start and also now....
http://home.pacifier.com/~mmead/cs510jip/jni/
http://www.itlibrary.com/reference/library/1575212986/htm/ch32.htm
look at CodeGuru's Links to other good sites.
http://codeguru.developer.com/java/JNI/index.shtml
http://www.cs.pdx.edu/~antoy/Courses/Advanced/units/jni/
http://www.swtech.com/java/native/
this one is repeating everything they tell but for beginners it looks good.
http://herzberg1.ca.sandia.gov/JavaCourse/Java_1_1-Week5.html