Problem starting out with Java . . .  
Author Message
Ash





PostPosted: 2004-10-24 9:06:00 Top

java-programmer, Problem starting out with Java . . . 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?
 
flaps81





PostPosted: 2004-10-24 16:34:00 Top

java-programmer >> Problem starting out with Java . . . On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
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...
 
Ash





PostPosted: 2004-10-24 21:52:00 Top

java-programmer >> Problem starting out with Java . . . flaps81 wrote:
> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
> 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.

Thanks
 
 
Raymond DeCampo





PostPosted: 2004-10-24 22:49:00 Top

java-programmer >> Problem starting out with Java . . . Ash wrote:
> flaps81 wrote:
>
>> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>> 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

--
XML is the programmer's duct tape.
 
 
Ash





PostPosted: 2004-10-25 0:00:00 Top

java-programmer >> Problem starting out with Java . . . Raymond DeCampo wrote:
> Ash wrote:
>
>> flaps81 wrote:
>>
>>> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>>> 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.
 
 
Ash





PostPosted: 2004-10-25 0:10:00 Top

java-programmer >> Problem starting out with Java . . . Ash wrote:
> Raymond DeCampo wrote:
>
>> Ash wrote:
>>
>>> flaps81 wrote:
>>>
>>>> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>>>> 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
 
 
flaps81





PostPosted: 2004-10-25 1:04:00 Top

java-programmer >> Problem starting out with Java . . . On Sun, 24 Oct 2004 16:09:31 GMT, Ash <email***@***.com>
wrote:

>Ash wrote:
>> Raymond DeCampo wrote:
>>
>>> Ash wrote:
>>>
>>>> flaps81 wrote:
>>>>
>>>>> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>>>>> 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


Are you sure that the file is named TestFrame.java !?!
 
 
Ash





PostPosted: 2004-10-25 1:19:00 Top

java-programmer >> Problem starting out with Java . . . flaps81 wrote:
> On Sun, 24 Oct 2004 16:09:31 GMT, Ash <email***@***.com>
> wrote:
>
>
>>Ash wrote:
>>
>>>Raymond DeCampo wrote:
>>>
>>>
>>>>Ash wrote:
>>>>
>>>>
>>>>>flaps81 wrote:
>>>>>
>>>>>
>>>>>>On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>>>>>>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
>
>
>
> Are you sure that the file is named TestFrame.java !?!
YES! And I have NO IDEA what I'm doing wrong! I've added the Bin folder
to my path and classpath variables! I've copied the SIMPLEST SOURCES off
the web and ALWAYS it does this! What am I doing wrong!?!

:(
 
 
flaps81





PostPosted: 2004-10-25 2:23:00 Top

java-programmer >> Problem starting out with Java . . . On Sun, 24 Oct 2004 17:18:47 GMT, Ash <email***@***.com>
wrote:

>flaps81 wrote:
>> On Sun, 24 Oct 2004 16:09:31 GMT, Ash <email***@***.com>
>> wrote:
>>
>>
>>>Ash wrote:
>>>
>>>>Raymond DeCampo wrote:
>>>>
>>>>
>>>>>Ash wrote:
>>>>>
>>>>>
>>>>>>flaps81 wrote:
>>>>>>
>>>>>>
>>>>>>>On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>>>>>>>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
>>
>>
>>
>> Are you sure that the file is named TestFrame.java !?!
>YES! And I have NO IDEA what I'm doing wrong! I've added the Bin folder
>to my path and classpath variables! I've copied the SIMPLEST SOURCES off
>the web and ALWAYS it does this! What am I doing wrong!?!
>
>:(

Beats me, I've tried to copy paste the code you posted and it works
fine. The only way I can get a java.lang.NoClassDefFoundError is if
the filename is wrong...
 
 
Michael Saunby





PostPosted: 2004-10-25 2:26:00 Top

java-programmer >> Problem starting out with Java . . .
"Ash" <email***@***.com> wrote in message
news:XtRed.153761$email***@***.com...
>>>
>>>Under the cmd window, I get
>>>D:\Java\Bin\eXtropia>java TestFrame.class
>>>Exception in thread "main" java.lang.NoClassDefFoundError:
>>>TestFrame/class
>>
>>
>>
>> Are you sure that the file is named TestFrame.java !?!
> YES! And I have NO IDEA what I'm doing wrong! I've added the Bin folder
> to my path and classpath variables! I've copied the SIMPLEST SOURCES off
> the web and ALWAYS it does this! What am I doing wrong!?!
>

You're not typing "java TestFrame" but that alone might not fix things. I
can't be bothered to sort through all your output.

Basically it's like this - "java someclass" will execute main() in
"someclass" (it must be static) which will have the filename
"someclass.class" and the soucefile will be called "someclass.java". Of
course the class could be in a package, which would require you to run it
using "java packagename.someclass".

The fact that you have NO IDEA suggests that you really ought to read
rather more and post less. There's loads of info at http://java.sun.com
Unless you really enjoy looking stupid.

Michael Saunby



 
 
Ash





PostPosted: 2004-10-25 5:16:00 Top

java-programmer >> Problem starting out with Java . . . Ash 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?
OK - when I reinstalled netbeans, their sample helloworld app worked
fine - untill I removed this line:

package bin;

What is that for?
 
 
The Abrasive Sponge





PostPosted: 2004-10-25 10:31:00 Top

java-programmer >> Problem starting out with Java . . . Ash wrote:

> Ash wrote:
>
>> Raymond DeCampo wrote:
>>
>>> Ash wrote:
>>>
>>>> flaps81 wrote:
>>>>
>>>>> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
>>>>> 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


Run it as:
D:\Java\Bin\eXtropia>java TestFrame

Leave out the .class when creating a new VM. :)
 
 
Hal Rosser





PostPosted: 2004-10-25 10:33:00 Top

java-programmer >> Problem starting out with Java . . .
"Ash" <email***@***.com> wrote in message
news:_dDed.153496$email***@***.com...
> 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?

Start out with notepad - not netbeans.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.781 / Virus Database: 527 - Release Date: 10/21/2004


 
 
Ash





PostPosted: 2004-10-26 4:20:00 Top

java-programmer >> Problem starting out with Java . . . flaps81 wrote:
> On Sun, 24 Oct 2004 01:06:02 GMT, Ash <email***@***.com>
> 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...
ARG!!!!!!!!!!!!

I HAVE *NO* JAVA.LANG FILES! ANYWHERE! WTF!?! I TRY TO USE jikes.exe
INSTEAD, and it gives me

*** Semantic Error: You need to modify your classpath, sourcepath,
bootclasspath
, and/or extdirs setup. Jikes could not find package "java.lang" in:

WTF!?! Please help!