Applets and Inheritance

I'm pretty miffed.
I'm asking someone already about the problem with my applet.
I.E. keeps telling me that my applet can't be instantiated, but my applet works fine with appletviewer, what gives?
My program ListApplet has a class that is made by me called MyList which inherits from the List class. I'm trying to practice inheritance since I might use it later on.
I placed both my applets in a .jar file as suggested, and I've compiled my applet as a 1.1. Could I make sure that indeed my applet was compiled using 1.1?
I really have to implement inheritance by the way. I feel that sidestepping this obstacle would be counterproductive.
Thanks.
Here's the listing for ListApplet.java(There are 3 separate files)
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class ListApplet extends Applet implements ItemListener{
MyList lstsample=new MyList();
Label lblsample=new Label();
public void init(){
setLayout(new GridLayout(2,1));
lstsample.addItemListener(this);
add(lstsample);
add(lblsample);
public void itemStateChanged(ItemEvent ie){
if(ie.getSource()==lstsample){
lblsample.setText("You have chosen"+ lstsample.getSelectedItem());
MyList.java listing
import java.awt.*;
public class MyList extends List{
     String[] str={"Migs", "Myles", "Jet", "Lans", "Tins", "Liz"};
     MyList(){
          for(int j=0;j<str.length;j++){
               this.add(str[j]);
listapplet.htm listing
<html>
<head>
<title>List Applet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" background="bbg.jpg">
<applet code="ListApplet.class" archive="MyJar.jar" codebase="." width="994" height="67">
</applet>
</body>
</html>

You wrote public class MyList extends List , but java.util.List is not a class but an interface. I suggest that you extend your class MyList from one of the classes which implement the interface java.util.List . You should also import java.util.*;

Similar Messages

  • Difference Between Applet and Swing

    Difference Between Applet and Swing

    The advantages and disadvantages of both applets and Swing are the small fluffy elephants you get inside of every box. They're quite well trained and can skeletonize your neighbors' annoying pets upon command.

  • IIS, Javascript, Signed Applet and ASP Blank Page Problem

    Hi,
    I'm having a problem using a Signed Applet in a site that runs in a IIS (Windows Server 2003).
    My aspx web page uses the applet to read my smart card and get information from it.
    This applet uses an auxiliar dll (stored in a second Signed Jar file) in order to read the information from my smart card.
    The way the solution is design:
    1) Aspx page is asked from server
    2) Internet Explorer recieve the page and asks the server for it content (images, applet, javascripts, etc)
    3) After this the JVM runs (console opens)
    4) After the Aspx page render fully a javascript register onload fires and call an applet method
    5) Applet receive the call and run the logic of the method:
         - reads the smart card;
         - calls Javascript function in order to fill aspx fields with information from smart card
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    5) The server makes some logic with the information receive and responds to client registering in aspx page a call to another Javascrit function
    6) The client received the asnwer from server and runs the Javascript function registered on step 5)
         This Javascript calls another method from applet and runs the following logic:
         - reads more information from smart card;
         - call javascript function in order to fill more fields of aspx page with the information readed
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    7) The server makes some logic and call another pages with no Applets
    8) Client asks for a second page with the same applet and we start with another logic express on steps 1);2);3),4);5) and then 7).
    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
         - with fiddler I can seer the request for the aspx page (that uses the applet)
         - but server responds with a blank html page
    The JVM doesn't fire.
    The IIS log don't show errors.
    The eventviewer doesn't show errors.
    The problem is solved with an IIS reset or a Application Pool reset.
    After a while the problem returns.
    This problem occours for other user in another machine, the server just stops responding correcly to request regarding pages with applets, the other pages still continue to work.
    If we disable Java Control Panel->Advanced->Java Plug-in->Enable the next-generation Java Plug-in the problem seend to stop, but we can't force all clients to disable this option right?
    Or there is a way to force the Applet to run with this option disabled?
    As anyone experience similar problem?
    Regards,
    OF

    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
    - with fiddler I can seer the request for the aspx page (that uses the applet)
    - but server responds with a blank html pageWell, if http requests look identical in case of success and failure (pay attention to cookies, etc) then it has to be something on the server side.
    It could be that server gets into this wrong state because of previous requests made by applet but it is hard to tell.
    I am not clear how old/new plugin can make a difference unless your applets run in the legacy mode (i.e. you are actually trying to reuse SAME instance of the applet when
    it is loaded next time).
    I'd start with
    1) carefully comparing good/bad sessions
    2) checking whether server will serve correct response to another client when it serves "bad" page for current client
    3) add debug statements to aspx - it is scripted page, may be some condition is not met and then it returns blank?
    4) record all http requests in one session until you get to "error" state and then use any http server testing tool to "replay" this set of requests.
    You should be able to get server into the same state without use of applet. Then you can try to tweak set of requests to see what makes a difference.

  • I need help with Applets and Multithreading

    [hello all.  first time poster. big fan of java.]
    now to the important matter: Applets and Threads
    =======================================
    1) I have an applet with that implements the runnable interface, and has one thread (and a simple animation). If I try to view this applet in the applet viewer with JGrasp, it spits an insane error telling me
    "java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)"
    but, if I run the applet through a web browser, by putting it in an html document, it runs correctly, without error
    What on earth is wrong, and how do I fix it?!?
    2) I want to put 2 threads in my applet?
    If I implement the Runnable interface, I can only have one Run() method in my applet, right?
    So how do I define behaviour for 2 threads when I only have one run method in which to define the behaviour? Can I use two threads with the runnable interface, or do I have to make objects of my own defined thread classes?
    3) I tried to make 2 threads in my applet by creating my own thread classes, and instantiating them in my applet (instead of implementing the runnable interface).
    I still get the same insane error as I mentioned in my first point (which I expected), except now, the applet won't work even when viewed through a web browser!!
    Please please help me. I am frustrated beyond belief (at what is probably a very simple problem)
    I have searched and searched all over and found no answers on this

    If I try to view this applet in the applet viewer with JGrasp, it spits an insane error telling me
    "java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)"Don't know anything about JGrasp, but it runs with pretty tight security - thats what this insane error is all about. Use the appletviewer or a browser.
    If I implement the Runnable interface, I can only have one Run() method in my applet, right?Correct
    So how do I define behaviour for 2 threads when I only have one run method in which to define the behaviour?
    Can I use two threads with the runnable interface, or do I have to make objects of my own defined thread classes?You can create two Runnable implementations (classes) in your applet.
    example (missing code)
    class MyApplet extends Applet {
      void doSomething() {
      void doSomethingElse() {
      void startThreads() {
        Thread t = new Thread(new Runnable() { public void run() { doSomething();}});
        t.start();
        t = new Thread(new Runnable2());
        t.start();
      class Runnable2 implements Runnable {
         public void run() {
           doSomethingElse();
    }If the above seems confusing, read up on anonymous and inner classes.
    3) I tried to make 2 threads in my applet by creating my own thread classesTry not subclassing thread - this causes a security check

  • Socket communication failure between Java applet and C++ application

    I have a java applet that connects to a C++ application via Java's ServerSocket and Socket objects. THe C++ application is using the Winsock 2 API. The applet and application are running on an NT workstation (SP 6) and using IE (5.5) For a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close. Upon performing a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket. The Java applet can still receive messages from the C++ app but C++ cannot receive responses from the Java side. Java throws no exceptions and an explicit check of the socket shows no errors. Again, what puzzles me is that it works for simple C++ applications. Are there any known conflicts between Java and C++ in this regard?
    I have inlcuded the basic java code segments below.
    / run Method.
      * This method is called by the Thread.start() method. This
      * method is required for the implementation of the Runnable interface
      * This method sets up the server side socket communication and
      * contiuously loops looking for requests from a external
      * socket.
      * @author Chris Duke
      public void run(){
         // create socket connections
         boolean success = false;
         try {
             cServerSocket = new ServerSocket(cPortID);
             System.out.println("Waiting for client to connect...");
             cClientSocket = cServerSocket.accept();
             System.out.println("Client connected");
             // Create a stream to read from the client
             cInStream = new BufferedReader(new InputStreamReader(
               cClientSocket.getInputStream()));
             // Create a stream to write to the client       
             cOutStream = new PrintWriter(
               cClientSocket.getOutputStream(), true);
             success = true;
         }catch (IOException e) {
             System.out.println("CommSocket:Run - Socket Exception(1) " + e);
             success = false;
         // if the socket was successfully created, keep the thread running
         while (success){
             try{
                // check socket to see if it is still available for reading
                if (cInStream != null && cInStream.ready()){
                    // check for an incoming message
                    String message = ReceiveMessage();
                    // Send message to listeners
                    Event(message);
                if (cInStream == null){
                    success = false;
                    System.out.println("CommSocket:Run - shutdown");
             }catch (IOException e){
                System.out.println("CommSocket:Run - Socket not ready exception");
                break;
    // SendMessage method -
      *  Sends a text message to a connected listener through port specified by portID
      * @author Chris Duke
      * @param  String message - This will be the message sent out through the server
      * socket's port specified by portID.
       public void SendMessage(String message){
          cOutStream.println(message);
          if (cOutStream.checkError() == true)
            System.out.println("SendMessage : Flush = Error");
          else{
            System.out.println("SendMessage : Flush - No Error");
       }

    a very simple C++ test applications the communictions work fine. Once more code gets added to the C++ application the portion of the socket that C++ listens to seems to close.
    This quite strongly implicates the extra code in the C++ App. The firstly thing I would try would be telnet. Try connecting to both versions of the C++ Application and manually reproducing a proper exchange.
    a recv call the return value is a zero. Microsoft insists this is a sign the Java side has shut down the socket.
    A correct implementation of recv should return the number of bytes received, or -1 for an error. A zero return indicates no bytes received not a socket closed/error. This sounds like FUD to me.
    Are there any known conflicts between Java and C++ in this regard?
    I can see no obvious faults, though the code is incomplete, I don't think it's an sockets implementation issue, at either end, it sounds more likely to be a protocol/handshaking bug in the C++ App.

  • Security issues with applets and windows Vista when printing to file

    Hi, everyone
    I am currently developing an application that prints out the result of some calculations.
    from a Javascript file, the output finally ends up in a java applet that should print the file in a special printer.
    For debugging purposes I have created a File printer that creates a file from the output comming to the printer; this way I can debug what commands the printer is receiving.
    This worked well on Windows Xp; Vista always asks for permissions for the applet, and altough I guarantee these permissions, printer is not allowed to create the output file and reports an error writing
    after a little research, I have found that java applets have all permissions when certificated as trusted applications; all but file creating permissions
    anyone has any idea of how could I fix this problem?
    Thanks in advance

    HI,
    Have you actually signed your applet? If the signers certificate is the trusted key store for Java it should treat your applet as trusted. You can use a self signed certificate for testing as long as the cert is in the trusted key store.
    Some links that might help:
    [http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html]
    [http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/rsa_signing.html]
    Cheers,
    Shane

  • I'm crazy!Applet and JNA Error:Library 'jnidispatch' was not found!

    Hi all,
    sorry to bother you, I really have no idea how to do JNA and Applet. I'm hardly mazy, man.
    Every time it will throw an error to me :
    Exception in thread "thread applet-JNAApplet-1" java.lang.UnsatisfiedLinkError: Library 'jnidispatch' was not found by class loader sun.plugin2.applet.JNLP2ClassLoader@291aff
         at com.sun.jna.Native.getWebStartLibraryPath(Native.java:858)
         at com.sun.jna.NativeLibrary.<clinit>(NativeLibrary.java:576)
         at com.sun.jna.Library$Handler.<init>(Library.java:140)
         at com.sun.jna.Native.loadLibrary(Native.java:372)
         at com.sun.jna.Native.loadLibrary(Native.java:357)
         at JNAApplet.init(JNAApplet.java:15)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)My program is so easy, I just want use Applet to revoke JNA and use the JNA to load a native lib.
    here is the structure of my program:
    Applet code :
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import com.sun.jna.Native;
    public class JNAApplet extends JApplet {
         public static Kernel32 kernel32 = null;
         @Override
         public void init() {
              createGUI();
              kernel32 = (Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
              if (kernel32 == null) {
                   System.out.println("load kernel32 fail!");
              } else {
                   System.out.println("load kernel32 success!");
         private void createGUI() {
              JPanel panelCenter = new JPanel();
              JButton butTest = new JButton("Test");
              panelCenter.add(butTest);
              setContentPane(panelCenter);
    }When I run it on debug mode, it is ok! but when I deploy it , it will throw above error message to me.
    My Applet html:
    <html>
         <head>
              <title>JNA Applet</title>
         </head>
         <body>
         <script src="deployJava.js"></script>
        <script>
            var attributes = { code:'JNAApplet',  width:300, height:300} ;
            var parameters = {jnlp_href: 'JNAApplet.jnlp'} ;
            deployJava.runApplet(attributes, parameters, '1.5');
        </script>
         </body>
    </html>File 'JNAApplet.jnlp':
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
        <information>
            <title>JNA Applet</title>
            <vendor>Steven</vendor>
        </information>
        <resources>
            <j2se version="1.5+"
                  href="http://java.sun.com/products/autodl/j2se" />
            <jar href="JNAApplet.jar" main="true" />
        </resources>
        <applet-desc
             name="JNA Applet"
             main-class="JNAApplet"
             width="300"
             height="300">
         </applet-desc>
         <update check="background"/>
    </jnlp>     I really have no idea. and I can't search any usefull infomation from Google and officer site.
    Can any one help me? Thank you very much!!!!

    Hi AndrewThompson64:
    Did you mean the JNA project? Or are you refering to JNI, or ..something else?Yes, I mean is that I wanna jna.jar to replace JNI to code with Applet. I want Applet can run native library(.dll files).
    That reads like so much nonsense to me.Sorry fo that.
    Was there any 'caused by' part that you trimmed? I expected to see something to do with 'Security' or 'AccessControl'.Sorry, I can't saw any 'cause by' subsentence there. This message is just gain from Applet Console.(Is there any method to gain more message?)
    About 'Security' and 'AccessControl' I just modify my java.policy file to allpermission. Subsequently, I signed all jar files.
    For now I have 3 jar files(all have been signed ):
    --example.jar :  for this little program.(code include applet and application entry)
    --jna.jar
    --win32-x86.jar : include kernel32.dll and jnidispatch.dll for win32 and x86.
    and 2 JNLP files:
    --JNAApplet.jnlp the entry is JNAApplet.class (this jnlp does not work)
    --JNAApp.jnlp     the entry is JNAApp.class  (this jnlp works)
    And for now new error message show like this:
    Exception in thread "thread applet-JNAApplet-1" java.lang.UnsatisfiedLinkError: Library 'Kernel32' was not found by class loader sun.plugin2.applet.JNLP2ClassLoader@4aeb52
         at com.sun.jna.Native.getWebStartLibraryPath(Native.java:858)
         at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:97)
         at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:228)
         at com.sun.jna.Library$Handler.<init>(Library.java:140)
         at com.sun.jna.Native.loadLibrary(Native.java:372)
         at com.sun.jna.Native.loadLibrary(Native.java:357)
         at JNAApplet.init(JNAApplet.java:12)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Did you mean invoke?
    Revoke: To annul by withdrawing.
    Invoke: To call on.Yes, you got it. Thank you.
    The JNLP file is invalid. ..I was about to put my 'standard' text here, but I'm sick of saying it. Search the forum for my posts - 50% of them, at least, mention validation and how to go about it.
    Also, the applet-desc requires a documentbase.Thank you, I really think I have some invalid section. But I can't find it, and you said 'Search the forum for my posts - 50% of them...' , I can read the JNLP structure on site of sun and I can to read you post too(I'm doing like this).*I only want to know about how to load "native lib like *.dll" properly*.
    What 'officer site'?I mean jna project site. Sorry for ambiguity.
    Please fix that sticky '!' key. One '!' indicates astonishment, while two or more typically indicates a bozo. Thanks for your advice. Because I tried to find solution do my best lasting two days. I got nothing. I'm sadness.
    here post my new files:
    import javax.swing.JFrame;
    import com.sun.jna.Native;
    public class JNAApp {
         public static Kernel32 kernel32 = null;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              kernel32 = (Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
              JFrame frame = new JFrame();
              frame.setSize(500, 500);
              frame.setVisible(true);
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import com.sun.jna.Native;
    public class JNAApplet extends JApplet {
         public static Kernel32 kernel32 = null;
         public void init() {
              createGUI();
                   kernel32 = (Kernel32)Native.loadLibrary("Kernel32", Kernel32.class);
         private void createGUI() {
              JPanel panelCenter = new JPanel();
              JButton butTest = new JButton("Test");
              panelCenter.add(butTest);
              setContentPane(panelCenter);
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
        <information>
            <title>JNA Applet</title>
            <vendor>Steven</vendor>
        </information>
        <resources>
            <j2se version="1.5+"
                  href="http://java.sun.com/products/autodl/j2se" />
             <jar href="JNAApplet.jar" main="true"/>
             <jar href="jna.jar"/>
        </resources>
           <resources os="Windows" arch="x86">
             <nativelib href="win32-x86.jar"/>
             <nativelib href="kernel32.jar"/>
           </resources>
        <applet-desc
             documentBase=""
                name = "success"
             main-class="JNAApplet" width = "200" height = "200">
         </applet-desc>
         <update check="background"/>
           <security>
             <all-permissions/>
           </security>
    </jnlp>     
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="" href="">
        <information>
            <title>JNA Applet</title>
            <vendor>Steven</vendor>
        </information>
        <resources>
            <j2se version="1.5+"
                  href="http://java.sun.com/products/autodl/j2se" />
             <jar href="JNAApplet.jar" main="true"/>
             <jar href="jna.jar"/>
        </resources>
           <resources os="Windows" arch="x86">
             <nativelib href="win32-x86.jar"/>
             <nativelib href="kernel32.jar"/>
           </resources>
        <application-desc
             main-class="JNAApp">
         </application-desc>
         <update check="background"/>
           <security>
             <all-permissions/>
           </security>
    </jnlp>     Thanks & Best Regards,
    Su Heng

  • First Try with JE BDB - Indexes and Inheritance troubles... (FIXED)

    Hi Mark,
    Mark wrote:
    Hi, I'm a newbie here trying some stuff on JE BDB. And now I'm having
    I am happy to help you with this, but I'll have to ask you to re-post this question to the BDB JE forum, which is...
    Sorry for the mistake. I know now that here is the place to post my doubts.
    I'm really interested in JE BDB product. I think it is fantastic!
    Regarding my first post about "Indexes and Inheritance" on JE BDB, I found out the fix for that and actually, it wasn't about "Indexes and Inheritance" but "*Inheritance and Sequence*" because I have my "@Persistent public abstract class AbstractEntity" with a "@PrimaryKey(sequence = "ID_SEQ") private Long id" property.
    This class is extended by all my business classes (@Entity Employee and @Entity Department) so that my business classes have their PrimaryKey autoincremented by the sequence.
    But, all my business classes have the same Sequence Name: "ID_SEQ" then, when I start running my JE BDB at first time, I start saving 3 new Department objects and the sequence for these department objects star with "#1" and finishes with #3.
    Then I continue saving Employee objects (here was the problem) I thought that my next Sequence number could be #4 but actually it was #101 so when I tried to save my very first Employee, I set the property "managerId=null" since this employee is the Manager, then, when I tried to save my second Employee who is working under the first one (the manager employee), I got the following exception message:
    TryingJEBDBApp DatabaseExcaption: com.sleepycat.je.ForeignConstraintException: (JE 4.0.71) Secondary persist#EntityStoreName#com.dmp.gamblit.persistence.BDB.store.eployee.Employee#*managerId*
    foreign key not allowed: it is not present in the foreign database
    persist#EntityStoreName#com.dmp.gamblit.persistence.BDB.store.eployee.Employee
    The solution:
    I fixed it modifying the managerId value from "4" to "101" and it works now!
    At this moment I'm trying to understand the Sequence mechanism and refining concerns about Cursors manipulation...
    Have you any good material about these topics, perhaps a link where I can find more detailed information on these?
    Thanks in advance Mark, thanks for your attention on this and I will post more doubts in the future for sure ;0)
    Regards,
    Diego

    Hi Diego,
    I fixed it modifying the managerId value from "4" to "101" and it works now!I'm glad you found the problem. It is usually best to get the assigned ID from the entity object after you call put(), and then use that value to fill in related fields in other entities. The primary key field (assigned from the sequence) is set by the put() method.
    At this moment I'm trying to understand the Sequence mechanism and refining concerns about Cursors manipulation...Have you any good material about these topics, perhaps a link where I can find more detailed information on these? >
    To find documentation, start at the first message in the forum, the Welcome message:
    http://forums.oracle.com/forums/ann.jspa?annID=250
    This refers to the main JE doc page, the JE FAQ and a white paper on DPL queries. The FAQ has a section on the DPL, which refers to the javadoc. The DPL javadoc has lots of info on using cursors along with indexes (see EntityIndex, PrimaryIndex, SecondaryIndex). The white paper will be useful to you if you're accustomed to using SQL.
    I don't know of any doc on sequences other than the javadoc:
    http://www.oracle.com/technology/documentation/berkeley-db/je/java/com/sleepycat/persist/model/PrimaryKey.html#sequence()
    This doc will point you to info on configuring the sequence, if that's what you're interested in.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • +, - button and inherited tick box is in disabled mode for account assignme

    In the attribute tab of org structure (PPOMA_BBP), we are not getting +, - button and inherited tick box is in disabled mode for account assignment category (attribute is KNT).
    We want to enter two values for the account assignment category with inherited tick box (ticked).
    Please suggest me how to get the +, - and inherited tick box (ticked) for the account assignment.
    Regards.

    Hi Imam,
    Unde attributes
    You will find one Application Toolbar...
    Overview, Select Attribute, Check Entries,Insert line,Delete line..
    So under All values you will find AcctAssigCat, Exculded, Default, Inheried
    Select the row and click on Insert Line, now you should be able to insert the new acct Assignment category
    rg
    sam

  • How to access a file via Applet and JavaScript

    I want to copy one file on the client machine from one place to another place from a Java Bean.
    To do this I created an applet and a Java Bean as follows:
    import java.applet.*;
    public class FileUtils extends Applet {
        public void copyFile(String src, String dest)  {
        private String source, destination; // setters/getters are there of course
        public void copyFile(ActionEvent actionEvent) { // Bean
            FacesContext fctx = FacesContext.getCurrentInstance();
            ExtendedRenderKitService erks = Service.getRenderKitService(fctx, ExtendedRenderKitService.class);
            String command = "var s = '"+ source +"'; var d ='" + destination +"'; " +  " document.fileUtilsApplet.copyFile(s, d); ";
            erks.addScript(fctx, command);
        }Then I added the APPLET tag referencing the above class in the page fragment:
                    <f:verbatim>
                        <applet code="FileUtils.class" name="fileUtilsApplet" height="30"
                                archive="/context-root/Applet.jar"
                                width="200">
                        </applet>
                    </f:verbatim>From the Java console I can see the jar is successfully downloaded, but when the code in the bean is executed, the JavaScript code does not seem to do anything, as if the "copyFile" public method was not called at all and no output in the Java Console as well.
    Note that I already followed the guidelines at http://www.oracle.com/technetwork/developer-tools/adf/learnmore/71-adf-to-applet-communication-307672.pdf .
    Do you have any ideas?

    Ok, I can see the permission problem now:
    java.security.AccessControlException: access denied (java.io.FilePermission c:\myfile.txt 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.checkRead(Unknown Source)
         at java.io.FileInputStream.<init>(Unknown Source)
    Edited by: user10047839 on 1-feb-2013 7.29
    signing the Jar and downloading the certificate permanently does not change anything in Firefox. The Java console keeps giving the above exception.
    Any idea?

  • Deploy Applet and MySQL - how to read and write

    Question on deploying Applet and MySQL
    I am building an applet that is to be a part of a simple game. The applet is supposed to read data from a MySQL server and use it to place towns on the map. In addition, the applet must be able to write to the base.
    I have build a prototype and ran it in netbeans on my computer. It then successfully read data from a local MySQL base. HOWEVER; when I embed the applet in html code it no longer reads from the base. My method for connecting to the base is
    try{
    Statement stmt;
    ResultSet rs;
    Class.forName("com.mysql.jdbc.Driver");
    String url=adress;
    Connection con=DriverManager.getConnection(url, user, user);
    stmt=con.createStatement();
    rs=stmt.executeQuery("SELECT * " +
    "from "+table+" ORDER BY id");
    while(rs.next()){
    get data...
    Town T=new Town(data...); //construct town object
    TL.put(T); //put town objects in an object TownList to use later
    con.close();
    catch(Exception e){
    So;
    1) Why wont the applet read anymore?
    2) Is there a better way to do this? I have heard that its better to connect applets to servlets in some situations. What demands does this place on the server? Is there software that you need to install on the server to use servlets?

    I think I do need an applet. The map I have written permits a lot of features that I dont know how to achieve in another way.
    1) Zooming in and out on mousewheel
    2) Clicking on on two towns gives the distance and by selecting a trooptype one can get information about the traveltime between cities.
    3) Right now, I have a feature to find players or groups of players that are of special interest. It allows a player to submit a list of interesting players. The applet reads this list and provides a button with the players name. If one clicks the name of a player, all his cities flash between their originall color and white (using thread).
    I need java to do this and I need to run it in a webbrowser because there are som parts of the game that is made up of php. So I assume I have to build it as an applet?

  • Help. How do you TAB from HTML component to applet (and back) ?

    How can one tab between applets in a browser, and from an applet to an HTML component?
    For example, I have the following in my page in decending order:
    an HTML text field,
    an applet containing two components,
    and another HTML text field.
    When focus is on the first HTML text field pressing TAB should shift focus to the first component of the applet, the next TAB press shifts focus to the second component of the applet, and the next TAB press shifts focus to the other HTML text field. Then another TAB press cycles back to the first TEXT field.
    I can handle the tabbing within the applet using the FocusManager, but how can I get the applet to receive focus on a TAB from the browser, and once the applet has focus, how can I give focus back to the browser when a TAB occurs from my last applet sub-component?
    At the moment a user has to click on the applet before he can tab in it, and then click outside it to tab in the html again.
    Any help appreciated, as I cant find any reference to how to do this apart from other people asking the same but getting no replies.
    Thanks,
    Menno

    I see what you are saying. Either use javascript with LiveConnect or go all applets.
    What we are actually doing at the moment is trying to componentise using small applets passing data via InfoBus. So I guess we could use only applets as you suggest. Either with getAppletContext, or we could have a data item on the InfoBus which contains the name of the required in-focus applet, and all applets listen to see if it is their name, and if so request focus.
    I'm suprised applets are not tab-able between by default. I would have thought this was a common requirement.
    I'll look into LiveConnect as well, and let you know how we get on.
    Cheers,
    Menno

  • Tabbing from applet to applet, HTML component to applet, and back

    How can one tab between applets in a browser, and from an applet to an HTML component?
    For example, I have the following in my page in decending order:
    an HTML text field,
    an applet containing two components,
    and another HTML text field.
    When focus is on the first HTML text field pressing TAB should shift focus to the first component of the applet, the next TAB press shifts focus to the second component of the applet, and the next TAB press shifts focus to the other HTML text field. Then another TAB press cycles back to the first TEXT field.
    I can handle the tabbing within the applet using the FocusManager, but how can I get the applet to receive focus on a TAB from the browser, and once the applet has focus, how can give focus back to the browser when a TAB occurs from my last applet sub-component? At the moment a user has to click on the applet before he can tab in it, and then click outside it to tab in the html again.
    Any help appreciated, as I cant find any reference to how to do this apart from other people asking the same but getting no replies.
    Thanks,
    Menno

    Well, I think it is both a Java & HTML problem.
    When you TAB from HTML there must be a way to TAB to the Java applet, and when you TAB from the applet there must be a way, when you are on the last component within the applet, to TAB back to the HTML components.
    Anyone know how?
    Cheers,
    Menno

  • Signed applet and HTML parameters

    I've created a signed applet and everything works fine, except for the fact that i can't add parameters to the applet.
    Without the parameters in the HTML the applet inits and starts and can be used without problems. But when I add paramaters, the applet reports a "class not found exception".
    I used HTML-converter to convert the applet tag to object/embed tags.
    Has anyone had the same problem or knows what I'm doing wrong? I'd really appreciate some help.
    Thanks in advance,
    Erik
    My HTML source:
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "600" HEIGHT = "400" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME = CODE VALUE = "TNA" >
    <PARAM NAME = ARCHIVE VALUE = "TNA.jar" >
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3.0">
    <PARAM NAME="scriptable" VALUE="false">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.3.0" CODE = "TNA" ARCHIVE = "tna.jar" WIDTH = "600" HEIGHT = "400" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "TNA" ARCHIVE = "tna.jar" WIDTH = "600" HEIGHT = "400">
    </APPLET>
    -->

    Try this:
    OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "600" HEIGHT = "400" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">
    <PARAM NAME = "java_code" VALUE = "TNA.class" >
    <PARAM NAME = "java_archive" VALUE = "TNA.jar" >
    <PARAM NAME = "java_type" VALUE="application/x-java-applet;version=1.3.1">
    <PARAM NAME="scriptable" VALUE="false">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.3.0" CODE = "TNA" ARCHIVE = "tna.jar" WIDTH = "600" HEIGHT = "400" scriptable=false pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "TNA" ARCHIVE = "tna.jar" WIDTH = "600" HEIGHT = "400">
    </APPLET>

  • HELP! How to get an applet and place it into an application?

    Hi,
    We have a third party java applet that runs on a specific server. We don't have the code for this applet, only the .class file. We usually connect to the server using any browser with HTTP protocole like http://ourServer. Then we are asked for our username and password and then the applet loads and we can run it. The applet is design to remotely control a piece of equipment. The applet runs on the server and directly coomunicate with this piece of equipment and gives us bak some information into a graphic interface.
    What we want to do is to integrate the applet into one of our stand alone application to eliminte the need for a browser. Since Applet can be add directly into any Panel I've tried something like :
    public myApp() {
         Container c = getContentPane();
         ThirdPartyApplet myApplet = new ThirdPartyApplet();
         c.setLayout(new BorderLayout());     
         c.add(myApplet,BorderLayout.CENTER);
         myApplet.init();
    Of course I've a local copy of the .class file and I've included it into my ClassPath. I can get the interface this way but I can't run it, nothing seems to work.
    I'm not an expert in applet, I don't know how this one works, but it seems that we need to get the one on the server and run it, just as a browser would do. We've also tried to integrate a Browser into our app. We've tried NetClue and IceBrowser but only IceBrowser seems to work perfectly with our applet and we don't have the money for an IceBrowser license.
    So what is wrong with the integration of an applet into a stand alon application?? How do I simulate a Browser and get the applet from the server?
    Can anyone help me on this one?
    Thanks
    Steeves

    There's a link to download the Java source on this page.
    http://java.sun.com/j2se/downloads.html
    Once you have it, look for the appletviewer source in
    src\share\classes\sun\applet

Maybe you are looking for

  • I forgot the answers of the security questions.

    I bought an iTunes card, but I can't used it cause when I try to buy it tells me to answer the security questions, but I forgot them. I sent the information to the email, but the email does not arrive, I already checked all the mailboxes. Now I can't

  • SRM Portal

    Hi all, Could anyone please let me know the difference between the status of a Purchase Order under the Order collaboration tab and Reporting tab? I see that the PO has the status of 'Confirmed' under the Supplier Collaboration tab and 'closed' under

  • Refreshing CRM's Account and Contact list with new data

    Hi Folks, I am very new to CRM and was tasked with a new job of refreshing our CRM's account and contact listing. We get a new list in Excel every now or so from a commercial vendor that compiles list of companies and key contacts and sends it out to

  • Keep getting an error pop-up in Firefox says "rappino.exe has encountered a problem and will close". What is rappino.exe, is it part of FireFox, is this important?

    I keep getting an error dialogue when running FireFox, it says "rappino.exe has encountered a problem and will close" What is rappino.exe, is it part of FireFox, should I worry" == This happened == A few times a week

  • Calling BEx via vb script

    Hi, I would like to know the procedure to call BEx via VB script.  Some background about the issue. I am in the process of performing the stress test for the BI 7.0 using mercury load runner.  So, from the mercury i will be calling the VB script to e