NullPointer thrown with Applet.getParameter()?

Alright, I've got this error that's been driving me crazy, and knowing me, it's something small that I'm overlooking, so I'd like to apologize in advance for the fact that this is probably something very basic that I'm neglecting.
I'm writing an Applet that uses the <PARAM> tag to get some parameters. However, since I put this in, it throws a NullPointerException. Now, here's the thing that's got me really confuzzled: the NullPointer is thrown not in my method, but rather in java.applet.Applet.getParameter().
The line in my code:
clientID = getParameter("id");The line in the HTML that specifies this parameter:
<PARAM NAME=ID VALUE=4>I've tried it with quotation marks around the values in the PARAM tag, I've tried it with an upper-case String passed into getParameter (the API's say that it's case-insensitive, so that shouldn't matter), and I'm just generally confused about what it is that I'm doing wrong that is making getParameter() throw a NullPointerException.
Anyone know what I'm doing wrong?

Alright, I've been looking through this, and think I've found the problem: for some reason, my Applet isn't creating an AppletStub.
According to the source code for Applet (here), when I try to call getParameter, Applet just calles getParameter on its AppletStub. That's the only line in Applet.getParameter(), so it's the only place where a NullPointer would be thrown in Applet.getParameter().
Now, this also means that I'll run into the same problem if I try to use getCodeBase(), meaning that I can't try to get the URL, which should include the variables. And, since the whole point of what I'm trying to do is to allow variable URL's, I also can't hardcode the URL into my program and try to read the <PARAM> tags with a URLConnection.
So, it looks like my only hope is to somehow get AppletStub working. Does anyone know anything about AppletStub that might help? Please?

Similar Messages

  • Transferring files from users mashines on the server. Uploading with applet

    I'm trying to create applet that would do uploading of user file on the server.
    I'm woundering, Is there any ways to use java applet to open a file on user mashine into a stream and transfer it thought socket into
    server? Is there any good solution that do uploading with java applet? (I can't use CGI or PHP)
    I just noticed that applets don't support FileInputStream. How could I in general get information from user file?
    Ok. Thanks for ideas that you gave me. But there are useless. All that I can use is only HTTP. Unfortunately no FTP, no Web Start application.
    looking for help

    well, i don't work a lot with applets because of their inherent limitations. but my guess would be that you have to somehow use a signed applet. of course that doesn't help with the FileInputStream problem you are talking about.
    if i were going to do it and i couldn't use FTP, i'd write a WebStart app that calls servlets (sending it byte arrays) and the servlets will construct the files on the server...
    i have no clue how you are going to do what you want...

  • Getting error while configuring SharePoint 2013 that "SocketException was thrown with SocketError ConnectionRefused"

    Hi,
    I am installing the SharePoint-2013 on development virtual machine. and i have the following environment.
    Windows server : 2012
    SQL server 2012(enterprise edition)
    Active directory(domain) is configured on same server.
    for SharePoint configuration purpose i had  created SP_farm account with SQL server DB_creator,security admin etc rights.
    even though m facing this issue related with socket exception.
    Error in log file :
    04/08/2014 12:26:33  1  INF            Trying to see if port 35513 is free on machine SHAREPOINT2013.  Min port we will try is
     1024, Max port we will try is 49151
    04/08/2014 12:26:35  1  INF            A SocketException was thrown with SocketError ConnectionRefused
    04/08/2014 12:26:35  1  INF            Connect has been refused for port 35513, so we will consider this a free port
    04/08/2014 12:26:35  1  INF            Have not found a free port yet.  Number of tries is 1.  Min port we will try is 1024, Max
     port we will try is 49151
    04/08/2014 12:26:35  1  INF            Adding port 35513 to the exclusion list so it is not chosen again during this run
    So m bit confuse about is this error related to network issue or something else that i have to configure on server.
     any suggestion or reply will be appreciated..!:-) 
    Shiv

    Is the firewall turned on?
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • A new webcam with applets  problems

    hi
    I have some doubt abot webcam with applets
    here are my questions......
    1. There is client(s) and server systems.....
    webcam is connected to clientside and image from webcam should be captured from
    client(s) and to be sent to server ,through web only. Is there are any possibilities to do this
    thing without applets..?
    if so please tell me abt that..
    2. with applets is there any methods to access client webcam without using signed aplets and
    certificating (IE such as setting browser are some settings allow all applets in client machine .etc)
    3. i heard about we can have our own signature and certificates (without aproved by any CA)
    is it possible if so how can we achive that..?
    Im a student doing my projects,I have gone through several applets and webcam related JMF forums but all are old dated and may be new technologies arrived and I couldnot able make clear my doubts comfortably...
    sorry for rising old topic but
    it wold be gracefull if anybody clear my doubts please kindly give me the ans.
    thanks in advance

    Hi
    Let me take a crack at this, :)
    1) No
    2)Anything that is required to access anything of a clients computer, i.e com ports,files and resources needs a signed applet.
    3)http://java.sun.com/developer/technicalArticles/Security/Signed/
    And yes you have to work with
    http://java.sun.com/products/java-media/jmf/
    in order to capture images
    HTH
    :)

  • Problems with applets.

    Hi to everybody.
    I've got a problem with simple applets.
    I've built several applets using Swing components (JApplet, JPanel, JButton, etc.)
    In my browser, the background color of my applets does correctly appear.
    But none of my components does !!!! No text fields, no buttons etc.
    Can someone explain to me which could be the reason of that ?
    Thank's.

    I've just tried appletviewer. And I discovered that there is a problem while trying to acces to a jpeg file for my JBuutons and JLabel.
    Appletviewer considers these files are on the client machine and refuses the acces.
    But when I try my site, the server is my computer too ! So the jpegs are on the server side !
    Furthermore, when I start my web page (that contains my applets), nothing does appear (no exception) in the java console...
    How can I solve this problem (I'm newer with applets)?

  • How to include ojdbc.jar with applet in apex

    Hi,
    I am integrating applet with apex. I need to use ojdbc.jar to connect to Database. How can i include this jar. I tried uploading it as a static file. But i am not sure how to embed it with applet code in region source of a page. I am using following code to embed the applet.
    <applet code="TestApplet.class" archive="#APP_IMAGES#Test.jar" width="500" height="500">
    </applet>
    Please suggest how to include the ojdbc.jar.
    Regards,
    Shweta

    Thank you all for help, from your posts I was able to get the datepicker working with a different version of jQuery (but not jQueryUI) included on the page. There are two methods:
    1. Include the new library before #HEAD# and change the reference to a different variable, for example:
    <script src="jquery-1.6.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
      var jq164 = jQuery;
    </script>
    #HEAD#2. Include the new library after #HEAD# and enable noConflict() mode, for example:
    #HEAD#
    <script src="jquery-1.6.4.min.js" type="text/javascript"></script>
    <script type="text/javascript">
      var jq164 = jQuery.noConflict(true);
    </script>In both examples above, $, jQuery and apex.jQuery point to apex jQuery, while jq164 points to the new one.
    However, I couldn't manage to include a newer version of jQueryUI. I only found a page ([url http://stackoverflow.com/questions/6358961/using-multiple-jquery-ui-versions]http://stackoverflow.com/questions/6358961/using-multiple-jquery-ui-versions) that says you have to specify a different context for each version of jQueryUI included on the same page. I haven't yet had time to look at this, so if anyone already knows how to do it, it would be really nice to share it with us.
    Regards,
    Jure

  • Saving a file with applets

    Hello my name is Lino and I'm Portuguese (sorry the bad English)
    I have a problem, I want to know how do save a .jpg file with the FileChooser and FileWriter, that is in the Server and I want to save a copy in my computer, but it must with Applets!
    Please help me
    Tanks
    LP

    Hi,
    because of security resons with applets, it is not possible to store an .jpg on your hard drive.
    Bernd

  • I/O with applets

    From what I have found, file I/O is apparently not allowed with applets; when I try it, I get this "access denied" or something error/exception.
    I would understand why that is...but is there REALLY no way to do file I/O with applets, or any way around it (maybe you can get permission somehow)?

    A sandbox security feature prevents unsigned applets from accessing your filesystem. For more information see:
    http://java.sun.com/docs/books/tutorial/security1.2/tour1/index.html
    or this forum:
    http://forum.java.sun.com/thread.jsp?thread=221840&forum=63&message=1977008

  • Security Exception with applets

    Hello,
    How do I overcome the securityexception I face with applets? My appletviewer works fine when I try to read data from a local text file. But the browser doesn't seem to. It says access to the text file is denied!!!

    Appletviewer works but only in debug, isn't it?
    If you can read file from local, you must sign you applet by jarsigner tool contributed in your JDK.
    If you have not certificate for sign, you can generate your own certificate:
    1.generate key (name of the key will be tstkey)
    keytool -genkey -keyalg rsa -alias tstkey
    2. complete data
    3. export key (will be in your current directory in file tstcert.crt)
    keytool -export -alias tstkey -file tstcert.crt
    4. make *.jar file
    jar cvf MyApp.jar
    5. check *.jar file
    jar tvf MyApp.jar
    6. sign applet
    jarsigner MyApp.jar tstkey
    7. check sign of applet
    jarsigner -verify -verbose -certs MyApp.jar
    Tha is all. At this moment is your applet signed and you can write or read local file.
    BR
    -koalix-

  • Using javaagents with applets

    Is it possible to use javaagents with applets?
    If it is, how?

    FYI... my environment is:
    Oracle9iAS (9.0.3.0.0)
    JDeveloper (9.0.3.4)

  • Use XML Digital Signature(Apache XML security) with Applet

    I have problem when I use xml-security-1_2_1 library from Apache with applet and access denied errors occur.
    6 May 2005 10:06:45 org.apache.xml.security.Init init
    SEVERE: Bad:
    java.security.AccessControlException: access denied (java.util.PropertyPermission org.apache.xml.security.resource.config read)
    bla bla....
    How should I do ? Please! T_T and thank you ..

    An applet cannot read the local file system, connect to any other computer than the one
    it came from or read properties it's not supposed to read. And I think it cannot write to any
    property.
    If you sign the applet or set up a policy for it the applet can do the same as an application
    allthough the jre will still check the stack trace if the entire stack has the same privileges
    as you signed applet.
    http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
    second post and last post for the java class file

  • How to Intergrate Policy with applet

    hi my name is easan. I created an applet which reads and writes to a file but i had problems accessing the file. I solved that by granting read and write permission to the file by creating a policy. I can run the applet in the appletviewer using this line
    c:\>appletviewer -J-Djava.security.policy=<policyname> applet.html
    I would like to know hw to intergrate this policy with my applet so that i can run my applet from a browser.
    I would appreciated any help from anyone..... thank you in advance.
    Easan

    It's not possible to integrate policy file together with applet. If you want to perform these dangerous operation (read,write) from applet, you have to sign applet's jar file. And in applet's code you have to use AccessController.doPrivileged(PrivilegedAction action) for possibly unsafe parts of code.
    tina

  • Printing with applet

    hi
    i am trying to print some text with applet but it is not working here is my code
    sMsg="printing a applet is tough job";
    // Find the default service
    DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
    PrintService service[]= PrintServiceLookup.lookupPrintServices(flavor, null);
    // Create the print job
    byte[] b=sMsg.getBytes();
    DocPrintJob job = service[0].createPrintJob();
    Doc doc = new SimpleDoc(b, flavor, null);
    try{
    job.print(doc, null);
    }catch(Exception e){System.out.print(e.getLocalizedMessage());}
    it is not doing anything not even the error is displayed
    when i execute this code i get dialog box which ask me to allow this applet to print or not but after that ,nothing happens.
    plz help me.
    thanks in advance.

    Hans,
    I came across a similar problem a few months ago. I came up with a work-around, and although it's not great, it met the demands of my current project.
    A normal applet can't write files to a user's computer because that could create some big security problems. However, an applet can communicate with the server on which it's located. SO, I created a servlet that resides on the same server. When the user wants to print something from the applet, he clicks a Print button which opens a URLConnection and sends the data to the servlet. The servlet then creates an HTML document on the server and formats the data nicely. Then, back in the applet, I used this line to open a new browser window and show the HTML file:
    getAppletContext().showDocument(new URL(theUrl), "_blank")
    The user can then use the browser's print function to print the data.
    I know it's kind of a roundabout way, but I was pressed for time. Let us know if you come up with something better.
    -sheepy.

  • [Needing Help] J2EE proyect with Applet client

    Hello, I'm Maximiliano and I'm working in a proyect in J2EE.
    I'm using netbeans for developing.
    I'm trying to include a applet in my netbeans proyect but the netbeans IDE compile/save the classes in WAR/WEB-INF/classes and that folder it's not public, so i can't call my applet from my index.jsp.
    If i move the class file to the root of the WAR it works but the imports for mi ejbs are broken.(Because they're in /WEB-INF/lib)
    I've also tried to create a separate proyect for the applet and packaging all in a EAR package (with a simple ejb too) and it's not working either.
    What i need is if anyone can tell me how to call my packaged applet from my index.jsp
    I know including applets in html with <applet> tag but i cannot resolve the correct path to my applet, or if i have to modify my proyect.
    Thanks, Maximiliano.
    And example will be much apreciated.

    its a very good question actually - I have no idea how to achieve that. My gut feeling says that you certainly want to turn the applet into a separate project, as the applet is basically a client to your JEE environment and not part of the JEE application itself. Turning it into a separate war module seems like the thing to do - perhaps even put it outside your application EAR.
    The imports of the EJBs are not going to work in any case, even if you manage to get them on the applet's classpath. Your applet is not running on the server, thus it could only call EJB methods through the remote interface, for which you need a a set of libraries from the server and you somehow need to get the remote interface classes on the classpath of your applet - quite difficult to setup.
    If you want to invoke EJB methods from the applet, I would really suggest turning them into jax-ws webservices as that makes it such that you don't need any additional libraries to be able to do it. The Java 6 runtime already has jax-ws 2.x inside it, and it is dead easy to call a webservice from a client application.

  • HTML Page with Applet in JEditorPane

    Hi,
    I have a JEditorPane in which i want to show a HTML page which has an Applet embedded in it. Is there anyway that I can do this as if I just give the URL of the HTML file it gives me a text field with applet tag written in it.
    Or is there any other way that I can embed an Applet in my application in one of Swing components.
    Thanks in advance,

    Update:
    You may want to extend HTMLEditorKit:
    public class MyHTMLEditorKit extends HTMLEditorKit() {
        static ViewFactory viewFac = new HTMLFactory(){
           public View create(Element el) {
              if(el.getName().equalsIgnoreCase("APPLET")) {
                  Applet app = ...; // create applet from other attributes
              else return super.create(el);
    }Check this out. I don't know whether applet elements are included in the parsed document; nevertheless, check it out.
    Fritz

Maybe you are looking for

  • Excise error in record

    Hi Experts, My user made a billing document for deemend export in which customer is ED EXEMPT CT3. so there will be no excise duty paid by him.this is the standards scenerio. Now my question is in (one billing document JEX2-A/R BASIC EXCISE showing v

  • OLE-- Header & Footer, Merge into One Document

    Hi Folks, I have one requirement. I am printing one MS-Word Document from a report through OLE. Another document is coming from DMS. I just want to know how to merge both documents into one through ABAP. How we can add Page number in header or Footer

  • Nexus 1010 can not erase export-import folder

    Hi Expert, After we import the backup vsb. We try to erase the export-import folder. But system show "Device or resource busy". So we can not execute more export or import command. Please reference the below image and help us to fix this issue. Ps. T

  • Sap Installation Messed up (GUI not starting)

    Hi there, I'm not sure if this is the right place to post... anyway I have a problem with my sap installation. What happened is that I tried to install Adobe LiveCycle Designer using the SAP front end installer. I left only the Adobe LiveCycle Design

  • Problems with cfquery

    I'm constructing a webform to take in information and store it to a Access database. The error that I've been getting has something to do with my Values after the INSERT INTO statement. I have been getting the same error for the past 3 days and I'm d