I'm recompiling a java applet which I have found as an aid to learning J#. While doing so, I keep getting the same error "Error 1 Cannot find type 'netscape.javascript.JSObject'"
I've searched google and msdn for the answer to this and have even downloaded the browser controls twice. how do I get rid of this error
-john

import netscape.javascript.JSObject;
Suprotim Agarwal
Thank you for your reply Scott...
first its a class library and I'm not sure how to "step through" the class as it will not "run" unless its an applet and I've already read that you can't debug iexplore with Visual J# Express.
second, it is a small file.
I read about the need to register COM interop but was not aware that it would cause JSObject.getWindow to throw an exception (and I'm not clear how to register COM interop as I've not found instructions here or on google).
HOWEVER (and there's always a however)... I can write a two line java script add vjsjbc as a reference, make the appropriate webpage with the correct CLASSID in reference but still get the same error message within the status window of iexplore.exe.
malangpc
Start small. Can you make a trivial ("Hello World") applet ...er, browser control... work
Is your applet's constructor or init method throwing an exception You can set breakpoints and step through the code to see what's going on.
If you are using JSObject then I found you need to register for COM interop for the project, or else JSObject.getWindow will throw an exception.
-slj-
naryn
Did you add vjsjbc.dll as reference to your project Downloading the file alone doesn't solve the problem, you should it as a reference to your project.
If you are using VS 2005 and want to add this as reference then follow the steps
- Open solution explorer (View --> Solution Explorer)
- Expand the project node and right click on Reference and select "Add Reference"
- From the "Add Reference" dialog box, select .NET tab
- Type in vjsjbc and this should tak you to vjsjbc in the list
- Click OK
Now code should compile. Please get back to us if you still see same error.
thanks,
mostaf
The error is gone and the files compile correctly, however (and there is always a however)....
I've created an html page with ONLY the following code....
<OBJECT
WIDTH="1024"
HEIGHT="768"
CLASSID="clsid:a399591c-0fd0-41f8-9d25-bd76f632415f"
VJSCODEBASE="myfile.dll#_0"
ID="Object1" >
</OBJECT>
where the dll file is named "myfile.dll" and the first class file is _0.jsl
and each time I load the file into internet explorer the statusbar shows:
"Unable to load the J# Browser Control in file file:///C:/temp/projects/myfile/myfile/bin/debug/myfile.dll