trying to compile after using "import java.lancs.*"

C

Cory Lechner

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"?? Help!

Howie
 
A

Andrew Thompson

C

Cory Lechner

Andrew Thompson said:
Best group for learners..


I think that is miss-spelt, what class
do you need to use that requires the import?

I believe it is the class BassIo...
In a bad mood it it? ;-)

Please supply *exact* messages..
<http://www.physci.org/codes/javafaq.jsp#exact>

it states that "cannot resolve symbol"...
An example of your (*short*) code
often helps as well..

my 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

This book I got the code from (Java - First Contact) give this info (quite lengthy):


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



Howie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top