Topic: 为什么编译不成功?(找不到符号)

  Print this page

1.为什么编译不成功?(找不到符号) Copy to clipboard
Posted by: babyvox
Posted on: 2005-08-06 20:24

请使用准确的文字描述作为标题
You may want to use the [ code ] tag in the future.



import java.applet.Applet;
import java.awt.*;
import java.net.*;
import java.util.*;
import java.io.*;

public class JChartApplet extends Applet
{
int width,height,inwidth,inheight,inposx,inposy,labelfontsize,titlefontsize;
int barsize,show_extremes,axisfontsize,ncolumns,printvalues,labelserie;
int minyatzero;
String labelfont,titlefont,title,xaxis,yaxis,axisfont;
Color labelcolor,axiscolor,linecolor[],titlecolor,bgcolor;
JChart canv;
URL conn;

int getintparam(String l,int def)
{
String result;
Integer t;
result=getParameter(l);
if (result!=null)
return new Integer(result).intValue();
else
return def;
}

String getstringparam(String l,String def)
{
String result;
Integer t;
result=getParameter(l);
if (result!=null)
return result;
else
return def;
}

Color getcolorparam(String l,Color def)
{
String result;
Integer t;
result=getParameter(l);
if (result!=null)
{
Color c;
if (result.substring(0,1).equals("#"))
c=new Color(Integer.valueOf(result.substring(1,7),16).intValue());
else
c=Color.getColor(result);
if(c==null)
{
System.out.println("Warning: can't make sense of color "+result);
return def;
}
else
return c;
}
else
return def;
}

public void start()
{
Integer t;
InputStream is;
DataInputStream dis;
String result,dataurl,type,r;
showStatus("Initialization...");
width=getintparam("WIDTH",500);
height=getintparam("HEIGHT",500);
resize(width,height);
ncolumns=getintparam("NCOLUMNS",1);
dataurl=getParameter("DATA");
is=null;
conn=null;
try {conn=new URL(dataurl);} catch(MalformedURLException exc) {
System.out.println("Data are not (no longer) available");}
title=getParameter("TITLE");
if(title!=null)
{
titlefont=getstringparam("TITLEFONT","System");
titlefontsize=getintparam("TITLEFONTSIZE",10);
}
else
titlefontsize=0;
titlecolor=getcolorparam("TITLECOLOR",Color.black);
axiscolor=getcolorparam("AXISCOLOR",Color.blue);
labelcolor=getcolorparam("LABELCOLOR",Color.blue);
bgcolor=getcolorparam("BGCOLOR",Color.white);
type=getParameter("TYPE");
if(type.equalsIgnoreCase("PIE"))
{
linecolor=new Color[3];
linecolor[0]=getcolorparam("LINECOLOR1",Color.cyan);
linecolor[1]=getcolorparam("LINECOLOR2",Color.yellow);
linecolor[2]=getcolorparam("LINECOLOR3",Color.magenta);
}
else
{
linecolor=new Color[ncolumns];
if(ncolumns==1)
linecolor[0]=getcolorparam("LINECOLOR",Color.blue);
else
{
int i;
for(i=0; i!=ncolumns; i++)
{
String s;
s="LINECOLOR"+(new Integer(i+1).toString());
linecolor[i]=getcolorparam(s,Color.blue);
}
}
}
xaxis=getParameter("XAXIS");
yaxis=getParameter("YAXIS");
show_extremes=getintparam("SHOW_EXTREMES",1);
if((yaxis!=null) || (xaxis!=null) || (show_extremes!=0))
{
axisfont=getstringparam("AXISFONT","System");
axisfontsize=getintparam("AXISFONTSIZE",10);
}
else
axisfontsize=0;
minyatzero=getintparam("MINYATZERO",1);
inposx=getintparam("INPOSX",10);
inposy=getintparam("INPOSY",10+titlefontsize);
inwidth=getintparam("INWIDTH",width-20);
inheight=getintparam("INHEIGHT",height-10-inposy-axisfontsize);
labelfont=getstringparam("LABELFONT","System");
labelfontsize=getintparam("LABELFONTSIZE",10);
labelserie=getintparam("LABELSERIE",0);
barsize=getintparam("BARSIZE",0);
printvalues=getintparam("PRINTVALUES",1);
setLayout(new BorderLayout());
canv=new JChart(conn,ncolumns,title,inwidth,inheight,inposx,inposy,inposx,inposy,
type,xaxis,yaxis,new Font(labelfont,Font.PLAIN,labelfontsize),
new Font(titlefont,Font.PLAIN,titlefontsize),
new Font(axisfont,Font.PLAIN,axisfontsize),
barsize,labelserie,printvalues,minyatzero,bgcolor,axiscolor,
labelcolor,linecolor,show_extremes>0,show_extremes>0);
add("West",canv);
showStatus("JChartApplet running");
}

public void paint(Graphics g)
{
canv.repaint();
}

public void destroy()
{
canv=null;
}

public void init()
{
/* non fa nulla perche'pensa a tutto la start */
}

}


用javac后老是提示:
c:\javaexe\src\javaexe>javac JChartApplet.java
JChartApplet.java:15:找不到符号
符号:类 JChart
位置:类 JChartApplet
JChart canv;
下面还有一行和这个类似,
我是个初学者,不知道这样的问题怎么解决,哪位帮帮我?

JChartApplet.java (4.74k)

2.Re:为什么编译不成功?(找不到符号) [Re: babyvox] Copy to clipboard
Posted by: why
Posted on: 2005-08-06 22:25

JChartApplet.java:15:找不到符号
符号:类 JChart

Where's this JChart class?
There could be some certain JChart.class (or JChart.java) or an external library jar (zip).

3.Re:为什么编译不成功?(找不到符号) [Re: babyvox] Copy to clipboard
Posted by: babavox123456
Posted on: 2005-08-07 08:48

是有,但我应该是添加了的。可能是添加的不对吧。

如果有这样的类,该如何添加?
还有,我的系统变量里根本就没有这个path和classpath变量,可还是能找到C盘的这perl解释器,也能找到E盘的java和javac,这是为什么?(我的系统是XP,在E盘,最后我自己加了这两个变量,还有,这两个变量是加到用户变量还是加到系统变量?)

4.Re:为什么编译不成功?(找不到符号) [Re: babyvox] Copy to clipboard
Posted by: Talent666
Posted on: 2005-08-21 21:33

你的jdk是安装上去的。当然不用设置path和 classpath啊。那里因为系统自动给你配好了。如果你是把整个 jdk文件拷到机器上的。就需要配置了。
至于你是加到用户变量还是系统变量。这很简单。如果只想让你本用记使用就加到
用户变量中。如果你想让所有用户使用就加到系统变量中去。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923