Results 1 to 4 of 4
  1. #1
    gan5016 is offline Member
    Join Date
    Aug 2009
    Posts
    18
    Rep Power
    0

    Default Applet vs application

    Anyone knows is a java applet can control an java application which able to write a text file.
    Actually what i need is to change the .txt file contents in the same folder by applet.Let say the user type something on the applet and i want the text to be saved in my folder.
    I had tried to use the write file method which has to sign the applet.But this seem like very hard to be done.
    Any idea....:)
    Thanks..

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    method to sign jar

    from Deploying Software with JNLP and Java Web Start

    1) First, create the JAR file:
    jar cf JNLPTime.jar TheTime.class
    2) Second, create a key in the keystore (or use one you already have). You'll be prompted for information like first name and last. You should at least fill in that information.
    keytool -genkey -keystore myKeys -alias jdc
    3) Third, sign the JAR. Be sure to remember your password from the previous step.
    jarsigner -keystore myKeys JNLPTime.jar jdc

    keytool, jarsigner, jar should find in your jdk/bin/

  3. #3
    gan5016 is offline Member
    Join Date
    Aug 2009
    Posts
    18
    Rep Power
    0

    Default

    Thanks a lots..

  4. #4
    gan5016 is offline Member
    Join Date
    Aug 2009
    Posts
    18
    Rep Power
    0

    Default

    i try the jarsigner things by compiling the following file,
    then create jar file , keystore and follow with the jarsigner but it doesnt work,
    for the keystore should i create my own one?im using others that found online...


    public class write1 extends JApplet implements ActionListener
    {
    String yy = "asdasdada";
    JButton jb1;
    public void init()
    {
    Container c = getContentPane();
    c.setLayout ( new FlowLayout(FlowLayout.LEFT, 20, 20) );
    jb1 = new JButton("Blast");
    jb1.addActionListener(this);
    c.add(jb1);
    }
    public void actionPerformed(ActionEvent evt)
    {
    if (evt.getSource()==jb1)
    {

    try
    {

    Writer output1 = null;
    String out1 = "this is to try 0ut th things";
    File file1 = new File("G://writefileresult.txt");//write file
    output1 = new BufferedWriter(new FileWriter(file1,true));
    output1.write(out1);
    output1.close();
    }
    catch(IOException iox)
    {
    System.out.println("File read error...");
    iox.printStackTrace();
    }

    }
    }
    }

Similar Threads

  1. [SOLVED] Application -> Applet
    By Ypsilon IV in forum Java Applets
    Replies: 2
    Last Post: 04-25-2009, 09:26 PM
  2. convert application to applet in netbeans
    By dbashby in forum New To Java
    Replies: 7
    Last Post: 04-18-2009, 04:49 AM
  3. Applet to Application (Game)
    By AndrewM16921 in forum Java Applets
    Replies: 3
    Last Post: 04-12-2009, 01:24 PM
  4. starting a Swing application from an applet
    By FakeRabbit in forum Java Applets
    Replies: 9
    Last Post: 09-21-2008, 08:00 PM
  5. Replies: 1
    Last Post: 07-06-2007, 06:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •