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.

Similar Messages

  • Upload a file with an Applet

    Hi,
    I want to know if it's possible to upload a file with an Applet, but not a signed Applet.
    Thanks
    Cris

    Yes, but you are limited to uploading to the server from where the applet was originating from.
    Regards,
    Peter Norell

  • 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

  • FileAdapter Write file with empty payload always error

    Hi All ,
    I run on 10.1.3.3.1 with patch Patch 7375080 only esb not have bpel.I have to use webservice for verify data.
    and response with set of objects.
    I have 2 important questions about write file with FileAdapter.
    1. I want to not create file if not have error from validate data but
    with this xsl tranform if I uncomment when value of condition is 'N' that will error cause single line payload.
    <xsl:for-each select="/tns:populateYFRIResponseElement/tns:result/tns:wrongLines">
    <!--<xsl:choose>
    <xsl:when test="../tns:isHaveWrongLines = 'Y'">-->
    <imp1:Child-Element>
    <imp1:FrameNo>
    <xsl:value-of select="concat('&quot;',tns:frameNo,'&quot;')"/>
    </imp1:FrameNo>
    <imp1:EngineNo>
    <xsl:value-of select="concat('&quot;',tns:engineNo,'&quot;')"/>
    </imp1:EngineNo>
    </imp1:Child-Element>
    <!-- </xsl:when>
    </xsl:choose>-->
    </xsl:for-each>
    but if I comment if condition 'Y' FileAdapter create csv files with empty like "","" .
    2.
    I must write log file with FileAdapter . I want to append file so I add attribute Append=true
    to wsdl
    <jca:operation
    LogicalDirectory="outgoingfile"
    InteractionSpec="oracle.tip.adapter.file.outbound.FileInteractionSpec"
    FileNamingConvention="YFRI%yyMMdd%.log"
    NumberMessages="1"
    Append = "true"
    >
    but when run that throws errors cause properties append not found.
    I view class FileInteractionSpec that have append properties .I very confuse.
    Any help would be appreciated.
    Regards,
    Weerawat

    Hi
    Thank for good answer.I am newbies in esb so I don't know that have routing expression before.
    I'm so glad your answer very helpful before routing but same question 1 if I have detail must not write data like below
    ,import file name YFRI20090616165654.DAT at Tue Jun 16 16:59:26 GMT+07:00 2009 with number of data is 2 correct line is 2
    "D",0,0,
    ,import file name YFRI20090616170202.DAT at Tue Jun 16 17:04:40 GMT+07:00 2009 with number of data is 12 correct line is 12
    "D",0,0,
    YFRI.txt,import file name YFRI.txt at Tue Jun 16 19:53:48 GMT+07:00 2009 with number of data is 2 error line is 2
    "D",1,3,MTOCCode:ZE8839LZ SAA is not have in DB
    "D",2,3,MTOCCode:ZE8839LZ SAA is not have in DB
    with
    <xsd:element name="LogFile">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="FileName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="Desc" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
    </xsd:element>
    <xsd:element name="Detail" nxsd:startsWith="&quot;D&quot;," maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence nxsd:style="array" nxsd:arrayTerminatedBy="${eol}">
    <xsd:element name="line" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;"/>
    <xsd:element name="column" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;"/>
    <xsd:element name="desc" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    ESB will display error payload If import not have verify error detail so I have to write 'D',0,0 (Detail,Line,Column).
    In this situation how am I to do ?
    In question 2 .Now I can append with
    <jca:operation
    LogicalDirectory="outgoingfile"
    InteractionSpec="oracle.tip.adapter.file.outbound.FileInteractionSpec"
    FileNamingConvention="YFRI%yyMMdd%.log"
    NumberMessages="1"
    OpaqueSchema="false"
    Append="true"
    >
    </jca:operation>
    Thank you
    Weerawat

  • 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);
    }               

  • Can you write to files with an applet or what?

    Hi I can't get the bufferwriter to output any text to a file. Not sure if this is because I'm using an applet? I wouldn't assume so, but any help would be appreciated
    The problem area is :
    private boolean registerNewUser()
            FileOutputStream writer;
            try
                BufferedWriter out = new BufferedWriter(new FileWriter("logins.txt"));
                out.write(regUserField.getText());
                char [] tempPass = regPasswordField.getPassword();
                String tempString = tempPass.toString();
                out.write("\n" + tempString);
                out.close();
            catch(IOException e)
                System.out.println("Writing file error.");
                System.exit(0);
            int intSS = Integer.parseInt(regSSNField.getText());
            currentUserAccount = new Account(regNameField.getText(), intSS);
            return true;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.Icon;
    import javax.swing.JApplet;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import java.lang.*;
    import java.io.*;
    import java.util.*;
    public class JBank extends JApplet implements ActionListener
        private static double totalMoney = 0;
        private static final String BANK_MENUITEM = "Bank";
        private static final String NEW_ACCT_MENUITEM = "New Account";
        private static final String OPEN_ACCT_MENUITEM = "Open Account";
        private static final String DELETE_ACCT_MENUITEM = "Delete Account";
        private static final String TRANSFER_ACCT_MENUITEM = "Account transfer";
        private static final String WITHDRAW_ACCT_MENUITEM = "Withdraw Funds";
        private static final String DEPOSIT_ACCT_MENUITEM = "Deposit Funds";
        private static final String OVERVIEW_ACCT_MENUITEM = "Overview of Accounts";
        private static final String CHECKING_RADIO_BUTTON = "new account checking";
        private static final String SAVINGS_RADIO_BUTTON = "new account savings";
        private static final String RETIREMENT_RADIO_BUTTON = "new account retirement";
        private static final String LOGIN_BUTTON = "login";
        private static final String REGISTER_BUTTON = "register";
        private static final String CANCEL_BUTTON = "cancel";
        private static final String NEW_ACCT_OK_BUTTON = "new account ok";
        private static final String NEW_ACCT_CANCEL_BUTTON = "new account cancel";
        private static final String NEW_USER_REGISTER_BUTTON = "new user registration";
        private static final String MAIN_TITLE_TEXT = "JBank - A Comp 285 Project";
        private Container contentPane = getContentPane();
        private JFrame loginFrame = new JFrame();
        private JFrame registrationFrame = new JFrame();
        private JFrame newAccountFrame = new JFrame();
        private JLabel title;
        private JTextField loginField;
        private JPasswordField passwordField;
        private JTextField regNameField;
        private JTextField regSSNField;
        private JTextField regUserField;
        private JTextField initialMoneyField;
        private JPasswordField regPasswordField;
        boolean trueUser = false;
        boolean savingsSelected = false;
        boolean checkingSelected = false;
        boolean retirementSelected = false;
        Account currentUserAccount;
        public void init()
            //Login First
            loginFrame();
            contentPane.setLayout(new BorderLayout());
            // background color: lightblue
            float red = 0f;
            float blue = .3f;
            float green = .2f;                                     // Java sees double, must specify a suffix of f to
            float alpha = .05f;                                    //create float since
            Color lightBlue = new Color(red, green, blue, alpha); //<-- constructor requires floats
            contentPane.setBackground(lightBlue);
            // Menu
            JMenuBar jBar = new JMenuBar();
            JMenu bankMenu = new JMenu(BANK_MENUITEM);
            JMenuItem b;
            b = new JMenuItem(NEW_ACCT_MENUITEM);
            b.addActionListener(this);
            bankMenu.add(b);
            b = new JMenuItem(OPEN_ACCT_MENUITEM);
            b.addActionListener(this);
            bankMenu.add(b);
            b = new JMenuItem(DELETE_ACCT_MENUITEM);
            b.addActionListener(this);
            bankMenu.add(b);
            b = new JMenuItem(TRANSFER_ACCT_MENUITEM);
            b.addActionListener(this);
            bankMenu.add(b);
            b = new JMenuItem(OVERVIEW_ACCT_MENUITEM);
            b.addActionListener(this);
            bankMenu.add(b);
            jBar.add(bankMenu);
            setJMenuBar(jBar);
            // Title JBankset
            title = new JLabel(MAIN_TITLE_TEXT);
            contentPane.add(title);
        public void actionPerformed(ActionEvent arg0)
            String command = arg0.getActionCommand();
            if (command.equals(BANK_MENUITEM))
                title.setText(MAIN_TITLE_TEXT + " " +
                        BANK_MENUITEM);
            else if (command.equals(NEW_ACCT_MENUITEM))
                title.setText(MAIN_TITLE_TEXT + " " +
                        NEW_ACCT_MENUITEM);
                newAccountFrame();
            else if (command.equals(OPEN_ACCT_MENUITEM))
                title.setText(MAIN_TITLE_TEXT + " " +
                        OPEN_ACCT_MENUITEM);
            else if (command.equals(DELETE_ACCT_MENUITEM))
                title.setText(MAIN_TITLE_TEXT + " " +
                        DELETE_ACCT_MENUITEM);
            else if (command.equals(TRANSFER_ACCT_MENUITEM))
                title.setText(MAIN_TITLE_TEXT + " " +
                        TRANSFER_ACCT_MENUITEM);
            else if (command.equals(OVERVIEW_ACCT_MENUITEM))
                title.setText(MAIN_TITLE_TEXT + " " +
                        OVERVIEW_ACCT_MENUITEM);
            else if (command.equals(LOGIN_BUTTON))
                Scanner loginFile = null;
                String currentFileLoginName;
                String triedLogin = loginField.getText();
                try
                   loginFile = new Scanner(new FileInputStream("logins.txt"));
                catch(FileNotFoundException e)
                    System.out.println("Internal Error");
                    System.exit(0);
                do
                   currentFileLoginName = loginFile.nextLine();
                   if  (processLogin(currentFileLoginName, triedLogin, loginFile)) //Send Logins&File | Return boolean
                       loginFile.close(); //Close File
                       break; //Login true. Break out of while loop
                while (loginFile.hasNextLine() == true);
            else if (command.equals(REGISTER_BUTTON))
                registrationFrame();
            else if (command.equals(NEW_USER_REGISTER_BUTTON))
                registrationFrame.setVisible(false);
                if (checkFields() == false)
                    registrationFrame.dispose();
                    registrationFrame();
                else
                registerNewUser();
            else if (command.equals(CHECKING_RADIO_BUTTON))
                savingsSelected = false;
                checkingSelected = true;
                retirementSelected = false;
            else if (command.equals(SAVINGS_RADIO_BUTTON))
                savingsSelected = true;
                checkingSelected = false;
                retirementSelected = false;
            else if(command.equals(RETIREMENT_RADIO_BUTTON))
                savingsSelected = false;
                checkingSelected = false;
                retirementSelected = true;
            else if (command.equals(NEW_ACCT_OK_BUTTON))
                double doubleInitialMoney = Double.parseDouble(initialMoneyField.getText());
                if (savingsSelected)
                    currentUserAccount.registerAccount("savings");
                    currentUserAccount.deposit("savings", doubleInitialMoney);
                if (checkingSelected)
                    currentUserAccount.registerAccount("checking");
                    currentUserAccount.deposit("checking", doubleInitialMoney);
                if (retirementSelected)
                    currentUserAccount.registerAccount("register");
                    currentUserAccount.deposit("retirement", doubleInitialMoney);
                newAccountFrame.dispose();
        private void loginFrame()
            loginFrame.setTitle("JBank -- Login Required");
            loginFrame.setDefaultLookAndFeelDecorated(true);
            loginFrame.setBounds(400,350,225,130);
            JTextField login = new JTextField("User ID");
            JTextField password = new JTextField("Password");
            loginFrame.setLayout(new GridLayout(0,2));
            //Button Panel
            JPanel buttonPanel = new JPanel();
            buttonPanel.setLayout(new GridLayout(4,0));
            JLabel space = new JLabel("                   ");
            JButton okButton = new JButton("Login");
            okButton.isDefaultButton();
            okButton.setVerticalTextPosition(AbstractButton.CENTER);
            JButton register = new JButton("Register");
            register.setVerticalTextPosition(AbstractButton.CENTER);
            okButton.setActionCommand(LOGIN_BUTTON);
            register.setActionCommand(REGISTER_BUTTON);
            okButton.addActionListener(this);
            register.addActionListener(this);
            buttonPanel.add(okButton);
            buttonPanel.add(space);
            buttonPanel.add(register);
            buttonPanel.add(space);
            //Text Panel
            JPanel textPanel = new JPanel();
            textPanel.setLayout(new GridLayout(4,0));
            JLabel userIDLabel = new JLabel("User ID:");
            JLabel passwordLabel = new JLabel("Password:");
            loginField = new JTextField(14);
            passwordField = new JPasswordField(14);
            textPanel.add(userIDLabel);
            textPanel.add(loginField);
            textPanel.add(passwordLabel);
            textPanel.add(passwordField);
            loginFrame.add(textPanel);
            loginFrame.add(buttonPanel);
            loginFrame.setVisible(true);
        private void registrationFrame()
            loginFrame.setVisible(false);
            //Registration's Frame
            registrationFrame.setTitle("JBank -- Registration");
            registrationFrame.setDefaultLookAndFeelDecorated(true);
            registrationFrame.setBounds(400,350,300,300);
            registrationFrame.setLayout(new BorderLayout());
            //Buttons
            JButton registerButton = new JButton("Register");
            JButton cancelButton = new JButton("Cancel");
            //Text Fields
            regNameField = new JTextField(20);
            regSSNField = new JTextField(8);
            regUserField = new JTextField(14);
            regPasswordField = new JPasswordField(14);
            //Labels
            JLabel nameLabel = new JLabel("Name:  ");
            JLabel ssnLabel = new JLabel("Social Security: ");
            JLabel newUserLabel = new JLabel("Desired User ID: ");
            JLabel newPasswordLabel = new JLabel("Desired Password: ");
            //Top Panel
            JPanel newUserFieldsPanel = new JPanel();
            newUserFieldsPanel.setLayout(new GridLayout(8,0));
            //Bottom Panel
            JPanel newUserButtonsPanel = new JPanel();
            newUserButtonsPanel.setLayout(new GridLayout(0,2));
            //Add
            newUserFieldsPanel.add(nameLabel);
            newUserFieldsPanel.add(regNameField);
            newUserFieldsPanel.add(ssnLabel);
            newUserFieldsPanel.add(regSSNField);
            newUserFieldsPanel.add(newUserLabel);
            newUserFieldsPanel.add(regUserField);
            newUserFieldsPanel.add(newPasswordLabel);
            newUserFieldsPanel.add(regPasswordField);
            newUserButtonsPanel.add(registerButton);
            newUserButtonsPanel.add(cancelButton);
            registrationFrame.add(newUserFieldsPanel, BorderLayout.CENTER);
            registrationFrame.add(newUserButtonsPanel, BorderLayout.SOUTH);
            //Action Listeners
            registerButton.setActionCommand(NEW_USER_REGISTER_BUTTON);
            cancelButton.setActionCommand(CANCEL_BUTTON);
            registerButton.addActionListener(this);
            cancelButton.addActionListener(this);
            registrationFrame.setVisible(true);
        private void newAccountFrame()
            //New Account Frame
            newAccountFrame.setTitle("Create New Account");
            newAccountFrame.setDefaultLookAndFeelDecorated(true);
            newAccountFrame.setBounds(400,350,300,300);
            newAccountFrame.setLayout(new BorderLayout());
            //Buttons
            JButton newAcctOkButton = new JButton("OK");
            JButton newAcctCancelButton = new JButton("Cancel");
            //Radio Buttons
            JRadioButton checkingOption = new JRadioButton("Checking Account");
            JRadioButton savingsOption = new JRadioButton("Savings Account");
            JRadioButton retirementOption = new JRadioButton("Retirement Account");
            //Group 'em
            ButtonGroup accountSettings = new ButtonGroup();
            accountSettings.add(checkingOption);
            accountSettings.add(savingsOption);
            accountSettings.add(retirementOption);
            //Text Fields
            initialMoneyField = new JTextField("0", 8);
            //Labels
            JLabel depositLabel = new JLabel("Initial Deposit:  ");
            JLabel optionLabel = new JLabel("What kind of account would \n"
            + "you like to create?");
            //Top Panel
            JPanel newAcctOptionsPanel = new JPanel();
            newAcctOptionsPanel.setLayout(new GridLayout(4,0));
            //Bottom Panel
            JPanel newAcctTextPanel = new JPanel();
            newAcctTextPanel.setLayout(new GridLayout(2,2));
            //Add
            newAcctOptionsPanel.add(optionLabel);
            newAcctOptionsPanel.add(checkingOption);
            newAcctOptionsPanel.add(savingsOption);
            newAcctOptionsPanel.add(retirementOption);
            newAcctTextPanel.add(depositLabel);
            newAcctTextPanel.add(initialMoneyField);
            newAcctTextPanel.add(newAcctOkButton);
            newAcctTextPanel.add(newAcctCancelButton);
            newAccountFrame.add(newAcctOptionsPanel, BorderLayout.CENTER);
            newAccountFrame.add(newAcctTextPanel, BorderLayout.SOUTH);
            //Action Listeners
            checkingOption.setActionCommand(CHECKING_RADIO_BUTTON);
            savingsOption.setActionCommand(SAVINGS_RADIO_BUTTON);
            retirementOption.setActionCommand(RETIREMENT_RADIO_BUTTON);
            checkingOption.addActionListener(this);
            savingsOption.addActionListener(this);
            retirementOption.addActionListener(this);
            newAcctOkButton.setActionCommand(NEW_ACCT_OK_BUTTON);
            newAcctCancelButton.setActionCommand(NEW_ACCT_CANCEL_BUTTON);
            newAcctOkButton.addActionListener(this);
            newAcctCancelButton.addActionListener(this);
            newAccountFrame.setVisible(true);
        private boolean checkFields()
            //Check Name Field
            String triedName = regNameField.getText();
            if (triedName.length() == 0)
                JOptionPane.showMessageDialog(null,
                "Empty Name Field. Try Again.",
                "Error Message",
                JOptionPane.ERROR_MESSAGE);
                return false;
            //Check SSN
            String triedSS = regSSNField.getText();
            int parsedSS = 0;
            try
                parsedSS = Integer.parseInt(triedSS);
            catch(Exception e)
                JOptionPane.showMessageDialog(null,
                "Numbers only in Social Security Field!\n Try Again.",
                "Error Message",
                JOptionPane.ERROR_MESSAGE);
                return false;
            if (triedSS.length() < 8)
                JOptionPane.showMessageDialog(null,
                "Social Security Number is not 8 Digits.\n Try Again.",
                "Error Message",
                JOptionPane.ERROR_MESSAGE);
                return false;
            //Check User ID
            String triedUser = regUserField.getText();
            if (triedUser.length() < 6)
                JOptionPane.showMessageDialog(null,
                "Desired User ID too short.\n Try Again",
                "Error Message",
                JOptionPane.ERROR_MESSAGE);
                return false;
            //Check Password
            char[] triedPassword = regPasswordField.getPassword();
            String stringPassword = triedPassword.toString();
            if (stringPassword.length() < 6)
                JOptionPane.showMessageDialog(null,
                "Desired Password Too Short. \n Try Again.",
                "Error Message",
                JOptionPane.ERROR_MESSAGE);
                return false;
            return true;
        private boolean registerNewUser()
            FileOutputStream writer;
            try
                BufferedWriter out = new BufferedWriter(new FileWriter("logins"));
                out.write(regUserField.getText());
                char [] tempPass = regPasswordField.getPassword();
                String tempString = tempPass.toString();
                out.write("\n" + tempString);
                out.close();
            catch(IOException e)
                System.out.println("Writing file error.");
                System.exit(0);
            int intSS = Integer.parseInt(regSSNField.getText());
            currentUserAccount = new Account(regNameField.getText(), intSS);
            return true;
        private boolean processLogin(String currentFileLoginName, String triedLogin, Scanner loginFile)
            char[] userPassword = passwordField.getPassword();
            if (currentFileLoginName.equals(triedLogin))
                String currentFilePassword = loginFile.nextLine(); //Login recognized, go to next line for password
                char[] charPassword = currentFilePassword.toCharArray();
                if (charPassword.length == userPassword.length) //Password Lengths match?
                    if(Arrays.equals(userPassword, charPassword)) //Do characters match?
                        trueUser = true;
                        loginFrame.dispose();
                        return true;
                else
                    JOptionPane.showMessageDialog(null, //Notify User of Incorrect password
                     "Invalid password. Try again.",
                     "Error Message",
                     JOptionPane.ERROR_MESSAGE);
                     return false;
            else
                JOptionPane.showMessageDialog(null, //Notify user of unrecognized login
                "Unknown User ID. Try again\n or Register.",
                "Error Message",
                JOptionPane.ERROR_MESSAGE);
                return false;
            return false;
        private class Account
        private String name;
        private int ssn;
        private double totalUserMoney;
        private boolean checking = false;
        private boolean savings = false;
        private boolean retirement = false;
        private double checking_holdings;
        private double savings_holdings;
        private double retirement_holdings;
       public Account(String userName, int ss)
           name = userName;
           ssn = ss;
        public int getSSN()
            return ssn;
        public double getTotalUserMoney()
            return totalUserMoney;
        public boolean getUserAccounts(String type)
           if (type.equals("checking"))
               if (checking == false)
               return false;
               else
               return true;
            if (type.equals("savings"))
                if (savings == false)
                return false;
                else
                return true;
            if (type.equals("retirement"))
                if (retirement == false)
                return false;
                else
                return true;
            return false;
        public void registerAccount(String type)
            if (type.equals("checking"))
            checking = true;
            else if (type.equals("savings"))
            savings = true;
            else if (type.equals("retirement"))
            retirement = true;
            else
            System.out.println("Internal error"); //Should not reach here
        public boolean withdraw(String type, Double moneyAmount)
            if(getUserAccounts(type))
                if(type.equals("checking"))
                    if (moneyAmount > checking_holdings)
                        JOptionPane.showMessageDialog(null,"Insufficient holdings in checking account");
                    else
                        checking_holdings -= moneyAmount;
                        totalUserMoney -= moneyAmount;
                        return true;
                if(type.equals("savings"))
                    if (moneyAmount > checking_holdings)
                        JOptionPane.showMessageDialog(null,"Insufficient holdings in savings account");
                    else
                        savings_holdings -= moneyAmount;
                        totalUserMoney -= moneyAmount;
                        return true;
                if(type.equals("retirement"))
                    if (moneyAmount > checking_holdings)
                        JOptionPane.showMessageDialog(null,"Insufficient holdings in retirement account");
                    else
                        retirement_holdings -= moneyAmount;
                        totalUserMoney -= moneyAmount;
                        return true;
            else
                JOptionPane.showMessageDialog(null,"No such account exists");
                return false;
        public boolean deposit(String type, Double moneyAmount)
            if(getUserAccounts(type))
                if(type.equals("checking"))
                    checking_holdings += moneyAmount;
                    totalUserMoney += moneyAmount;
                    return true;
                if(type.equals("savings"))
                    savings_holdings += moneyAmount;
                    totalUserMoney += moneyAmount;
                    return true;
                if(type.equals("retirement"))
                    retirement_holdings += moneyAmount;
                    totalUserMoney += moneyAmount;
                    return true;
            else
                JOptionPane.showMessageDialog(null,"No such account exists");
                return false;
        public void deleteAccount(String type)
            if (type.equals("checking"))
                totalUserMoney -= checking_holdings;
                checking = false;
            if (type.equals("savings"))
                totalUserMoney -= savings_holdings;
                savings = false;
            if (type.equals("retirement"))
                totalUserMoney -= retirement_holdings;
                retirement = false;
        public void showAccountInfo()
            if (checking == true && savings == true && retirement == true)
            System.out.println(name + "'s Accounts: " + "\nChecking Account: $" + checking_holdings
            + "\nSavings Account: $" + savings_holdings + "\nRetirement Account: $" +
            retirement_holdings + "\n\nTotal: $" + totalUserMoney);
        public void showAccountInfo(String type)
            System.out.println(name + " ");
    }

    In the future, do not post eleventeenkathousand lines of code. No one is going to read it all and - quite frankly - no one really cares.
    As for the issue at hand, whenever you are going to access the file system, a remote server, access the clipboard and a handful of other "security" related issues, you must sign your applet.
    Google for sun's tutorial on signing applets.

  • Problems with Signed Applets

    Hello !
    I have an applet program that displays the content of a batch file in the Applet window.
    To sign the Applet I have converted the corresponding class file to a jar .
    Then using keytool & jarsigner... I had signed it .
    I tried to restrict the enuser form editing the contents of that batchfile's contents.
    To restrict it I had Created a Policy file with only read permission allowed .
    After following the above procedures , when i tried to run my applet, the applet is getting loaded sucessfully with that batch file's content .
    And when i try to edit it , I'm able to edit the contents . I don't how this could be possible bcoz i have set the permission only to read it !
    Any Ideas Please !
    TIA

    in the policy file, you restrict the applet to only read files. but if you have already signed it and clicked Yes on the certification screen when loading the applet, the applet gets full permission.
    the other thing is that you have a textarea field or something, you must set the textarea to readonly.
    if you read in a file's content and display it in a textarea, the user can change the content of the textarea, but if your applet does not write the changes back to the file, the file won't be changed, although the user has changed the textarea content.
    perhaps you might post some more info on the code you are using....

  • How to resolve problems in policy file of signed Applet

    Hi to All,
    I want to connect the web site through my Signed Applet which is working as a Proxy server. but i m facing certain problems in my policy file:
    this is my policy file :-
    grant {
    permission java.security.AllPermission "", "";
    permission java.net.SocketPermission "http://www.google.com:4321", "connect, accept,resolve";
    permission java.security.UnresolvedPermission;
    n i got such type of exceptions n my Applet prompt applet not initialized.
    Got connection Socket[addr=/192.168.1.232,port=1200,localport=4321]
    Reading request...
    URI is: http://www.google.com/
    Host to contact is: www.google.com at port 80
    Got request...
    java.security.AccessControlException: access denied (java.net.SocketPermission www.google.com resolve)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
    at java.security.AccessController.checkPermission(AccessController.java:427)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.SecurityManager.checkConnect(SecurityManager.java:1031)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1117)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1098)
    at java.net.InetAddress.getAllByName(InetAddress.java:1061)
    at java.net.InetAddress.getByName(InetAddress.java:958)
    at java.net.InetSocketAddress.<init>(InetSocketAddress.java:124)
    at java.net.Socket.<init>(Socket.java:179)
    at ProxyApplet.handle(ProxyApplet.java:75)
    at ProxyApplet.<init>(ProxyApplet.java:132)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
    at java.lang.Class.newInstance0(Class.java:350)
    at java.lang.Class.newInstance(Class.java:303)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:721)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:650)
    at sun.applet.AppletPanel.run(AppletPanel.java:324)
    at java.lang.Thread.run(Thread.java:595)
    here 4321 is Port no. which i've as a random port no.
    plz Help
    thnx in advance
    with regards
    pank_naini

    Please, if you can't help me, could you tell me who can I contact ?

  • How to handle 2 or more .jar files with an applet

    Hey out there
    I have created an ftpClient application that uses "jakarta ftpClient". It works fine as an JFrame application � But when I converted the Application into an JApplet I get the following Exception:
    java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
    I have bundled the main application into a .jar file (Application,jar). But I don't know how to handle the 2 jakarta .jar files with my JApplet??
    I Tried to append the 2 jakarta .jar files to the Application,jar with the following code:
    jar cvf Application.jar 1.class 2.class�. commons-net-1.4.1.jar jakarta-oro-2.0.8.jar
    But with the same result / Exception (I have signed the Jar file!)
    Can anyone help me

    Hi i have a question with your application can you down- or upload more files at the same time? Because i'm having problems with my ftp application.
    Here is the link with my problem maybe you can help me. I will be very pleased when you can help me.
    http://forum.java.sun.com/thread.jspa?threadID=5162042&tstart=0
    Thx
    Satanduvel

  • 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.

  • Error Log entry Unable to write file with XML Saver

    Hi all,
    I have just encountered the following problem. I am saving a XML file using the XML Saver. Another BLT reads the file, changes something, and saves it again with the same name.
    The file is saved, but the NetWeaver SAP Log gives the error
    "Unable to write file /usr/sap/<SID>/JC00/j2ee/cluster/server0/apps/sap.com/xappsxmiiear/servlet_jsp/XMII/root/CM/<folder>/file.xml"
    Is it a problem with the new storage mechanism in MII 12? Even if I delete the file first and then save it again with the same name, the error is displayed (though the file is saved).
    Michael

    Hi Mike,
    no, the Debug only says "Begin Action XML Saver" and "End Action XML Saver".
    The action however writes the file, the contents has changed after the BLT has run.
    Well, I have just tried the Text Saver with the same file (name and contents). It also gives the error. I now wanted to delete the folder. The folder disappered from the workbench view, and the Netweaver log says "Unable to process service message".
    I then clicked "publish" on the parent folder and tried to create the folder again, but although the folder was not displayed, the workbench said "the folder already exists". When I start my BLT, it could write the file into the folder which then reappeared in the workbench.
    Hm, maybe our installation has some problems? Feels like missing authorizations...
    Michael

  • How to read client's home directory files using  signed applets

    hi
    i want to konw the exact procedure for the creation of signed applets . using that i want to read my client files....
    Thanks
    Dileep

    google: http://www.google.com/search?q=how+to+sign+an+applet

  • IE Crashes with signed applet.

    I've been having problems in the last few days where my signed applet will crash on one server, and will not on the other.
    The server it doesn't crash on never crashes, where as the one it does crash on, will always crash. The certificate is currently my own and I have not yet purchased a Verisign cert.
    The applet uses 1.3.1_04 and I'm not sure what else to do.
    Any suggestions?

    Maybe some bug on 1.3.1_04 plugin version, uninstall it and
    try to install the version 1.3.1_01 from sun archive:
    http://java.sun.com/products/archive/index.html
    I had the same problem running that 1.3.1_04 version!
    When I get installed the 1.3.1_01 version I had not problems
    anymore.
    crt

  • Help with how to read and write files to the applets server

    I am writing a form that requires some data to be written serverside(not on the host machine) and I also need to be able to read from those same files.
    Can anyone provide any help?
    I looked into signing but it seems, to me, that signing is for when you are going to be modifying files on the host...

    brianb7590 wrote:
    Would I use that to refer to the file like I would with a regular application?Nope. It's pretty complicated. You've got to set something up on the server to accept requests, get all the data and then save files somewhere and on the client side you've got to make the connection and send the data.
    Edited by: tjacobs01 on Apr 13, 2009 5:49 PM

  • 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.

