Home > Archive > Java Help > May 2004 > trying to compile after using "import java.lancs.*"
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
trying to compile after using "import java.lancs.*"
|
|
| Cory Lechner 2004-05-19, 2:32 pm |
| I'm fairly new to java (I'm using j2sdk 1.4.2)... I'm trying to use
"import java.lancs.*" in a program and it doesn't want to compile?
Does it have something to do with "CLASSPATH"?? Is says that it
cannot resolve symbol?
here's the code:
import java.lancs.*;
public class Chapter4n1
{
public static void main(String[] args ) throws Exception
{
// read in and output a String
BasicIo.prompt("please type a string... ");
String string1 = BasicIo.readString();
System.out.println("the string you typed was **" + string1 +
"**");
System.out.println();
// read in and out an integer
BasicIo.prompt("please type in an integer... ");
int intValue = BasicIo.readInteger();
System.out.println("the integer you typed was **" + intValue +
"**");
} // end of main method
} // end of class Basic_IO
Help!
Howie
| |
| Michiel Konstapel 2004-05-19, 8:32 pm |
| On 19 May 2004 10:00:11 -0700, Cory Lechner <clechner@hotmail.com> wrote:
> I'm fairly new to java (I'm using j2sdk 1.4.2)... I'm trying to use
> "import java.lancs.*" in a program and it doesn't want to compile?
> Does it have something to do with "CLASSPATH"?? Is says that it
> cannot resolve symbol?
There's no such package as java.lancs. Theoretically someone could create
such a package but the license forbids declaring classes in the java.* and
javax.* hierarchies. What's supposed to be in that package?
Michiel
| |
| Cory Lechner 2004-05-20, 1:34 pm |
| Michiel Konstapel <usenet@konstapel.nl> wrote in message news:<opr79rvoyx3t3jzl@news.zonnet.nl>...
> On 19 May 2004 10:00:11 -0700, Cory Lechner <clechner@hotmail.com> wrote:
>
>
> There's no such package as java.lancs. Theoretically someone could create
> such a package but the license forbids declaring classes in the java.* and
> javax.* hierarchies. What's supposed to be in that package?
> Michiel
This program is from a book titled "Java - First Contact"... this is
the explaination from the books website:
The "java.lancs" package used in the examples and exercises in the
"Java:
First Contact" book contains eight classes:
Person
BasicIo
Card
BasicGraphics
GroupOfPeople
BasicFileIo
OutDate
WordFile
This site contains for each class a source file (for example
"Person.java"
for the "Person" class: a total of eight files) and one or more
bytecode
files (such as "BasicShape.class", "BasicCanvas.class" and
"BasicGraphics.class" for the "BasicGraphics" class: a total of ten
files).
This is what you should do to make use of the "java.lancs" package:
(0) You should first set up your Java environment (for example the JDK
or
Java Development Kit) - this needs to be Java 1.1
(1) decide where you are going to put the code for the package - for
example
we have it in a directory "classes" with path name
"/usr/local/java/classes".
(2) in this directory create a directory called "java", and in that
create
a directory called "lancs" - this final directory would in our case
have
the path name "/usr/local/java/classes/java/lancs"
(3) set up the bytecode files in this final directory. You can do
this in
one of two ways:
(3)(a) copy all the bytecode files into this directory. There are ten
files,
as follows:
BasicCanvas.class
BasicFileIo.class
BasicGraphics.class
BasicIo.class
BasicShape.class
Card.class
GroupOfPeople.class
OurDate.class
Person.class
WordFile.class
or
(3)(b) copy all the source files into the directory. There are eight
files,
as follows:
BasicFileIo.java
BasicGraphics.java
BasicIo.java
Card.java
GroupOfPeople.java
OurDate.java
Person.java
WordFile.java
Then compile each one in turn to create the bytecode file(s) - for
instance:
javac Person.java
You should end up with the ten "...class" files listed above.
(4) set up the documentation (the "API") in a suitable directory (we
have it
in a directory with path name "/usr/local/java/api"). You can do this
in
one of two ways:
(4)(a) by copying from this site all the HTML files. There are twelve
of them,
as follows:
AllNames.html
Package-java.lancs.html
java.lancs.BasicFileIo.html
java.lancs.BasicGraphics.html
java.lancs.BasicIo.html
java.lancs.Card.html
java.lancs.GroupOfPeople.html
java.lancs.OurDate.html
java.lancs.Person.html
java.lancs.WordFile.html
packages.html
tree.html
or
(4)(b) by going into the directory in which you want the API to appear
and
calling the "javadoc" program supplied as part of the JDK:
javadoc java.lancs
You must have the CLASSPATH (see step 5) set up for this to work. You
should
end up with the twelve "...html" files listed above.
You can access this API by pointing your browser at the file
"packages.html".
(5) You need to have an environment variable "CLASSPATH" set up to
refer
to the place where you have put the package code - since we have set
it up
on a Unix machine in the "classes" directory with path name
"/usr/local/java/classes", we have the command:
setenv CLASSPATH .:/usr/local/java/classes
RGG/JAM Oct/97
any ideas?
|
|
|
|
|