This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Dear all. I downloaded the JavaRanchCommon.zip, and tried to use it in the assignment. I am working on UNIX, and I use "setenv CLASSPATH xxx" to set it to the JavaRanchCommon.zip directory. In my program, "import com.javaranch.common;", but the compiler always complain about this import statement. How to solve it? I tried compile with "javac -classpath xxx myclass.java", the same result. thanks.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joanne Li
Greenhorn
Joined: Dec 28, 2000
Posts: 6
posted
0
Thanks Marilyn. I can compile successfully, but got run time error of java.lang.NoClassDefFoundError. Can you pls take a look at my code? Thanks. import com.javaranch.common.*;
public class DaysOld {
-- code deleted by Marilyn to protect future participants --
}
[This message has been edited by Marilyn deQueiroz (edited January 08, 2001).]
Marilyn de Queiroz
Sheriff
Joined: Jul 22, 2000
Posts: 9033
10
posted
0
Originally posted by Joanne Li: Thanks Marilyn. I can compile successfully, but got run time error of java.lang.NoClassDefFoundError. Can you pls take a look at my code? Thanks.
Joanne - When I ran your code, I did not get this error. Therefore I think that that error is in the classpath setting rather than in your code. When you compile, you use the "path". When you run, you use the "classpath".
You should set your classpath to include the current directory, the directory where your *.java file is, and the directory where you have JavaRanchCommon.zip.
My classpath is CLASSPATH=C:\Java;C:\Java\JavaRanchCommon.zip;. because my DaysOld.java file is in C:\Java and my JavaRanchCommon.zip file is also in C:\Java
Joanne Li
Greenhorn
Joined: Dec 28, 2000
Posts: 6
posted
0
Thanks Marilyn. I can run my program now, and I just submitted to the nitpick. But I have problem doing the next assignment, NaturalLanguageMultiply, just do not know how to start? I do not understand the requirement of Assignment 3.4. Maybe the sample output is better.