Applet or Web Start?

I have a program that I wish to put on my website. I want it so that users can access it with minimal difficulty. Should I use an applet or use Java Web Start? Also I have used applets once, but I am rusty, how would you convert an app to an applet.
[256 byte] By [superhalo117a] at [2007-11-27 5:38:27]
# 1

Well, the obvious advantage to WebStart is that the user can cache the application and not have to return to your site every time that they want to launch it. They can save it to their desktop, etc, etc, etc. I - typically - only use applets when they are an addition / part of the actual web site itself. I.e., it enhances the website / server a purpose for the site itself. I use WebStart when I want to use the web as my method of deploying a light-weight Desktop application or something similar. It sounds (given the little bit of information that you have provided) like WebStart is the way that you should go, but again that's hard to say without more details.

Navy_Codera at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 2

my program is a form for questions/feedback, and the typical user will only use it once. So it looks like maybe applet is the best way to go, but I can't get the applet to work. Here is my code:

import java.io.BufferedWriter;

import java.io.FileWriter;

import java.io.IOException;

/*********************************************/

/* Program: formUI.java, Rev 05/26/07*/

/* Author: */

/* Digital Internet Productions.*/

/* This is the GUI for the form used*/

/* to save the text field.*/

/* Input: Text Field, Output: comment.txt*/

/*********************************************/

public class formUI extends javax.swing.JFrame {

public formUI() {

initComponents();

}

// <editor-fold defaultstate="collapsed" desc=" Generated Code ">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jTextField2 = new javax.swing.JTextField();

jLabel4 = new javax.swing.JLabel();

jButton1 = new javax.swing.JButton();

jScrollPane1 = new javax.swing.JScrollPane();

jTextArea1 = new javax.swing.JTextArea();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));

jLabel1.setText("Please Enter your questions and comments below");

jLabel2.setText("Name:");

jLabel3.setText("Email:");

jLabel4.setText("Question / Comment:");

jButton1.setText("Submit");

jButton1.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

jButton1MouseClicked(evt);

}

});

jTextArea1.setColumns(20);

jTextArea1.setRows(5);

jScrollPane1.setViewportView(jTextArea1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(146, 146, 146)

.addComponent(jButton1))

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel2)

.addComponent(jLabel3))

.addGap(11, 11, 11)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)

.addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel4)

.addGap(210, 210, 210)))))

.addContainerGap(62, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 349, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()

.addGap(21, 21, 21)

.addComponent(jLabel1)))

.addContainerGap(25, Short.MAX_VALUE))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1)

.addGap(21, 21, 21)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

.addGap(21, 21, 21)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel3)

.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(27, 27, 27)

.addComponent(jLabel4)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jButton1)

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {

StringBuffer sb = new StringBuffer();

sb.append("Name: "+jTextField1.getText()+"\n");

sb.append("Email: "+jTextField2.getText()+"\n");

sb.append("Comment: "+jTextArea1.getText()+"\n\n");

writeToFile(sb.toString());

jOptionPane1.showMessageDialog(frame, "Your information has been submitted.", "Thank You!!", jOptionPane1.INFORMATION_MESSAGE);

System.exit(0);

}

private void writeToFile(String s) {

try {

BufferedWriter out = new BufferedWriter(new FileWriter("C:\\Dono's Files\\Text Docs\\comment.txt",true));

out.write(s);

out.close();

} catch (IOException e) {

e.toString();

}

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new formUI().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JTextArea jTextArea1;

private javax.swing.JTextField jTextField1;

private javax.swing.JTextField jTextField2;

private javax.swing.JOptionPane jOptionPane1;

private javax.swing.JFrame frame;

// End of variables declaration

}

superhalo117a at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 3
Do you realize that applets run on the *client's* machine, and that themethod writeToFile will attempt to create a file on the *client's* hard drive.How do you extent to retrieve that file?Suggestion: web app.
Hippolytea at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 4
I am running the program on a LAN, and the file that the program writes to will be on the server. Will an applet be able to handle that?
superhalo117a at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 5
C: drive is the server?Anyhowdy, by default, applets can't write files, but a signed applet can.I don't do applets, but there is a whole forum about signed applets: http://forum.java.sun.com/forum.jspa?forumID=63
Hippolytea at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 6
Thanks, the C: drive is just for testing purposes on my computer. I know that JAR files are needed to make a web app, but I don't know how to get those, also what software would the users need to run the app.
superhalo117a at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 7

Since you've started with an applet, why not continue and see how far you can do?

Anyway, from the mailbag:

> I know that JAR files are needed to make a web app, but I don't know how to get those,

web apps (JSP/servlets) are part of the J2EE. So it suffices to download the sdk

for the J2EE

You also need a servlet container like Tomcat: http://tomcat.apache.org/

to run the web application.

> also what software would the users need to run the app.

They need a web browser, like Forefox or Internet Explorer.

Hippolytea at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...
# 8
Thanks, I'll try and see what I can come up with.
superhalo117a at 2007-7-12 15:12:04 > top of Java-index,Java Essentials,Java Programming...