Re: Problem starting out with Java . . .

From: Ash (furroash_at_nb.sympatico.ca)
Date: 10/24/04


Date: Sun, 24 Oct 2004 16:09:31 GMT

Ash wrote:
> Raymond DeCampo wrote:
>
>> Ash wrote:
>>
>>> flaps81 wrote:
>>>
>>>> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <furroash@nb.sympatico.ca>
>>>> wrote:
>>>>
>>>>
>>>>> Hey. Im new to Java, and am having a prroblem with the netbeans IDE.
>>>>> every time i try to import java.awt.* , I can't use any of the
>>>>> methods(like they don't exist). I can compile it fine, but when I
>>>>> try to run it, I get "exception in class main".
>>>>>
>>>>> Can anyone help me, please?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Post the code that gives you trouble, an exception can be many
>>>> things...
>>>
>>>
>>>
>>> OK - Here it is:
>>>
>>> import java.awt.*;
>>> public class TestFrame
>>> {
>>> public static void main(String[] args)
>>> {
>>> Frame f = new Frame();
>>> f.reshape(10,10,200,200);
>>>
>>> Button b = new Button("Hello Cyberspace");
>>> b.setBackground(Color.black);
>>> b.setForeground(Color.white);
>>> f.add(b);
>>> f.show();
>>> }
>>> }
>>>
>>> Like I said - it compiles fine, but gives me an exception every time
>>> I try to run it. I'm using NetBeans 3.6 and J2SKD 1.4.2.
>>>
>>
>> This program compiles fine (although with a deprecation warning on
>> reshape()) and runs fine for me (JDK 1.4.2_04-b05 on linux, no IDE to
>> muddy the waters). Please post the exception you are getting. Also,
>> I would encourage you to try this on the command line if you haven't
>> already to determine if NetBeans is the problem.
>>
>> HTH,
>> Ray
>>
> Nice sig. Ok - I get this from the compiler output:
>
> Note: D:\Java\Bin\eXtropia\TestFrame.java uses or overrides a deprecated
> API.
> Note: Recompile with -deprecation for details.
> Finished TestFrame.
>
> and this from the program output:
>
> java.lang.NoClassDefFoundError: Bin/eXtropia/TestFrame (wrong name:
> TestFrame)
> at java.lang.ClassLoader.defineClass0(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
> at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
> Exception in thread "main"
>
> I'll try doing it throught the command window.
Under the cmd window, I get
D:\Java\Bin\eXtropia>java TestFrame.class
Exception in thread "main" java.lang.NoClassDefFoundError: TestFrame/class