从Java开始的问题。 。 。 [英] Problem starting out with Java . . .

查看:60
本文介绍了从Java开始的问题。 。 。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿。我是Java的新手,我对netbeans IDE有一个问题。

每次我尝试导入java.awt。*时,我都不能使用任何

方法(就像它们不存在一样)。我可以很好地编译它,但是当我尝试运行它时,我会得到类主要的异常。


任何人都可以帮助我,请?

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?

推荐答案

On Sun,2004年10月24日01:06:02 GMT,Ash< fu ****** @ nb.sympatico。 ca>

写道:
On Sun, 24 Oct 2004 01:06:02 GMT, Ash <fu******@nb.sympatico.ca>
wrote:
嘿。我是Java新手,我对netbeans IDE有一个问题。每次我尝试导入java.awt。*时,我都不能使用任何
方法(比如他们不喜欢)不存在)。我可以很好地编译它,但是当我尝试运行它时,我会得到类主要的异常。

任何人都可以帮助我吗?
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...


flaps81写道:
flaps81 wrote:
On Sun,2004年10月24日01:06:02 GMT,Ash< fu ****** @ nb.sympatico.ca>
写道:

On Sun, 24 Oct 2004 01:06:02 GMT, Ash <fu******@nb.sympatico.ca>
wrote:

嘿。我是Java新手,我对netbeans IDE有一个问题。每次我尝试导入java.awt。*时,我都不能使用任何
方法(比如他们不喜欢)不存在)。我可以很好地编译它,但是当我尝试运行它时,我会得到类主要的异常。

任何人都可以帮助我吗?
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...



好​​的 - 这是:


import java.awt。*;

public class TestFrame

{

public static void main(String [] args )

{

帧f =新帧();

f.reshape(10,10,200,200);

按钮b =新按钮(Hello Cyber​​space);

b.setBackground(Color.black);

b.setForeground(Color.white) );

f.add(b);

f.show();

}

}


就像我说的那样 - 编译得很好,但每次我试图运行它时都会给我一个例外。我正在使用NetBeans 3.6和J2SKD 1.4.2。


谢谢


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


Ash写道:
flaps81写道:
flaps81 wrote:
On Sun,2004年10月24日01:06:02 GMT,Ash< fu ****** @ nb.sympatico.ca>
写道:

On Sun, 24 Oct 2004 01:06:02 GMT, Ash <fu******@nb.sympatico.ca>
wrote:

嘿。我是Java新手,我对netbeans IDE有一个问题。每次我尝试导入java.awt。*时,我都不能使用任何
方法(比如他们不喜欢)不存在)。我可以很好地编译它,但是当我尝试运行它时,我会得到类主要的异常。

任何人都可以帮助我吗?
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...



好的 - 这就是:

import java.awt。*;
公共类TestFrame
{public static void main(String [] args)
{
帧f = new Frame( );;
f.reshape(10,10,200,200);

按钮b =新按钮(Hello Cyber​​space);
b.setBackground(Color.black);
b.setForeground(Color.white);
f.add(b);
f.show();
}
}
就像我说的那样 - 它编译得很好,但每次我试图运行它时都会给我一个例外。我正在使用NetBeans 3.6和J2SKD 1.4.2。



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.




这个程序编译得很好(虽然有一个弃用警告

reshape( ))并且对我来说运行正常(在Linux上运行JDK 1.4.2_04-b05,没有IDE到

泥泞的水域)。请发布您获得的例外情况。另外,如果你还没有确定NetBeans是否是问题,那么
会鼓励你在命令行上尝试这个。


HTH,

Ray


-

XML是程序员的胶带。



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.


这篇关于从Java开始的问题。 。 。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