Re: Help with packages getting started



BlitzA wrote:
I still need some help getting the Elements package working with java.

I've typed this in command prompt:

set CLASSPATH=C:\Program Files\Java\jdk1.6.0_03\bin\element.zip
So now it let's me compile this code:

import element.*;

public class DrawRect
{
public static void main(String args[])
{
DrawingWindow d = new DrawingWindow();
Rect cornerRect = new Rect(10,10,20,30);

d.draw(cornerRect);
}
}


So I get a file called DrawRect.class

When I type in java DrawRect to run the code it says:

C:\Program Files\Java\jdk1.6.0_03\bin>java DrawRect

Exception in thread "main" java.lang.NoClassDefFoundError: DrawRect


Someone please help I've been trying to get this working for hours and
haven't even started my project lol

You should not be creating files in the Java bin/ subdirectory - that's not a data directory. Really, you shouldn't have write privilege to that directory, but that's a problem with Windows.

Create some separate projects directory and do your work there.

Use the -classpath (or -cp) option to your compilation and execution of Java code. The tutorials on java.sun.com go into this.

--
Lew
.