80 likes | 174 Views
Program Questions. Try first to have your questions answered by a TA (email or TA office hours). Try the TAs first since this divides the work evenly among TAs and instructors. Downloading. Sun J2SE 1.4.1 Download SDK not JRE Download documentation too (unzip into main JDK directory)
E N D
Program Questions • Try first to have your questions answered by a TA (email or TA office hours). • Try the TAs first since this divides the work evenly among TAs and instructors.
Downloading • Sun J2SE 1.4.1 • Download SDK not JRE • Download documentation too (unzip into main JDK directory) • JBuilder 8 Personal • Fill out survey and an email will be sent to you containing a text file; save this file to disk • Documentation not available for version 8
Installation Tips • Accept defaults on JDK installation • Put JDK bin directory (e.g. c:\j2sdk1.4.1_01\bin) in your PATH environment variable • Accept defaults on JBuilder installation • When first starting JBuilder, it will complain about the license being expired. Ignore it. On the registration wizard, click “Have Activation File.” Now point to the email attachment (e.g. reg127.txt) that you saved. • Sample project has a nice “tour” feature.
Submitting Your Programs • Spend the time to create a complete and working zip file! • See program specifications on the web site for exact instructions! • README.DOC • COMPILE.BAT & RUN.BAT • Main class definition in JBuilder • All source and compiled classes in proper directories • And so on… • Check out the example program submittals on the web site!
Common Operations of the JDK • Compile • Go to the directory that contains the .java files and type: javac *.java • Running • Go to the directory that is the root of the package hierarchy and type:java examples.helloworld.HelloWorld • For successful execution of above example, you must be in the directory which hasexamples/helloworld/HelloWorld.class • Notice how the directory structure holding the class file mirrors the package structure.
Packages • Example: • Assume you’ve chosen to put files relating to program1 into c:\program1 • Now you create a text file containing a MyApplet class with a package declaration of appletstuff (i.e. the fully classified classname is appletstuff.MyApplet) • Question 1: Give the full path and filename where this text should be saved • Question 2: Give the full path and filename where the compiled (.class) file should be created (by the compiler)
Packages (continued) • Question 1 Answer: c:\program1\appletstuff\MyApplet.java • Question 2 Answer: c:\program1\appletstuff\MyApplet.class • Typically, source and binary are kept together if working with the JDK. JBuilder separates the two into src and classes directories. • You don’t have to use a package at all! But typically, you do.
Common Operations of JBuilder • New project creation • New application or applet creation • New class creation • Editing (on the fly error detection, code suggestions) • Compiling • Running (defining a main class is important; also runtime configurations) • Make sure you understand the code that JBuilder generates!