Error with signed applet "class can't be instantiated"

hi,
I developed an applet to make a ftp connexion to upload files from the local disk and the applet is already signed. At first I compiled it with the 1.4 version and I got (from other computers) the error "class not found". Then I used the target 1.1 option and now I get the error "class can't be instantiated"
Do I need any additional code?
I am using all these imports
import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.swing.JComponent;
import javax.swing.JProgressBar;
import javax.swing.*;
Thanks

go to
Tools->Internet Options->Advanced
Look for "Java (Sun)" (normally near Microsoft VM). I uncheck all the Microsoft VM options but am not sure if that is really necessary.
Also play with Control Panel, you should see "Java Plug-in" in there and be able to configure browsers a bit with that.

Similar Messages

  • Applet Class can't be Instantiated - InstantiationException

    I'm developing a small chat Applet and trying to load it over IE5.0. It say's it cannot Instantiate the Applet and Netscape says that the Class cannot be loaded. This Chat Applet is not an Abstract class or an interface.

    Hi,
    Thanx for your reply. The Client does extends Applet and the code is straight and simple. Do you have any assumptions over what may be the cause?

  • Class can't be instantiated

    Hi guys
    Just having trouble running this applet for some reason, in any browser. Other applets are working at the minute, so it doesn't look like a prob with the browsers or JVM.
    Heres the code, followed by the error message.
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public abstract class ColourButtons extends Applet
                                              implements ActionListener, MouseListener
         private Button colorButtons[] = new Button[7];
        private Color color = Color.black;
         int x1, y1, x2, y2 = 1;
        public void init()
              setLayout(new BorderLayout(20,20));
              Panel pWest = new Panel();
              pWest.setLayout(new GridLayout(7,1));
              for(int x =0; x <= 6; x++)
                   colorButtons[x] = new Button("   ");
                   pWest.add(colorButtons[x]);
                   add("West",pWest);
                   //add actionlisteners for each button
                   colorButtons[x].addActionListener(this);
                   if(x == 0){
                        color = Color.red;}
                   else if( x==1){
                        color = Color.blue;}
                   else if(x==2){
                        color = Color.green;}
                   else if(x==3){
                        color = Color.yellow;}
                   else if(x==4){
                        color = Color.orange;}
                   else if(x==5){
                        color = Color.black;}
                   else if(x==6){
                        color = Color.white;}
                   colorButtons[x].setBackground(color);
            setBackground(Color.gray);
        public void paint(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(color);
              //create Rectangle Object
              Rectangle myRectangle = new Rectangle(x1,y1,x2,y2);
              g2.draw(myRectangle);
                       g2.drawString("HELLO", 150,100);
        public void actionPerformed(ActionEvent a)
            Button button = (Button)a.getSource();
            color = button.getBackground();
            repaint();
        public void mouseClicked(MouseEvent e)
        public void mouseEntered(MouseEvent e)
        public void mouseExited(MouseEvent e)
        public void mousePressed(MouseEvent e)
              x1 = e.getX();
              y1 = e.getY();
        public void mouseReleased(MouseEvent e)
              x2 = e.getX();
              y2 = e.getY();
    }And heres the error message.
    load: ColourButtons.class can't be instantiated.
    java.lang.InstantiationException
    at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance
    (InstantiationExceptionConstructorAccessorImpl.java:30)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
    at sun.applet.AppletPanel.run(AppletPanel.java:292)
    at java.lang.Thread.run(Thread.java:536)
    Any ideas at what is wrong?
    Any help/pointers greatly appreciated
    Cheers

    ok cheers thats sorted it. For some reason it wanted it to be abstract once i added mouse listener i think.
    Anyway cheers

  • "Class can't be instantiated " error message. Help !

    Dear Java People,
    In trying to do a program that outputs a sound with every button click
    I have no compilation errors but a runtime error that says:
    "class can't be instantiated"
    below is the program and below that the error message
    thank you in advance
    Norman
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    public abstract class MyMusicApplet_1 extends JApplet implements ActionListener, AppletContext
         //AppletContext myAppletContext =   new AppletContext();
         //Iterator i =   myAppletContext.getStreamKeys();
         JButton myJButton;
         AudioClip acSound_1;
         AudioClip acSound_2;
         AudioClip acSound_3;
         AudioClip acSound_4;
         AudioClip acSound_5;
         AudioClip acSound_6;
         AudioClip acSound_7;
         AudioClip acSound_8;
         AudioClip acSound_9;
         JButton myJButtonSound1;
         JButton myJButtonSound2;
         JButton myJButtonSound3;
         JButton myJButtonSound4;
         JButton myJButtonSound5;
         JButton myJButtonSound6;
         JButton myJButtonSound7;
         JButton myJButtonSound8;
         JButton myJButtonSound9;
      public void init()
            try
             acSound_1 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_2 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_3 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_4 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_5 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_6 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_7 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_8 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             acSound_9 = getAudioClip(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore.wrk"));
             catch (MalformedURLException e)
               System.out.println("Error here " );
           Container myContentPane = getContentPane();
           myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            Dimension buttonSize = new Dimension(190,100);
           Font myFont = new Font("Arial", Font.BOLD,14);
           Border myEdge = BorderFactory.createRaisedBevelBorder();
                    //create 1st button's object
                     myJButtonSound1 = new JButton("sound #1");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound1.setBorder(myEdge);
                   myJButtonSound1.setPreferredSize(buttonSize);
                   myJButtonSound1.setFont(myFont);
                   myJButtonSound1.setBackground(Color.orange);
                   myJButtonSound1.setForeground(Color.black);
                    //create 2nd button's object
                     myJButtonSound2 = new JButton("sound #2");
                    myJButtonSound2.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound2.setBorder(myEdge);
                   myJButtonSound2.setPreferredSize(buttonSize);
                   myJButtonSound2.setFont(myFont);
                   myJButtonSound2.setBackground(Color.blue);
                   myJButtonSound2.setForeground(Color.black);
                    //create 3rd button's object
                     myJButtonSound3 = new JButton("sound #3");
                    myJButtonSound1.addActionListener(this);
                   //set the button's border and size, font, background and foreground
                   myJButtonSound3.setBorder(myEdge);
                   myJButtonSound3.setPreferredSize(buttonSize);
                   myJButtonSound3.setFont(myFont);
                   myJButtonSound3.setBackground(Color.cyan);
                   myJButtonSound3.setForeground(Color.black);
                    //create 4th button's object
                     myJButtonSound4 = new JButton("sound #4");
                    myJButtonSound4.addActionListener(this);
                   //set the button's border and size, font background and foreground
                   myJButtonSound4.setBorder(myEdge);
                   myJButtonSound4.setPreferredSize(buttonSize);
                   myJButtonSound4.setFont(myFont);
                   myJButtonSound4.setBackground(Color.pink);
                   myJButtonSound4.setForeground(Color.black);
                   //create 5th button's object
                   myJButtonSound5 = new JButton("sound #5");
                  myJButtonSound5.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound5.setBorder(myEdge);
                 myJButtonSound5.setPreferredSize(buttonSize);
                 myJButtonSound5.setFont(myFont);
                 myJButtonSound5.setBackground(Color.red);
                 myJButtonSound5.setForeground(Color.black);
                  //create 6th button's object
                   myJButtonSound6 = new JButton("sound #6");
                  myJButtonSound6.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound6.setBorder(myEdge);
                 myJButtonSound6.setPreferredSize(buttonSize);
                 myJButtonSound6.setFont(myFont);
                 myJButtonSound6.setBackground(Color.pink);
                 myJButtonSound6.setForeground(Color.black);
                  //create 7th button's object
                   myJButtonSound7 = new JButton("Choice #7");
                  myJButtonSound7.addActionListener(this);
                 //set the button's border and size, font, background and foreground
                 myJButtonSound7.setBorder(myEdge);
                 myJButtonSound7.setPreferredSize(buttonSize);
                 myJButtonSound7.setFont(myFont);
                 myJButtonSound7.setBackground(Color.cyan);
                 myJButtonSound7.setForeground(Color.black);
                  //create 8th button's object
                   myJButtonSound8 = new JButton("Choice #8");
                  myJButtonSound8.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound8.setBorder(myEdge);
                 myJButtonSound8.setPreferredSize(buttonSize);
                 myJButtonSound8.setFont(myFont);
                 myJButtonSound8.setBackground(Color.yellow);
                 myJButtonSound8.setForeground(Color.black);
                  //create 9th button's object
                   myJButtonSound9 = new JButton("Choice #9");
                  myJButtonSound9.addActionListener(this);
                 //set the button's border and size, font background and foreground
                 myJButtonSound9.setBorder(myEdge);
                 myJButtonSound9.setPreferredSize(buttonSize);
                 myJButtonSound9.setFont(myFont);
                 myJButtonSound9.setBackground(Color.blue);
                 myJButtonSound9.setForeground(Color.black);
                   //add the buttons to the content pane
                   myContentPane.add(myJButtonSound1);
                   myContentPane.add(myJButtonSound2);
                   myContentPane.add(myJButtonSound3);
                   myContentPane.add(myJButtonSound4);
                   myContentPane.add(myJButtonSound5);
                   myContentPane.add(myJButtonSound6);
                   myContentPane.add(myJButtonSound7);
                   myContentPane.add(myJButtonSound8);
                   myContentPane.add(myJButtonSound9);
          public void actionPerformed(ActionEvent e)
             myJButton = (JButton)e.getSource();
            if(myJButton == myJButtonSound1)
              acSound_1.play();
            if(myJButton == myJButtonSound2)
              acSound_2.play();
            if(myJButton == myJButtonSound3)
              acSound_3.play();
            if(myJButton == myJButtonSound4)
              acSound_4.play();
            if(myJButton == myJButtonSound5)
              acSound_5.play();
             if(myJButton == myJButtonSound6)
               acSound_6.play();
                       if(myJButton == myJButtonSound7)
                         acSound_7.play();
                       if(myJButton == myJButtonSound8)
                         acSound_8.play();
                        if(myJButton == myJButtonSound9)
                          acSound_9.play();
    java.lang.InstantiationException
         at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:30)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    load: stan_my_music_applet_1.MyMusicApplet_1.class can't be instantiated.
         at java.lang.Class.newInstance0(Class.java:306)
         at java.lang.Class.newInstance(Class.java:259)
         at sun.applet.AppletPanel.createApplet(AppletPanel.java:566)
         at sun.applet.AppletPanel.runLoader(AppletPanel.java:495)
         at sun.applet.AppletPanel.run(AppletPanel.java:292)
         at java.lang.Thread.run(Thread.java:536)

    I also tried:
    try
    for(int a=0;a<8;a++)
    {acSounds[a] = getAudioClip(getCodeBase(),(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore" + (i + 1) + ".wrk")));
    and the error message still says:
    "MyMusicApplet3.java": Error #: 300 : method getAudioClip(java.net.URL, java.net.URL) not found in class stan_my_music_applet_3.MyMusicApplet3 at line 19
    Help !
    below is the revised code
    Norman
    import java.util.*;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.net.*;
    public class MyMusicApplet3 extends JApplet implements ActionListener
      AudioClip[] acSounds= new AudioClip[9];
      public void init()
       try
            for(int a=0;a<8;a++)
            {acSounds[a] = getAudioClip(getCodeBase(),(new URL ("c:/Program Files/Cakewalk/Cakewalk Pro Audio 9/seashore" + (a + 1) + ".wrk")));
      catch (Exception e)
        System.out.println("Error here " );
            Container myContentPane = getContentPane();
            myContentPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
            myContentPane.add(getButton("1", Color.orange));
            myContentPane.add(getButton("2", Color.blue));
            myContentPane.add(getButton("3", Color.cyan));
            myContentPane.add(getButton("4", Color.pink));
            myContentPane.add(getButton("5", Color.red));
            myContentPane.add(getButton("6", Color.pink));
            myContentPane.add(getButton("7", Color.cyan));
            myContentPane.add(getButton("8", Color.yellow));
            myContentPane.add(getButton("9", Color.blue));
        public void actionPerformed(ActionEvent e)
           String command = e.getActionCommand();
           int index = Integer.parseInt(command)-1;
           acSounds[index].play();
       public JButton getButton(String label, Color fore)
         {          JButton button = new JButton("sound "+label);
                    button.setPreferredSize(new Dimension(190,100));
                    button.setFont(new Font("Arial", Font.BOLD,14));
                    button.setBorder(BorderFactory.createRaisedBevelBorder());
                    button.setForeground(fore);
                    button.setBackground(Color.orange);
                    button.addActionListener(this);
                    button.setActionCommand(label);
                    return button;
          }//"MyMusicApplet3.java": Error #: 300 :
    //method getAudioClip(java.net.URL, java.net.URL) not found in class
    // stan_my_music_applet_3.MyMusicApplet3 at line 19, column 24

  • Security Problems with Signed Applet

    Hello All,
    I need help with signed applets.
    I have an applet pkged in a jar that uses other jars. I have signed the jar containing applet and all the other jars being used. However, when I try to run the applet in IE 6.0.xx, I get the following error
    java.lang.ExceptionInInitializerError
         at aaa.aaa.somemethod(xxx.java:192)
         at aaa.aaa.aaa.access$000(xxx.java:27)
         at aaa.aaa.aaa.$1.run(xxx.java:467)
    Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         ... 3 moreMy application is using Java 1.4.2.xx.
    Any help or pointers would be greatly appreciated.
    Thanks.

    Thanks harmmeijer and mjparme for your responses.
    I made some changes to my application and it does not now require the system property information. But now I am getting another exception related to class loader.
    I made the changes to the console as suggested by harmmeijer, and here is the stack trace. Also, I am not using any JavaScript explicitly.
    Registered modality listener
    Invoking JS method: document
    Invoking JS method: URL
    Referencing classloader: sun.plugin.ClassLoaderInfo@e0a386, refcount=1
    Loading applet ...
    Initializing applet ...
    Starting applet ...
    java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
         at xxx.xxx.a...<init>(a.java:39)
         at  xxx.xxx.b...<init>(b.java:42)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
    java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
         at xxx.xxx.a...ToolBus.<init>(a.java:39)
         at xxx.xxx.b....<init>(b.java:42)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Modality pushed
    Modality poppedmjparme as to your second point, the action is taking place in the same jar only. No other jar is involved at the stage where I am getting exception.
    Thankyou again and will appreciate your help.
    AC

  • Applet in ie 5.0: class can not be Instantiated

    Hi!
    My problem is an Applet, which works fine with the appletviewer and with my iExplorer 5.0.
    But when I tried to install my Application (the Applet is part of a J2EE-WebApp) on the tomcat of an other computer, I get the
    "class can not be instantiated"-Error and iE 5.0 only displays a grey box in the size of the Applet. With the appletviewer it works.
    I got the same tomcat, same mySQL and same browser on both computers.
    I also invoked the application running in tomcat on my computer from 2 other computers - on one of them, the Applet was shown, on the other, I only got this grey box.
    The version of the iExplorer was exactly the same.
    What can be wrong?

    Are you sure there is a static method in the Applet class named newAudioChip that takes a URL as an argument?

  • Load: AcidRainApplet.class can't be instantiated

    The error "load: AcidRainApplet.class can't be instantiated" is coming up on this bit of code, any ideas on being rid of it?
    // The "AcidRainApplet" class.
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Date;
    import javax.swing.*;
    public class AcidRainApplet extends Applet implements KeyListener, ActionListener
      public AcidRainApplet ()
        super ();
      int width = 600, height = 450;
      int x = width / 2, y = height - 100, w = 27, h = 40;
      int count = 0;
      boolean playing = true, pause = true;
      Font endFont = new Font ("Arial Black", Font.PLAIN, 36);
      Font ptFont = new Font ("Westminster", Font.PLAIN, 28);
      int points = 0;
      int numRain = 80;
      int maxRain = 200;
      int speed = 5;
      ImageIcon imgi = new ImageIcon ("homer.gif");
      Image ch = imgi.getImage ();
      javax.swing.Timer t;
      public void init ()
        setBackground (Color.black);
        t = new javax.swing.Timer (speed, this);
        this.addKeyListener (this);
        for (int i = 0 ; i < maxRain ; i++)
          rain = new Rain ();
    } // init method
    public void paint (Graphics g)
    super.paint (g);
    g.setColor (Color.white);
    g.drawString ("" + numRain, width - 20, 15);
    if (playing)
    g.drawImage (ch, x, y, null);
    g.setColor (Color.green);
    for (int i = 0 ; i < numRain ; i++)
    g.drawLine (rain [i].x, rain [i].y, rain [i].x, rain [i].y - 10);
    if (!(pause))
    rain [i].y += rain [i].sp;
    if (rain [i].y > height)
    rain [i].x = (int) (Math.random () * width);
    rain [i].y = 0;
    rain [i].sp = (int) (Math.random () * 5) + 2;
    points++;
    else if (rain [i].x >= x && rain [i].x <= x + w && rain [i].y >= y && rain [i].y <= y + h)
    playing = false;
    else
    g.drawString ("PRESS ENTER TO PLAY AGAIN", 180, 400);
    g.setFont (endFont);
    g.setColor (Color.red);
    g.drawString ("GAME OVER", 150, 200);
    g.setFont (ptFont);
    g.setColor (Color.green);
    g.drawString ("Score: " + points, 200, 300);
    t.stop ();
    if (pause)
    g.setColor (Color.green);
    g.drawString ("PRESS ENTER", 200, 200);
    } // paint method
    public void resetVars ()
    x = width / 2;
    y = height - 100;
    count = 0;
    playing = true;
    pause = true;
    points = 0;
    maxRain = 200;
    speed = 5;
    for (int i = 0 ; i < maxRain ; i++)
    rain [i] = new Rain ();
    public class Rain extends Applet
    Rain ()
    int x = (int) (Math.random () * width);
    int y = 0;
    int sp = (int) (Math.random () * 5) + 2;
    Rain rain [] = new Rain [maxRain];
    public void actionPerformed (ActionEvent e)
    repaint ();
    public void keyTyped (KeyEvent k)
    public void keyPressed (KeyEvent k)
    int key = k.getKeyCode ();
    if (!(pause))
    if (key == k.VK_LEFT && x > 0)
    x -= 5;
    if (key == k.VK_RIGHT && x + w < width)
    x += 5;
    if (key == k.VK_DOWN && numRain > 10)
    numRain -= 10;
    repaint ();
    if (key == k.VK_UP && numRain != maxRain)
    numRain += 10;
    repaint ();
    if (key == k.VK_ENTER)
    if (pause)
    pause = false;
    t.start ();
    else if (!(playing))
    resetVars ();
    else
    pause = true;
    t.stop ();
    public void keyReleased (KeyEvent k)
    } // AcidRainApplet class

    Irrespective of the working of your program, I would suggest you remove a lot of weeds and clean the code. That would help you do easier debugging .
    Somethings I can quickly tell are,
    the constructor in AcidRainApplet not useful, Rain implementing Applet not useful, implements KeyListener, ActionListener can be delegated to another class, usage of inner class can be rethinked of delegation can be given a thought. Following code can be thought of :
      class Rain
        private  int x = 0;
        private int y = 0;
        private int sp = 0;
        Rain ()
          reset();
        public int getX() {
          return x;
        public int getY() {
          return y;
        public void setX(int x) {
          this.x = x;
        public void setY(int y) {
          this.y = y;
         public void reset() {
          x = (int) (Math.random () * width);
          y = 0;
          sp = (int) (Math.random () * 5) + 2;   
      }Good wishes,
    Rajesh

  • I use blackboard, since the latest update to 3.6.14, I get errors with caching applets, use IE and works fine. Whats happened and what can I do to resolve it?

    Error Cache:
    Unable to update files in cache.
    Name: myApplet
    java.net.MalformedURLException: no protocol: jar/dragndrop_applet.jar
    I get a bunch of these Cache Errors. Happens with application only, its blackboard hosted by continuinged.uml.edu.
    Run the same thing using IE it has no problems. Firefox till the latest upgrade was also working fine.
    What can I do to resolve this problem?

    There's a bug in 3.6.14 with Java applets. 3.6.15 was released last Friday to fix that bug. Use '''Help > Check for Updates''' to start the update process to 3.6.15.

  • Problems with signed Applet for File Download under JRE 1.4 (works with 1.3

    Dear all,
    i encountered a very strange behaviour with JRE 1.4x. A signed applet used for file download worked on all platforms (Windows NT, 2000 and XP wth/wthout SP...) until I installed JRE 1.4.x (1.4.1 or 1.4.2)
    I get an EOFException when downloading binary files (for ASCII it works fine) when trying to readByte() from a DataInputStream. But not immideately, but after x bytes in the while-loop. Security is fine (I know there have been changes to that in jre 1.4, the applet itself can be started an runs with ASCII files for transfer)
    Does anyone know, what has changed in jre1.4.
    As I said, it works fine under jre 1.3.x
    The relevant code is below: byte bt = dis.readByte(); causes the error
    try{
    // Get URL from Server
    URL uFile = new URL(sFilename);
    sThisURLFile = uFile.getFile();
    Integer inte = new Integer(i);
    //open input stream for the file on server
    DataInputStream dis = new DataInputStream(new BufferedInputStream
    (uFile.openConnection().getInputStream()));
    //open output stream for the file on local drive
    String sFilenameOnly = sThisURLFile.substring(sThisURLFile.lastIndexOf('/')+1);
    int iDotPos = sFilenameOnly.lastIndexOf(".");
    String sExt;
    if (iDotPos > 0) {
    sExt= sFilenameOnly.substring(iDotPos);
    } else {
    sExt = "";
    File fileOut = new File(sDownloadDir + sThisURLFile.substring(sThisURLFile.lastIndexOf('/')+1) );
    DataOutputStream dos = new DataOutputStream(new
    BufferedOutputStream(new FileOutputStream(fileOut)));
    //read one byte from input stream, and write that byte to output stream
    long nByte = 0;
    int iCnt = 0;
    iFilesizeDone ++;
    while (nByte < iFilesize){
    String sErrPs = new String();
    try{
    sErrPs = "00";
    byte bt = dis.readByte();
    sErrPs = "01";
    dos.writeByte(bt);
    } catch (EOFException ee)
    System.err.println("internal EOFException: " + ee.getMessage());
    System.out.println("Error Filesize is " nByte " of " iFilesize "---" + sErrPs);
    break;
    nByte++;
    iFilesizeDone ++;
    iCnt ++;
    if(iCnt >= 10240) {
    ShowProgress(nByte, iFilesize, iFilesizeDone, iFilesizeTotal); // repaint does not work during init-procedure
    iCnt = 0;
    line = "Progress: Total: " + ((iFilesizeDone*100)/iFilesizeTotal) + " perc, " + iFilesizeTotal/1024 +" kbytes" ;
    labLine.setText(line);
    //dos.flush(); // improves Client performance (Agent-Call!)
    dis.close();
    dos.close();
    }// End try
    catch (EOFException ee)
    System.err.println("EOFException: " + ee.getMessage()e);
    catch (SecurityException se)
    System.err.println("SecurityException: " + se.getMessage());
    catch (IOException ioe)
    System.err.println("IOException: " + ioe.getMessage());

    perhaps they've changed something with the file blocking.
    btw, you should try to use something like this
    DataInputStream dis = new DataInputStream(is);
    byte[] buffer=new byte[8192];
    int numBytesRead;
    while ( dis.available()>0 ) {
         numBytesRead = dis.read(buffer);
    }               

  • Problem with signed applet

    HI All,
    I am writing a small applet to draw a line graph by setting the parameters from the html pages .It came up beutifully .There are two problems here .
    1)When i try to print the applet it prints only black coloroued rectangle in place of applet(graph) .I read lot of articles only to find out that the applet need to be signed for printed .I tried all ways and means but could not succedd in printing an applet .
    2)When i try to access the applet from other computer with out copying it says that applet can not be acceessed due to security failure .It throws exception.
    I need your help on how to sign applets to access from other computer and also how to print applet content .
    Can any one help me on this
    Thanks in advance .

    i am not sure of that , but having experience with drawing images ,graphs and the like and with no experience in printing, i can share u my experience.
    using setBackground(Color.white) of the applet/panel wouldnot work since i believe it is something that is got to do with the graphics class .U have to draw a full white rectangle as a background before u start drawing lines.
    like
    g.setColor(color.white);
    g.drawfullrect(0,0,width,height); /// draw a white background
    g.setColot(Color.black);
    g.drawline(0,0);
    etc.....
    Have fun dude.

  • Write file with signed applet

    Hi!
    I have a signed applet which has to write a file to the server, but i still get permission exceptions. I guess I still have to add permissions to the applet but I realy can't find how to do that. Can anyone give me a short tutorial on how to add permissions to the applet?
    greetings

    As stated, applets are only able to write files in the machine that the applet is running on. They can't write files to other machines. They can communicate to the machine that they originate from (its host) - but not other, random machines.
    To place a file on its host, the applet sends the file contents to its host (typically using sockets for this) which receives the data with a server program. Then another program on the host writes the data to a file. If you want the file on another, random machine then it can be transferred using the same approach (sockets, etc.)
    There are alternatives, but this is the least complicated approach. This tutorial walks you through creating an applet and the host it communicates with.
    [http://java.sun.com/docs/books/tutorial/deployment/applet/server.html]
    Note that the tutorial also has a link to a more detailed tutorial, the Custom Networking Trail.

  • Lost with signed applet permissions

    Hi all,
    We need to deploy a very simple applet which sole role is to connect to a domain other than mother to send and get some data. We have a certificate from Verisign and have signed the applet. So far so good. The applet is compiled and signed with the jdk 1.3.1_12. With the JRE 1.3.1_x, it works just fine. If the jre 1.4.2_x is installed however, the connection doesn't happen and we receive a permission denied exception instead:
    java.security.AccessControlException: access denied (java.net.SocketPermission xxxxx resolve)
    With jre 1.4.2, when the applet loads, we do see the security prompt, but we get the permission denied exception even if we specifically choose to trust the applet. I thought this step would automatically grant all priviledges?
    So I don't know what to do from here. How can the applet request for the correct permission in jre 1.4.2_x? I looked around and found some information about policy files but I'm at a loss at how to use that, we have no control as to who will see the applet so I don't think we can ask all to update their policy file first.
    What we want to have is for our users to grant priviledge at the security prompt and not worry about anything else, even with jre1.4. Can it be done?
    Any help would be much appreciated.
    Tim.

    Apologies, I think this post would have been more suited for the sigend applet forum. I have reposted there, please ignore the post in this forum.

  • Help with signing applets

    Hi everybody. How do I sign an applet so that the applet is granted file access? I want the applet to request file access only and nothing else. From the applet signing tutorial it seems like signing an applet will grant all or nothing security! But I only want file access and I want the popup window which users receive to say file permissions only.

    I also developed an applet where I only want socket permission but not file permission. It is a chat applet which can connect to multiple servers and so I don't want it to be limited to the domain where it is hosted. I overcome that by signing it. But my customers will not run the applet because they do not trust the applet because they say it is requesting unlimited access to their files. They say they don't want the applet messing up the computer. How can I request socket permission only and nothing else?

  • Printing error  with t-code FBCJ: Can not find PDL for output device prtloc

    Hello , folks ,
    The error with my system show the details as follow :
    Cannot find PDL type for output device prtlocal
    Message no. FPRUNX113
    Diagnosis
    No PDL type has been found for the specified output device.
    System Response
    Error message
    Procedure
    Contact your system administrator.
    Procedure for System Administration
    For more information, see SAP Note 685571.
    Our Basis can not solve the problems .
    anybody know what's wrong with it ? 
    Thanks a lot .

    other problems could be:
    C drive is full
    ADS folder under C:\Temp are write protected

  • Need help with signing applets

    I'm trying to have an applet write a file on the client system, but I'm having issues signing my applet. I think I'm missing something and would appreciate any help. Here are the steps I am taking...
    1) keytool -genkey -alias blah
    2) answer all the questiosn
    3) jar -cvf Applet.jar *
    4) jarsigner Applet.jar blah
    5) applet code in the html file is:
    <applet code=Applet.class archive=Applet.jar width="900" height="600">
    6) run applet: appletviewer Applet.html
    I then get an AccessControlException. What am I missing? Also, why do I still get the AccessControlException when I run my applet through appletviewer? I was under the impression appletviewer automagically gave permissions, and the AccessControlExceptions were only when you tried to run the applet off a server.
    Some test code I'm using (AccessControlException at the System.getProperty line):
                        File out = new File(System.getProperty("user.dir") + "test.txt");
                        FileWriter writer = new FileWriter(out);
                        writer.write("blah");
                        writer.flush();
                        writer.close();

    It works now in my browser, after rebuilding jar and resigning. But it still doesn't work in Appletviewer...

Maybe you are looking for