How to submit (and run) your labs via the web
How to submit your labs via the web
and
How to show your labs running on the web:
We have set up a web page to "collect" your labs and email addresses
so that we can collect your labs and they can be graded and information
returned to you in a timely manner.
Please do the following to submit labs:
Fill in the information (name, email address, lab number, address
to your URL (web page))
Submit it. If you are a video or web student please send me email as well.
For CSCI 311 folks
If the lab was presented on a browser, on
the page provide at least-
a button (or some gidget to allow me to start the applet if it does not open on the page)
- a link to the source code
- ADT link(s) (from javadoc)
If you are familiar with html and Java GUIs, then the information below is not necessary.
If you had originally written an application, and are not familiar with GUIs, then the shell to convert your
application to run on the web has been
provided for you below.
Steps to take to see your programs run on the web.
Please start doing this rather than applications
(it is easier to grade, submit, gives you more of a taste of Java)
To get set up
On the web
- go to:
http://www.ecst.csuchico.edu/~amk/foo/csci311/shells/Shell.html
First, use it to see how it works.
-
At the bottom right of your window console toolbar
Right Click on the little javaCup (Open Console (opens a window to show the Java Console))
- Go back to the web page and click on Start
See the output in the Java console window
This is where your standard output will go when you use System.out.println()
copy this page (i.e., the Shell.html file that you link to above):
-
Under File
Save As
put it where you want to save it
I renamed it SimpleIndex.html . You need this html code to make the applet run on the web.
Right now the page looks like this:
Simple Shell Applet
Start button will run the doMain() method
// I had to put the ! in here or it would run the applet
The Source code.
The Documentation
You will want to edit later the title (Start button will run the doMain()
method) with your own information (Like: Lab 2) ... and your source file
should be what your source file links to.
-
Later, in your csci 311 web page index.html file you will want to add a line with
Lab 2
or you can just tell us when you submit the lab where this submission page is
-
Now, click on the source link at this page to see the source code. Copy this page.
-
Under File
Save As
put it where you want to save it
This page is called Shell.java and this is a fine name, but make sure
when you save it you save it to the directory of the web page where you
will want to run your program.
It looks like this:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class Shell extends Applet implements ActionListener{
//Put any data members here
private Button startUp;
//init is the first code that will run
public void init() {
startUp = new Button("Start"); //create a button with the label start
this.add(startUp); //add the button to the layout manager
startUp.addActionListener(this); // add the actionListener
}
//action gets all the user input from the applet
public void actionPerformed(ActionEvent event)
{
doMain();
}
/* All the code here will begin when you click on the start button.
The output will be displayed in the Java console window */
public void doMain() {
System.out.println("This is a sample output");
}
} //class Shell
IMPORTANT
-
Steps for you to do with YOUR programs to make them run on this shell class:
Remember how you had a Main with nothing in it but main(String[] args)?
You will edit the above code in Shell.java and
- anything you imported in your Main class, you should import
in this Shell class as well.
- put your code for your main() but call it something other than
main (like doMain)
Make sure these doMain () have the same arguments. So far we have not
passed anything into our programs so they should be (). Specifically,
anything in the doMain() method is your code for
your program
Basically, you can now trash your Main and use this instead.
Your output will show on the Java Console on the web, and in your
console window (stdout) when you use appletviewer.
-
Finally, you DO need to still compile your .java files and this
Shell.java class. This shell will do your doMain method when you
click start but it will need to be able to find your files (so they
should be compiled and located in the same directory where this
Shell.html is running from)
-
Permissions:
- Your HOME directory needs to be 711 e.g., chmod 711 /user/s3/name
- Your webpage directories and files to run must be readable
chmod 755 *