Maybe you are looking for

  • SOAP Receiver- Error While Sending Message: 500 Internal Server Error

    Hello, Our scenario: IDoc to SOAP I have added a third party system in the SLD and have used the same in my ID configuration. An idoc will be triggered from R/3, which will received in PI, PI will transform the IDoc into SOAP message for the third pa

  • Can Apple unlock my Iphone 4s?, Can Apple unlock my Iphone 4s?

    I bought an Iphone 4s and it worked in my former country but once I tried using an uk sim (O2) it doesnt seem to be reading is. Does the apple store unlock iphones?

  • Cannot use iTunes to download apps or rearrange icons

    Since I updated iOS 8 on my iPhone 6 this morning, I cannot rearrange the icons on my screens, either right on the phone or in iTunes when connected with USB cord.  I also cannot install apps that I previously downloaded.  Anyone else having these pr

  • How to know current form name in oracle applications 11i.

    Hi all, By clicking on Help menu-> About Oracle Applications, it will display environment variables info, and current form info, on which we r working. I want to know from where this information is coming, Where oracle applicaitons will store this in

  • Touchup Reading Order Window Disappears

    I am using Adobe Acrobat Professional version 8.1.2 and Windows XP. I want to use the TouchUp Reading Order tool to exclude a portion of the page from what is considered readable text after adding tags from the Accessibility menu(specifically, there