当前位置: 技术问答>java相关
刚学爪瓦,用空帮忙,不啬给分!
来源: 互联网 发布时间:2015-04-07
本文导语: 环境说明:JDK1.4,路径已设置JDK1.4BIN。 报错提示:C:jdk1.4>javac Cards2.java Cards2.java:3: package com.sun.java.swing does not exist import com.sun.java.swing.*; ^ Cards2.java:9: cannot r...
环境说明:JDK1.4,路径已设置JDK1.4BIN。
报错提示:C:jdk1.4>javac Cards2.java
Cards2.java:3: package com.sun.java.swing does not exist
import com.sun.java.swing.*;
^
Cards2.java:9: cannot resolve symbol
symbol : class JTabbedPane
location: class Cards2
JTabbedPane jtp=new JTabbedPane();
^
Cards2.java:9: cannot resolve symbol
symbol : class JTabbedPane
location: class Cards2
JTabbedPane jtp=new JTabbedPane();
^
3 errors
源程序:import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class Cards2 extends Frame {
public Cards2(){
super("JTabbedPane Tester");
JTabbedPane jtp=new JTabbedPane();
for (int i=0;i
import javax.swing.*;
jtp.addTab("Btn"+i);
==>
jtp.addTab("Btn"+i,b);
报错提示:C:jdk1.4>javac Cards2.java
Cards2.java:3: package com.sun.java.swing does not exist
import com.sun.java.swing.*;
^
Cards2.java:9: cannot resolve symbol
symbol : class JTabbedPane
location: class Cards2
JTabbedPane jtp=new JTabbedPane();
^
Cards2.java:9: cannot resolve symbol
symbol : class JTabbedPane
location: class Cards2
JTabbedPane jtp=new JTabbedPane();
^
3 errors
源程序:import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
public class Cards2 extends Frame {
public Cards2(){
super("JTabbedPane Tester");
JTabbedPane jtp=new JTabbedPane();
for (int i=0;i
import javax.swing.*;
jtp.addTab("Btn"+i);
==>
jtp.addTab("Btn"+i,b);
|
路径已设置:
D:jdk1.3libtools.jar;D:jdk1.3libdt.jar
jdk1.4要不要也把这几项加进去呢!
import javax.swing.*;
D:jdk1.3libtools.jar;D:jdk1.3libdt.jar
jdk1.4要不要也把这几项加进去呢!
import javax.swing.*;
|
1) classPath设置加上 jdk1.4/lib/tools.jar; jdk1.4/lib/dt.jar
2) JTabbedPane不是一个有效的对象,那么它当然不能实例化。
2) JTabbedPane不是一个有效的对象,那么它当然不能实例化。
|
classpath 没有设置好若Windows就在AUTOEXEC.BAT中设置
如:
set CLASSPATH=C:jdk1.3.1libtools.jar;C:jdk1.3.1jrelibrt.jar;C:jdk1.3.1libjsdk.jar;
set CLASSPATH=.;%CLASSPATH%C:jdk1.3.1jrelibrt.jar;
编译时:
javac Cards2.java
运行时:
java -cp . Cards2
如:
set CLASSPATH=C:jdk1.3.1libtools.jar;C:jdk1.3.1jrelibrt.jar;C:jdk1.3.1libjsdk.jar;
set CLASSPATH=.;%CLASSPATH%C:jdk1.3.1jrelibrt.jar;
编译时:
javac Cards2.java
运行时:
java -cp . Cards2
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。