Netscape.javascript.JSException is never thrown in body of corresponding tr

I have the following try/catch block:
try
          netscape.javascript.JSObject.getWindow(this.applet).eval("ClkExcept(" + nId.toString() + ")");
        }catch(netscape.javascript.JSException e){}Which, for as long as I have compiled (until recently) compiled fine. However, when I recently had to recompile the classes containing this code because of an unrelated issue, I now get a message from the compiler stating that exception netscape.javascript.JSException is never thrown in body of corresponding try statement. I am attempting to use the latest 1.3.1_XX SDK (I must compile with some build of 1.3.1), but have run into this compiler message with all builds of 1.3.1 that I have tried. All documentation I can locate for the netscape.javascript.JSObject class states that the GetWindow() function can throw an exception of type netscape.javascript.JSException.
Has anyone seen this before, or does anyone have any suggestions on how to get the compiler working correctly?

This code has not been edited in two years, but has
been recompiled numerous times since then (until
today) without any compiler messages pertaining to
this try/catch block. I know for a fact that the
GetWindow() function can throw a JSException. Have you changed compilers recently?
Have you tried compiling a brand new tiny test program in a different directory, with an explicit -classpath arg that contains only that relevant jar file, and no other classes in the directory?
Have you tried extracting the class file from the jar, running it through a decompiler, and seeing what it says about the exception?
If I
remove the try/catch block and there is a problem
with the javascript function that is called on the
page hosting my applet there would obviously be an
exception to catch. Removing the try/catch block is
not a solution.You could try catching Exception instead. That will pass the compiler, because Exception includes RuntimeException and its descendants, and the compiler can't know that those won't be thrown, since they're unhecked. I'd consider that a last-ditch hack though, and wouldn't do it unless I'd thoroughly investigated first.

