recently I am reading about Thinking in Java.
that code in my PC is not working,even I set up class path.
“import static net.mindview.util.*;”
I need some help.
package iteration;
import static net.mindviwe.util.*;
public class Exercise1 {
public static void main(String[] args) {
for(int i=0;i<=100;i++){
System.out.println(i);
}
int i=0;
while(i<=100){
print(i+" ");
i++;
}
}
this is my class path :
export JAVA_HOME=/opt/jdk1.7.0_05:
export CLASSPATH=.:/opt/ThinkingJava/TinkingInJava.jar:/opt/ThinkingJava/typeinfo-pets.jar:
export PATH=$PATH:$JAVA_HOME/bin:
I’m just guessing, since your question is rather vague, but you put “classpath” as a tag…
When you run the JRE, you must specify the locations where the JVM can find the classes it will need. In this case, your code uses the
net.mindviwe.util.*package, which is probably in a JAR file named something like mindviwe.jar. You can specify that the JRE should look in mindviwe.jar with the -classpath variable. You can also use the CLASSPATH environment variable.This is all discussed in Wikipedia
Of course, there also appears to be a typo in your package name where you transposed the ‘w’ and the ‘e’ (mindview vs mindviwe). This could also be your issue.