From leavens@larch.cs.iastate.edu Mon Aug 30 18:44:58 2004 Date: Mon, 30 Aug 2004 18:44:58 -0500 (CDT) From: Gary T. Leavens To: Drew Templeton Subject: Re: Com S 362 Question Hi Drew, On Mon, 30 Aug 2004, Drew Templeton wrote: > Hello Professor Leavens. I am having trouble setting up my CLASSPATH in my > Unix command line. I am typing CLASSPATH= '/home/ugrad1/dtemple' which is > where I want my CLASSPATH to be, and I recieve the > error "/home/ugrad1/dtemple: is a directory". I also recieved the same error > when trying to set the CLASSPATH to './' Could you help? Thanks. Yes, if you're using bash on Unix, you can't have a space between the = and the ' in CLASSPATH= '/home/ugrad1/dtemple'. It should be CLASSPATH='/home/ugrad1/dtemple' with no spaces. I'm pretty sure this is the problem, but let me know if that doesn't fix it. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 ---------------------------------------------------------------- From leavens@larch.cs.iastate.edu Mon Aug 30 21:13:48 2004 Date: Mon, 30 Aug 2004 21:13:48 -0500 (CDT) From: Gary T. Leavens To: cyarker@cs.iastate.edu Subject: Re: Eclipse Problem Hi Craig, On Mon, 30 Aug 2004 cyarker@cs.iastate.edu wrote: > I'm having the same problem someone else mentioned during class. I installed > Eclipse on my home computer, and when I try to run it, it cannot find the 1.4.2 > Java SDK I installed on my computer. The text that it gives me when I run the > "eclipse.exe" reads > "A Java Runtime Environment(JRE) or Java Development(JDK) must be available in > order to run Eclipse. No Java virtual machine was found after searching the > following locations: > C:\Misc Programs\eclipse\jre\bin\javaw.exe > 'javaw.exe' in your current PATH > " > > I would appreciate any help so that I can finish exercise 1 and set up my home > computer for future use in this class as soon as I can. > Hmm, do you have the directory C:\Misc Programs\eclipse\jre\bin in your PATH? To see, get a command prompt, and type java -version to it. If that fails, you need to add the directory above to your PATH. (You can get a command prompt from the start menu's accessories submenu, although it might be in the system tools folder.) In my Windows install, I have the following PATH PATH=.;d:\bin;d:\bat;c:\cygwin\bin;c:\cygwin\usr\bin;c:\cygwin\usr\local\emacs\bin;c:\cygwin\usr\local\bin;c:\cygwin\usr\X11R6\bin;c:\cygwin\usr\local\jdk1.4\bin;d:\miktex\miktex\bin; ... To set your PATH variable in Windows XP open the start menu's control panel. Then select Performance and Maintenance, then (or directly) System, and then the "Advanced" tab. At the bottom is a button for "Environment Variables", and there should be PATH (or something with different capitalization) in the System Variables list. On windows this is a semicolon-separated list of directories. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------------------- From leavens@larch.cs.iastate.edu Thu Sep 2 11:21:31 2004 Date: Thu, 2 Sep 2004 11:21:31 -0500 (CDT) From: Gary T. Leavens To: Ted Skjei Cc: Staff for COm S 362 -- Kun Liang , Matthew Ring Subject: Re: Hw1 exceptions question Hi Ted, On Thu, 2 Sep 2004, Ted Skjei wrote: > I have a question regarding the exceptions thrown for hw1. In the exceptions > clause should I clarify all of the exceptions that may be thrown with > input/output (FileNotFoundException, AccessException, SecurityException, etc.) > or just put the superclass of all of these exceptions: IOException? The first one is more exact, so it's a bit better, but it's more tedious to write, so the second one is perfectly fine. I would tend to go with the second of these, and just list the superclass of the exceptions. > In my catch clause I only catch the IOException and then let it decide what > went wrong with reading/writing from/to a file. Although, it seems like I may > be vague if I do not include all of the possible exceptions in the throw > clause for the method. I am just trying to practice good documentation to let > those other programmers know what I am doing. Should I worry about this or > will you not be taking points off for it? I think it's better to avoid repeating code, and so I wouldn't list all the different exceptions, because that would lead to some code repetition. This is the advantage of using the subtyping of exception types, as it sounds like you're doing. So I think what you're doing is fine. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580 --------------------------------------------------- From leavens@larch.cs.iastate.edu Thu Sep 2 15:09:26 2004 Date: Thu, 2 Sep 2004 15:09:26 -0500 (CDT) From: Gary T. Leavens To: William Gerald Hoffa Subject: Re: hw1 question Hi Bill, On Thu, 2 Sep 2004, William Gerald Hoffa wrote: > I was just wondering how you thought we should handle preventing the > overwriting of the output file. Is there an exception that would do that for > me? Or should I first treat the output file as an input file to see if it is > there and then an output file after I've confirmed it doesn't exist? Good question. There isn't an exception that will happen for that. You'll instead have to either test first if the file already exists, using the (you might have guessed) "exists()" method of the java.io.File type. Or you can use that type's createNewFile() method. See the javadocs to decide why you would want to pick one over the other, but one of these methods has a definite advantage. Moral of this: if you want some basic service like this from the library, it's probably already in there. Gary T. Leavens Department of Computer Science, Iowa State University 229 Atanasoff Hall, Ames, Iowa 50011-1041 USA http://www.cs.iastate.edu/~leavens phone: +1-515-294-1580