Similar Messages

  • Exception OrderException is never thrown in body of corresponding try state

    Currently, I have a problem with a throwing an exception that I created. No matter what I try, it continues to give me this error. My code is below and I cannot figure out what I am doing wrong. Any suggestions??
    public class OrderException extends Exception
         public OrderException(String s)
              super(s);
    public class ExceptionOrder extends JFrame implements ActionListener
    //my code creates items in JFrame
         public ExceptionOrder()
              //creates JFrame
         public class Order
              String itemNumber = new String();
              int itemNum;
         public Order(String itn, int itnum) throws OrderException
                   itemNumber = itn;
                   itemNum = itnum;
                   //itemQuantity = itq;
                   if((itnum <= 111) || (itnum >= 999)) throw(new OrderException(itn));
         public void actionPerformed(ActionEvent e)
              int numItem;
              int itemPrice;
              int itemQuantity;
              itemPrice = 1;
              try
              numItem = Integer.parseInt(item.getText());
              itemQuantity = Integer.parseInt(quantity.getText());
              itemPrice = itemQuantity * 2;
              price.setText(String.valueOf(itemPrice));
              catch(OrderException e2)
              //DOES NOT LIKE OrderException
              //says we did not throw OrderException in try statement
              //when run with a JAVA Exception, like NumberFormatException
              //program runs
                   System.err.println("Invalid Item Number or Quantity");
                   //itemPrice = itemQuantity * 2;
    any thoughts/suggestions??

    I'm not sure what you are asking. Can you please
    eloborate? I have a class named Order that I am
    trying to throw my exception if the itNum is <=111 or
    =999. I'm not sure what you mean...
    Throwing an exception is a property of a function or a constructor, not of a class. So if you don't use the constructor of the class Order in your try-statement no OrderException can be thrown.

  • Netscape.javascript.JSException: Native Window is destroyed

    Supposedly this code closes the window in which the applet is displayed.
    try{
         JSObject win = (JSObject) JSObject.getWindow(this);
         win.eval("self.close();");
    catch(JSException ex){
         System.out.println(ex.getWrappedException().toString());
    catch(Exception ex){
         System.out.println(ex.toString());
    }But I am getting "netscape.javascript.JSException: Native Window is destroyed" every time I run it. I Googled this exception, and to my surprise, I got 0 results. Does anyone know what is causing this or how to avoid it?
    I tried adding the method "close_window()" to the page, and calling that function with win.eval(), but I get the same error.
    The browser in question is Firefox on Windows XP. It is running an applet in a "bare bones" windows, with no toolbars or status bars.

    I've never used that exact call, what about a slightly different method:
    try{
         JSObject win = (JSObject) JSObject.getWindow(this);
         win.call("close", new Object[0]);
    catch(JSException ex){
         System.out.println(ex.getWrappedException().toString());
    catch(Exception ex){
         System.out.println(ex.toString());
    }

  • Netscape.javascript.JSException: Unable to obtain Document object

    Hi all.
    I'm fighting against a very unusual problem involving applets and, probably, version 1.4.2_XX of the jre (in fact i've been looking for an answer over the Internet and I've found only one item related in the java programming forum. Unfortunately it was not resolved on any of the answers http://forum.java.sun.com/thread.jsp?thread=452400&forum=31&message=2532663).
    The thing is that the applet is unable to obtain any information about the parameters passed through the page; consequently, it finally crashes showing this ugly message:
    netscape.javascript.JSException: Unable to obtain Document object
         at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
         at sun.plugin.AppletViewer.getCodeBase(Unknown Source)
         at sun.plugin.AppletViewer.appletInit(Unknown Source)
         at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
         at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)as I said I've been looking for information over the Internet but it seems that few people knows about it. Any suggestion? Does anybody knows if it is a mater of the IExplorer?
    The configuration of the client machine is:
    Windows XP SP1
    IExplorer 6.0
    Although the same has ocurred over:
    Windows 2000
    IExplorer 6.0
    Thank you for your time.

    Can you reproduce this error with html and applet code (and post this code)?
    A full trace might tell you something:
    To turn the full trace on you can start the java console, to be found here:
    C:\Program Files\Java\j2re1.4...\bin\jpicpl32.exe
    In the advanced tab you can fill in something for runtime parameters fill in this:
    -Djavaplugin.trace=true -Djavaplugin.trace.option=basic|net|security|ext|liveconnect
    The trace is here:
    C:\Documents and Settings\your user\Application Data\Sun\Java\Deployment\log\plugin...log

  • This exception is never thrown from the try statement body

    try {
                   SimpleFileReader.openFileForReading("fileName.text");
              } catch (FileNotFoundException fnfe) {
                   System.out.println("");
              }This is part of a method, if that helps. In Eclipse I get the error message "Unreachable catch block for FileNotFoundException. This exception is never thrown from the try statement body." I saw another post similar to this one, but it's not quite clear what the solution is. Could anyone clarify for a beginner?
    Thanks

    It actually does if the file it's opening is not really a text file, or if it's read-protected. Or is that where I'm going wrong? I'm just trying to open the file's name(already in the field) and know that it is .text or will return the error.
    Edited by: meme_kun_345k on Jan 15, 2008 7:18 PM

  • Compile error: NoSuchMethodException never thrown

    I try to update my code from weblogic4.0 to weblogic5.1 and I recieve error: IMidtier_WLStub.java: Exception java.lang.NoSuchMethodException never thrown in the body corresponding try statement } catch{java.lang.NoSuchMethodException}. Could you help me to figure out why I start getting this method? Thank you. Vladimir.

    Can you show us the full error?
    If you're going to use WLS 5.1, ensure that you have the latest service pack installed as well. Also, double-check that it's installed correctly.
    I would strongly recommend that you go straight to WLS 6.1. It's a much better server, and it includes a much better EJB container.
    -- Rob
    Vladimir wrote:
    I try to update my code from weblogic4.0 to weblogic5.1 and I recieve error: IMidtier_WLStub.java: Exception java.lang.NoSuchMethodException never thrown in the body corresponding try statement } catch{java.lang.NoSuchMethodException}. Could you help me to figure out why I start getting this method? Thank you. Vladimir.

  • Where to download netscape.javascript.JSObject?

    I have this statement in my Java program
    import netscape.javascript.JSObject , and when i cannot compile. May I know where I can download this package?

    Hi,
    Check out below links, i hope it will help you.
    http://docs.iplanet.com/docs/manuals/js/server/jsref/lcjsobj.htm
    http://www.netscape.com/eng/mozilla/3.0/handbook/javascript/packages.htm#1007459
    http://www.mozilla.org/oji/MRJPlugin.html
    http://developer.netscape.com/docs/technote/javascript/liveconnect/liveconnect_rh.html
    http://www.innovation.ch/java/HTTPClient/disp_html.html
    Thanks,
    Dakshin.

  • Can't Import netscape.javascript; classpath set properly

    I have an applet that is trying to say
    import netscape.javascript.*No matter how I try to compile it, I get the error
    package netscape.javascript does not existI am primarily using ant for building; here is the pertinent section of my build.xml file:
    <property name="output" location="javaclasses" />
       <target name="compile">
          <javac srcdir="./"
                 destdir="${output}"
                 includes="**/*.java"
                 classpath="./,\
                            javaclasses/packages/epsgraphics.jar,\
                            /usr/lib/jvm/java-1.5.0-sun-1.5.0_update13-sr2/jre/lib/plugin.jar,\
                            javaclasses"
                 listfiles="yes">
          </javac>
       </target>Note that plugin.jar is included in my classpath. Using jar -tf <...>/plugin.jar, I can see that it contains the netscape package, the javascript subdirectory, and the JSObject.class I am interested in.
    Attempting to resolve this manually with the command line
    javac -classpath "./;javaclasses/packages/epsgraphics.jar;/usr/lib/jvm/java-1.5.0-sun-1.5.0_update13-sr2/jre/lib/plugin.jar;javaclasses" myApplet.javagives the same error.
    Moving plugin.jar to my local directory, or any other directory specified in the classpath (which worked just fine until I tried accessing plugin.jar) and re-jiggering the classpath so it can be located gives the same result: it can't find netscape.javascript.
    I'm using javac from java-1.5.0-sun-1.5.0_update13-sr2 on Suse Linux 10.3.
    What am I missing here?

    As noted, the class is present in the jar file, as revealed with 'jar -tf plugin.jar'
    I've fiddled with separators, as well. You're correct that a colon is used under Linux; that is what I had used in earlier attempts, but wound up copying the latest incarnation, which was desperately cribbed from another forum's example, thinking that Java might have other ideas. None of the variants I tried worked.
    Trying it again, replacing the command line given with colons, still doesn't work; fails with the same message.
    Currently pursuing another Ant solution, with no joy.
    Thanks for your reply.

  • LiveConnect - where do i import netscape.javascript.* from?

    I'm trying to get some LiveConnect stuff running with a Java applet, but can't seem to find where to import
    the package netscape.javascript.* from.
    Can anyone please help? Many thanks

    I've just installed Linux 9, jdk1.4.2_04, and Netscape 7.1.
    I am trying to compile a working program (on Win.XP) using Ant.
    I'm getting an error on the "import netscape.javascript.*;" statement.
    I've reviewed many forum posts but I can't find the plugin.jar file anywhere.
    I do have a plugin.pack file in <JAVA_HOME>/jre/lib
    Anybody got an idea where plugin,jar might be or is plugin.pack some incantation I missed?
    If so, what do I do with it?
    Jim

  • Netscape.javascript.ISObject ????

    I'm new in Java so I don't know how to add any external classes to my Java environment. I've downloaded
    the ifc112 library, I have all sources, I defined the environment variable CLASSPATH but still when I write in code:
    import netscape.javascript.JSObject;
    the compiler tells my that the netscape package no found. Maybe I need somthing more then j2sdk1.4.2_03?
    please help!

    The JSObject is located in plugin.jar which located in: ..\java\j2rel..4.2_03\lib on my machine.
    plugin.jar is part of the Java 1.4 sdk.
    Direct your project to reference plugin.jar and it should fix your problem.
    [email protected]

  • Appletviewer: java.lang.NoClassDefFoundError: netscape/javascript/JSObject

    When I run the appletviewer: in trying to dedebug what the Java plugin fails to load I get this error:
    C:\Program Files\Java\jdk1.5.0_01\bin>appletviewer.exe http://www.java.com/en/
    java.lang.NoClassDefFoundError: netscape/javascript/JSObject
    at JavaCallJS.init(JavaCallJS.java:21)
    at sun.applet.AppletPanel.run(AppletPanel.java:373)
    at java.lang.Thread.run(Thread.java:595)
    Thanks!
    John

    Hi,
    Can you elaborate on your problem ? Also if you are using the netlet, please provide complete java console output
    Thanks!
    Satish

  • MyApplet.java:2: Class netscape.javascript.JSObject not found in import.

    Hi,
    Im getting: MyApplet.java:2: Class netscape.javascript.JSObject not found in import.
    import netscape.javascript.JSObject;
    Where can i get this package. Someone said jaws.jar, but its not to be found. Im new on this project and I dont know how the old people compiled this applet.
    JDK version is:
    Solaris VM (build Solaris_JDK_1.2.2_10, native threads, sunwjit)
    Thanks

    Thanks man!
    I installed the jdk1.4 on my workstation. I then compiled the program via JDeveloper and pumped the class over to my server.
    Thanks again.

  • Cannot Resolve Symbol  netscape.javascript.JSObject

    I am trying to communicate fom an applet to a javascript. I am usinjg jdk1.3.1 and did an import netscape.javascript.JSObject; in my applet class.
    When I compile I get cannot resolve symbol JSObject. The import does not seem to work.
    Do I have to download the package from somewhere and put it in the jdk1.3.1 dir in some place?
    Thanks

    Ive netscape 7.1 and the JSDK 1.4.2. The Java40.Jar doesnt seem to be present in my netscape folder anywhere so I assume that it isnt included in the newest version of netscape.
    I tried using the javaws.jar that came with my JSDK but it didnt work. I opened it up and searched it and saw no mention of a JSObject file.
    Im a little confused at this point. Where can I look up the location of the JSObject?

  • Where i can find the package "netscape.javascript.JSObject;" ??urgent

    where i can find the package "netscape.javascript.JSObject;" ??urgent
    please

    The Java Plug-in 1.3 ships netscape.javascript in a JAR file called JAWS.JAR. To compile an applet which uses JSObject, just add JAWS.JAR in the CLASSPATH before compilation.
    If you don't have the Plug-in, but do have a Netscape browser installed, you can add the java40.jar file that comes with Communicator to the end of your CLASSPATH (or extract the netscape.* classes from there).

  • Netscape.javascript.JSObject without applets - Urgent!

    Hi,
    I need to evaluate some Javascript expressions inside my java code... BUT my code is not inside an Applet class. Does anyone know how to do it?
    I chose to use the netscape.javascript package, it work well inside an applet.. but my application doesn't run inside an applet. When I try to run it inside a standalone application it fails (even if the application extends from the Applet class).
    Here is part of the code:
    public class Applet1 extends Applet {
    public void init() {
    try {
    String out;
    JSObject win = JSObject.getWindow(this);
    out=win.eval("2+3;").toString();
    jLabel1.setText(out);
    System.out.print(out);
    public static void main(String[] args){
    Applet1 app=new Applet1();
    app.init();
    The code runs perfect inside Internet explorer, but it crashes when running in standalone mode.
    Thanks.

    I need to evaluate some Javascript expressions inside
    my java code... BUT my code is not inside an Applet
    class. Does anyone know how to do it?Haven't actually used it, but Mozilla has the Rhino JavaScript interpreter:
    http://www.mozilla.org/rhino/
    Also you could Google for FESI, which is an ECMAScript interpreter (basicly an early version of JavaScript that went through the standards process).

Maybe you are looking for

  • Memory Error with Tomcat 4.1

    I have a Tomcat 4.1 installation on a Linux 7.2 box. Tomcat uses mod_jk with Apache. We are currently in a development phase and change alot of jsp's on a daily basis. Eventually it seems that Tomcat runs out of memory for the compilations and gives

  • Create item delivery with zero or total quantity (even if available stock)

    Hello!! My requirement is create a item delivery with zero or total quantity, but not only the stock available at this moment. The item only will have 2 possibilities: 0 quantity or total quantity of the sales order. Example of the current process: M

  • Editable PDF Not Completely Editable.

    I have an editable pdf that has areas specified for editing. I can edit every page in the document on Bluebeam but I cannot edit them all in Adobe. I am prohibited to edit any pages past the first 3. Does anyone know how to enable the editing of the

  • Do pci slot coolers for video cards help alot?

    simple, read the title, I want a better oc without ruining the warranty

  • The phone is only a week or so old ...

    my parents bought me a white iphone for my birthday, is it possible to exchange for a black one ? The phone is only a week or so old ... is it possible to make an exchange Nothing is wrong brand new, never used.