GetImage() throws nullpointerException in Netscape (but not IE)

1. Does getImage work on Netscape Navigator? When I load pictures to my applet, NN's java console doesn't say anything. After creating a new Panel that actually uses the Images, applet gives a nullPointerException because of the images. The same code works in Internet Explorer and appletviewer.
2. What ways do I have for loading Images to my applet? Is there an optional way other than getImage?
Thanks in advance,
Rakhi
Here's the code sample :
The commented areas are the various possiblities I have tried without success.
import java.awt.*;
import java.net.*;
import java.awt.image.*;
import java.applet.*;
public class ImageTrial extends Applet {
Image baseImage;
public void init() {
baseImage = getImage(getCodeBase(),"xxx.gif");
//baseImage = getImage(getDocumentBase(),"xxx.gif");
/*try {
URL u = new URL("http://localhost:8080/xxx.gif");
baseImage = getImage(u);
} catch (MalformedURLException m) {m.printStackTrace(); }
/*try {
URL u = new URL("http://127.00.00.01/xxx.gif");
baseImage = getImage(u);
} catch (MalformedURLException m) {m.printStackTrace(); }
/*try {
URL u = new URL(getDocumentBase(),"xxx.gif");
baseImage = getImage(u);
} catch (MalformedURLException m) {m.printStackTrace(); }
     /*MediaTracker mt = new MediaTracker(this);
mt.addImage(baseImage,0);
try {
mt.waitForID(0);
catch (InterruptedException e) { e.printStackTrace(); }
if (baseImage == null)
System.out.println("image is null");
else
System.out.println("image is not null");
repaint();
public void paint(Graphics g) {
if (baseImage == null)
g.drawString("IMAGE DISPLAY ERROR:IMAGE IS NULL",10,10);
else
g.drawImage(baseImage,10,10,this);
The following is the HTML code:
<APPLET CODEBASE="/jsdk/webpages/NeGraphical" CODE="ImageTrial.class" WIDTH = 100 , HEIGHT = 100>
</APPLET>

Hi !
I've tried this code and it works on both IE and Netscape:
import java.awt.*;
import java.net.*;
import java.awt.image.*;
import java.applet.*;
public class ImageTrial extends Applet
  Image baseImage;
  public void init()
    URL imageURL;
    Class cl = ((Applet)this).getClass();
    imageURL = cl.getResource("java.gif");
    baseImage = getImage(imageURL);
    if(baseImage == null)
      System.out.println("image is null");
    else
    System.out.println("image is not null");
    repaint();
  public void paint(Graphics g)
    if(baseImage == null)
      g.drawString("IMAGE DISPLAY ERROR: IMAGE IS NULL",10,10);
    else
      g.drawImage(baseImage,10,10,this);
}With this html code:
<HTML>
  <HEAD>
    <TITLE>Image Test</TITLE>
    <BODY BGCOLOR="FFF3A8" text="00686D">
    <CENTER>
    <HR WIDTH=40% ALIGN=CENTER>
    <B>Image Test</B>
    <HR WIDTH=40% ALIGN=CENTER><BR>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
      var _info = navigator.userAgent;
      var _ns = false;
      var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);
       //-->
    </SCRIPT>
    <SCRIPT LANGUAGE="JavaScript1.1">
    <!--
      if(!_ie)
         var _ns = (navigator.appName.indexOf("Netscape") >= 0
         && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0
         && java.lang.System.getProperty("os.version").indexOf("3.5") < 0)
         || _info.indexOf("Sun") > 0));
     //-->
    </SCRIPT>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
       if(_ie == true)
         document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" ' +
         'WIDTH = 400 ' +
         'HEIGHT = 200 ' +
         'align = baseline ' +
         'codebase = "/plugin/j2re1_3_0_win.exe"><NOEMBED><XMP>');
       else if(_ns == true)
         document.writeln('<EMBED ' +
         'type="application/x-java-applet;version=1.3" ' +
         'width=400 height=200 align=baseline ' +
         'code="ImageTrial.class" ' +
         'pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html" ' +
         'frame="task"><NOEMBED><XMP>');
        //-->
      </SCRIPT>
      <APPLET CODE="ImageTrial.class"
        ALIGN="baseline"
        WIDTH="400"
        HEIGHT="200">
      </XMP>
      <PARAM NAME="java_code" VALUE="ImageTrial.class">
      <PARAM NAME="java_type" VALUE="application/x-java-applet;version=1.3">
      <PARAM NAME="scriptable" VALUE="true">
      ALT = "Your browser understands the <APPLET> tag but isn't running the applet, for some reason."
      <B>No JDK 1.3 support for APPLET!!</B>
      </APPLET></NOEMBED></EMBED>
      </OBJECT>
    </CENTER>                    
  </BODY>
</HTML>Hope it helps...let me know...

Similar Messages

  • Tomcat gives 404 with Netscape, but not IE

    Why would I get a 404 for an application with netscape but not with ie?
    I am using Tomcat 5.5.
    Is there something special that I need to do for each browser?
    Thanks in advance
    Burt

    Why would I get a 404 for an application with netscape but not with ie?
    I am using Tomcat 5.5.
    Is there something special that I need to do for each browser?
    Thanks in advance
    Burt

  • Applet works in Netscape but not IE

    Very basic Hello World applet. IT doesn't work in IE 6. Not sure why.
    html source:
    <html>
    <body>
    <applet code="test.class" Width=640 Height=480></applet>
    </body>
    </html>
    Anyone know why?

    I do have java runtime installed. I used java SDK 1.4.1. What runtime do I need installed for applets made with this version of java? I have the 1.4.1 runtime installed. It doesn't make sense to me that it would work in Netscape but not Internet Explorer. Any help would be great. Thax

  • Rollovers work in Netscape but not IE?

    I have the rolloverbuttons working great with Netscape but when I run my app in IE the images aren't showing up. The jar is loading fine and when I use the default rollovers ( [ROLLOVER]exit ) they work fine, but my images aren't showing up. Thanks for any and all help.
    Jeremy.

    Hytrical wrote:
    The site www.lamps-on-line.com has rollovers and actions created a few years ago in GoLive and now these effects only work in Firefox, but not in Interenet Explorer (IE7) which displays page errors.
    I didn't see any errors when I looked at yourhome page in IE7 (on Vista). So which page elements were producing an error and what was the error you were seeing? Did you delete the cache in IE7 to check whether it was a caching problem? Tools > Internet Options > Browsing history (choose to delete)?
    John

  • DW Template created from existing page looks fine in IE7,FF,Opera,Netscape but Not IE6

    I am working on a website that I want to make certain pages
    into templates for re-use.. I have an existing page designed
    outside of DW that looked great in IE6,IE7,FF,Opera, and Netscape
    but the moment I saved it as a Template and then created a new page
    and look at the new page in IE6 the css is off... Not so off that
    the CSS is not being used but just not right, but If I look at it
    in anyother browser it's fine... Is DW "fixing" my code for me?
    I've looked through the settings and all the Code Rewriting options
    are unselected or is this a bug and can I get around it...

    Good luck. Looks like a bad site definition to me....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "WhittleOne" <[email protected]> wrote in
    message
    news:f6lp83$pd3$[email protected]..
    > Nevermind I found it... It changed my links to
    stylesheets and js (which
    > where
    > flawed before not sure why IE6 was ok with them before)
    > From (after convert)
    > <link rel="stylesheet" type="text/css"
    href="/--newWWW/css/nav/nav.css" />
    > <link rel="stylesheet" type="text/css"
    href="/--newWWW/css/main.css" />
    > <script
    type="text/javascript"src="/--newWWW/scripts/misc.js"></script>
    > <script
    type="text/javascript"src="/--newWWW/scripts/dates.js"></script>
    > To (actually work)
    > <link rel="stylesheet" type="text/css"
    href="../css/nav/nav.css" />
    > <link rel="stylesheet" type="text/css"
    href="../css/main.css" />
    > <script
    language="JavaScript"src="../scripts/misc.js"></script>
    > <script
    language="JavaScript"src="../scripts/dates.js"></script>
    >
    > thanks for the feed back I just needed someone to tell
    me my code was crap
    > and
    > that it wasn't DW.... 8^)
    >

  • Servlet  output correct in ie and netscape, but not in portal

    I have a servlet that retrieves and xml document, applies a
    stylesheet, and uses PrintWriter to output the html.
    When I run the servlet, the output is correct in ie and netscape.
    So, I set the servlet up as a web portlet and have put it on a
    portal page.
    My problem: When I run the portal page, the mdashes and
    rsquotes, etc. show up in portal as question marks.
    I went into the provider.xml and added some information
    (contentType,charset), but that had no effect.
    Ideas appreciated.
    Thanks.

    I have been doing some research, and this appears to be some
    sort of character encoding/unicode problem.
    I have specified UTF-8 in my servlet. Does portal not work with
    UTF-8?
    Is there a setting somewhere that I can check in portal to
    verify what character encoding it is using? (ISO-8859-1, US-
    ASCII, etc?)
    This is a sample of my servlet code:
    public void DoGet(HttpServletRequest request, HttpServlet
    Response,response)
    throws ServletException, IOException
    DOMParser parser;
    XMLDocument xml,xsldoc;
    URL xslURL,xmlURL;
    String xmld = "";
    String xsld = "";
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try
    parser = new DOMParser();
    parser.setPreserveWhitespace(true);
    xslURL = createURL(xsld);
    parser.parse(xslURL);
    xsldoc = parser.getDocument();
    xmlURL = createURL(xmld);
    parser.parse(xmlURL);
    xml = parser.getDocument();
    XSLStylesheet xsl = new XSLStylesheet(xsldoc,xslURL);
    XSLProcessor processor = new XSLProcessor();
    processor.processXSL(xsl,xml,out);
    Any advice appreciated.

  • error-page working in netscape but not in explorer

    Hi!
    I've a problem using I Explorer. I configured in my web.xml an error-
    page to manager errors of code 403, and it wasn't working, I keep
    getting an error from the browser and not the error page I
    specified... I thought it's was something about my app... but when I
    tested it with Netscape I got my error page ok.
    Does somebody knows why this happens in Explorer... how can I fix it.
    Thanks a lot!
    Abigail Garc�a

    Internet Explorer does that to save you from having to know what "Error 403" means. But you can turn that off: select menu Tools, option Internet Options. Select the "Advanced" tab, scroll down until you see "Show friendly HTTP error messages". Uncheck that and click OK.
    (That works in my IE 5.5; other versions may differ.)

  • Applet works in all netscapes but not IE 6 -- help

    I have a simple applet that works wonderfully in all versions of netscape. The plug-ins are installed. I am running under windows 98.
    The settings are configured to allow Java for both sets of browsers.
    What I get is a grey screen. No loading message -- nothing.
    Yet under netscape is comes right up...same code.
    HELP!

    Thanks. Unfortunately I did do that, and it still did not work. Plus the fact, I want my viewers
    to be able to SEE the applet -- which is a custom menu. They are not going to want to do this work, so it must be able to function in older versions of plug-ins.
    Frustrating, but we have to consider not everyone will work in the lastest vesions of software.

  • OK in netscape, but not in IE

    I created an applet that will run fine on netscape6.2. I try to run the same applet on internet explorer5.0 and I get the following message in my java console:
    java.lang.NullPointerException
    at DApplet.start(DApplet.java:81)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    I have the java 1.4 plugin installed on both netscape and internet explorer. Can anyone please help?

    If is not a netscape vs IE problem, than why would it work fine in the netscape browser? Below is the start code that is given the exception...please see if you can help.
    this is my start code:
    /**Stop the applet*/
    public void stop() {
    System.gc();
    System.out.println("DApplet: stoped");
    Thanks!

  • XSLT mapping throws error in XI, but not in XMLSPY

    Hi everybody,
    I got a really complex XSLT mapping. It works fine in XMLSPY.
    But when I execute the mapping in XI, I get the following error:
    Error during XSLT Transformation: Could not load stylesheet.com.sap.engine.lib.xml.util.NestedException: Operator or ')' expected.
    I asume there is a special character that XI cannot execute.
    has anybody an idea of finding this character?
    Thanks, regards Mario

    Hi Mario
    Check your input data, and also try to see test in Interface mapping test tab,
    you will get an idea about the input is correct or not
    see the below links..
    <u><b>XSLT Mapping</b>[/u
    /people/prasadbabu.nemalikanti3/blog/2006/03/30/xpath-functions-in-xslt-mapping
    /people/sreekanth.babu2/blog/2005/01/05/design-time-value-mappings-in-xslt
    /people/anish.abraham2/blog/2005/12/22/file-to-multiple-idocs-xslt-mapping
    <u><b>XSLT Mapping with java enhancement</b></u>
    /people/pooja.pandey/blog/2005/06/27/xslt-mapping-with-java-enhancement-for-beginners
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping - Using ABAP XSLT Extensions for XI Mapping
    Cheers..
    Vasu
    <i>** Reward Points if found useful **</i>

  • JFileChooser hangs Netscape but not IE

    Hi,
    Sorry to be asking so many questions but I am in a bit of a fix for the moment.
    I have created a JApplet which creates a JFileChooser. This works fine in IE5 but in Netscape 7.0 whenever I press the OK or Cancel buttons Netscape stops dead.
    I know other people have seen this behaviour - does anyone have a solution ?
    Thanks for reading,
    BadLands

    I think it's got something to do with the netscape security policy.
    Does anyone know I to change it ?
    BadLands

  • Database connection in applet works in Netscape but not in IE

    Hello,
    we have an applet which connects through an jdbc:odbc connection to an Access database.
    When we run it in Netscape 4.7, the applet connects to the database and finds records. When we run it in IE (5.5), we get an error.
    Haven't completely figured out where, but most likely when we try to get the connection:
    con = DriverManager.getConnection(url, "loginname", "password");
    We end up in the catch block.
    Any suggestions what the problem could be?
    TIA
    Gunter

    Can u send me code and let me see.
    Tell me all specification which Access driver you are using and which DSN you are using.
    Let me know i know i can help u out.

  • Applet using sockets works perfectly under Netscape but not under IE securi

    I have setup a java applet compiled with Sun Forte which implements a connection with a server application with sockets. The applet works perfectly on the same machine when it is loaded from netscape communicator but I receive an com.ms.security.SecurityExceptionEx security error when I am trying to connect on 127.0.0.1:7000. How can I solve this problem I have with IE. I would like to thank you on advanced.

    for ie you need a certificate that tells ie the applet if safe and allowed to open system-resources.
    take a look on the Forum: Signed Applets.
    regards

  • Applet using sockets works perfectly under Netscape but not under IE

    I have setup a java applet compiled with Sun Forte which implements a connection with a server application with sockets. The applet works perfectly on the same machine when it is loaded from netscape communicator but I receive an com.ms.security.SecurityExceptionEx security error when I am trying to connect on 127.0.0.1:7000. How can I solve this problem I have with IE. I would like to thank you on advanced.

    Hi,
    if ur applet want to open socket in IE you need to import microsoft java package which is in Microsoft SDK for Java 4.0.
    import com.ms.security.*;
    try {
    if (Class.forName("com.ms.security.PolicyEngine") != null) {
         PolicyEngine.assertPermission(PermissionID.NETIO);
    } catch (Throwable cnfe) {
                   System.err.println( cnfe.toString() );
    you have to write above code and compile the java file by using jvc.exe which in Microsoft SDK for Java 4.0.
    You can download Microsoft SDK for Java 4.0 from microsoft site.
    try & all the best
    sundaram

  • I have CS5 and a d-600. I would like to use camera raw but not working. I downloaded CR 7.3 and still not working. Do I need to upgrade to CS6 ..or just throw it all out the window and get rid of my d-600 ?

    I have CS5 and a d-600. I would like to use camera raw but not working. I downloaded CR 7.3 and still not working. Do I need to upgrade to CS6 ..or just throw it all out the window and get rid of my d-600 ?

    it allows you to use your cr files, Adobe - Adobe Camera Raw and DNG Converter : For Windows
    Camera Raw: How to use Adobe DNG Converter - YouTube

Maybe you are looking for

  • HT4623 How do you get your music back on your phone?

    The update did not let me back up my iPhone. It just took over and showed I had to restore my iPhone. Now I do not have any music and it did not restore all my contacts. How can I get all contacts on my iPad to go to my iPhone? Which my iPad kept eve

  • Use old Windows XP PC hard drive as an external hard drive.

    Hello, I'm planning to buy a Mac Mini as XP is no longer supported. My thought is to use the old SATA 3.5 inch drive as an external drive in a USB 3.0 case to give access to what files and programs. There are a couple of Windows specific programs on

  • Error when calling a stored procedure from a SQL Script

    Apologies if this is a really dumb question but I can't seem to call a procedure in package from a SQL script. I have a simple package.procedure containing a loop to populate a table. I would like to include a call to this procedure from my database

  • FireFox 4 won't open our web app anymore?

    Hi. I notice that FireFox 4 won't load our web app. When I view the source it is blank? It's fine in FF 3, IE and Chrome

  • Can't update to 2.2.1

    Hello everybody; I Bought iPhone month ago and I am happy with it. my problem is that when I click on update button the downloader starts download and when just 1 second remains to complete download a message appears that there is a network error. Ac