Added "ifdef OJI_DISABLE"
in case OJI_DISABLE we will have binaries working without oji
Apdated README
This commit is contained in:
idk%eng.sun.com 1999-11-02 08:07:09 +00:00
parent 4667ff7441
commit ccd5e48e64
3 changed files with 41 additions and 11 deletions

View File

@ -29,6 +29,10 @@ How To Build:
* Follow the directions in ..\README
* if you do not have working OJI set OJI_DISABLED to 1
(You can do it in your command prompt, or you can set it in
mozilla/java/plugins/src).
* type "nmake /f makefile.win"
* apply the patch to mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp
@ -41,13 +45,17 @@ How to Run:
* Add following directories to to your path:
%MOZILLA_FIVE_HOME%
In case OJI_DISABLED add %JDKHOME%\jre\bin\classic to your path
* Copy class files from mozilla/dist/classes to your JRE/lib/ext directory and
add JRE/lib/ext to your classpath
How to build and run test
* go to the test directory and type "nmake /f makefile.win"
* Set PLUGLET environment to the directory you have test.jar
* Run appletviewer and load page test.html from test directory and if evething is ok you will see
* Run mozilla and load page test.html from test directory and if evething is ok you will see
some output from the test pluglet on the stdout.
Problems:

View File

@ -126,10 +126,12 @@ PlugletEngine::PlugletEngine(nsISupports* aService) {
if (NS_FAILED(res)) {
return;
}
#ifndef OJI_DISABLED
res = sm->GetService(kJVMManagerCID,kIJVMManagerIID,(nsISupports**)&jvmManager);
if (NS_FAILED(res)) {
jvmManager = NULL;
}
#endif
NS_RELEASE(sm);
engine = this;
objectCount++;
@ -140,9 +142,13 @@ PlugletEngine::~PlugletEngine(void) {
objectCount--;
}
//nb for debug only
#ifndef PATH_SEPARATOR
#ifdef OJI_DISABLE
#ifdef XP_PC
#define PATH_SEPARATOR ';'
#else
#define PATH_SEPARATOR ':'
#endif
JavaVM *jvm = NULL;
@ -150,10 +156,10 @@ JavaVM *jvm = NULL;
static void StartJVM() {
JNIEnv *env = NULL;
jint res;
JDK1_1InitArgs vm_args;
JDK1_1InitArgs vm_args;
char classpath[1024];
vm_args.version = 0x00010001;
JNI_GetDefaultJavaVMInitArgs(&vm_args);
vm_args.version = 0x00010001;
/* Append USER_CLASSPATH to the default system class path */
sprintf(classpath, "%s%c%s",
vm_args.classpath, PATH_SEPARATOR, PR_GetEnv("CLASSPATH"));
@ -161,11 +167,15 @@ static void StartJVM() {
vm_args.classpath = classpath;
/* Create the Java VM */
res = JNI_CreateJavaVM(&jvm, &env, &vm_args);
if(res < 0 ) {
printf("--JNI_CreateJavaVM failed \n");
}
}
#endif // OJI_DISABLE
JNIEnv * PlugletEngine::GetJNIEnv(void) {
JNIEnv * res;
//#if 0
#ifndef OJI_DISABLE
if (!jvmManager) {
//nb it is bad :(
return NULL;
@ -177,14 +187,13 @@ JNIEnv * PlugletEngine::GetJNIEnv(void) {
::SetSecurityContext(res,securityContext);
//nb error handling
//#endif
#if 0
#else
if (!jvm) {
printf(":) starting jvm\n");
StartJVM();
}
jvm->AttachCurrentThread(&res,NULL);
#endif
#endif //OJI_DISABLED
return res;
}

View File

@ -43,7 +43,7 @@ LIBRARY_NAME = nppluglet
DEPTH= ..\..\..\
REQUIRES = java plug xpcom raptor oji
REQUIRES = java plug xpcom raptor
OBJS = \
.\$(OBJDIR)\Pluglet.obj \
@ -58,7 +58,9 @@ OBJS = \
.\$(OBJDIR)\PlugletManager.obj \
.\$(OBJDIR)\PlugletInputStream.obj \
.\$(OBJDIR)\PlugletInstanceView.obj \
!ifndef OJI_DISABLE
.\$(OBJDIR)\PlugletSecurityContext.obj \
!endif
.\$(OBJDIR)\Registry.obj
MAKE_OBJ_TYPE = DLL
@ -83,7 +85,18 @@ DLL = .\$(OBJDIR)\$(DLLNAME).dll
#// (ie. LCFLAGS, LLFLAGS, LLIBS, LINCS)
#//
#//------------------------------------------------------------------------
LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib $(DIST)\lib\oji.lib
LLIBS=$(LLIBS) $(LIBNSPR) $(DIST)\lib\xpcom.lib \
!ifdef OJI_DISABLE
$(JDKHOME)\lib\jvm.lib
!else
$(DIST)\lib\oji.lib
!endif
!ifdef OJI_DISABLE
LCFLAGS=$(LCFLAGS) -DOJI_DISABLE
!endif
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules