Hola, estoy haciendo mi primer programa con java y me encuentro con este error: Exception in thread "main" java.lang.NoSuchMethodError: main
¿como lo puedo solucionar?
Gracias
Hola,
Así, a bote pronto y sin tener el código para echarle un vistazo (es más fácil ), el error es por que está mal definida la clase 'main'. Revisa la definición de la clase, y los parámetros que hayas usado, seguramente será por eso.
main
-- saludos
cyfuss
HOla! tengo el mismo problema con un grafico. Porfa ayuda! gracias
adjunto el codigo:
import java.awt.*;
public class Graficacion extends Canvas
{
private double Xpixel=0,Ypixel=0;
private double Xpixel1=0,Ypixel1=0;
private int x[][], y[][], numd;
private int n, MaxX, MaxY, posx[], posy[];
private int numser, inser;
private double maxy, miny, etiqx[], etiqy[];
private double maxx, minx;
private Color c[];
private int pos_ejex, pos_ejey;
private double xmouse=0,ymouse=0;
private double Ancho,Alto;
private double miny1, maxy1;
private double minx1, maxx1;
private double prop1,prop2; String Titulo="DIAGRAMA BHPBA vs QD",Variable1="BHPBA",Variable2="QD";
public Graficacion()
numd = 12;
this.prop1=0;this.prop2=0;
pos_ejex = 50;
pos_ejey = 450;
this.setBackground(Color.white);
numser = 12;
etiqx = new double[numd];
etiqy = new double[numd];
posx = new int[numd];
posy = new int[numd];
c = new Color[numser];
inser = 0;
c[0] = Color.blue;
c[1] = Color.red;
c[2] = Color.green;
c[3] = Color.darkGray;
c[4] = Color.cyan;
c[5] = Color.black;
c[6] = Color.orange;
c[7] = Color.pink;
c[8] = Color.darkGray;
c[9] = Color.cyan;
c[10] = Color.darkGray;
c[11] = Color.cyan;
}
public void setDimensiones(double anchos, double altos)
Ancho=anchos;
Alto=altos;
MaxX = (int)(Ancho-50); MaxY = (int)(Alto-50);
pos_ejey = (int)(Alto-50);
void Datos(double x[], double y[],double width,double height,String tit,String var1, String var2)
Ancho=width;
Alto=height;
Titulo=tit;
Variable1=var1;
Variable2=var2;
SerieX(x);
SerieY(y);
System.out.println("alto="+Alto+" ancho="+Ancho);
void SerieX(double x0[])
int i;
double inc, aux;
n = x0.length;
if (inser==0)
x = new int[numser][n];
maxx1 = minx1 = x0[0];
for (i = 1; i < n; i++) {
if (x0[i] > maxx1)
maxx1 = x0[i];
if (x0[i] < minx1)
minx1 = x0[i];
minx = minx1;
maxx = maxx1;
inc = (maxx1 - minx1) / numd;
if (Math.abs(maxx1 - minx1) > 1.0) {
if (Math.abs(inc) < 1.0)
inc = (double) 1.0;
else
inc = Math.round(inc + 0.5);
for (i = 0; i < numd; i++) {
aux = minx1 + inc * i;
aux = (Math.round(aux * 10000.0)) / 10000.0;
etiqx[i] = aux;
posx[i] = (int) ( (etiqx[i] - minx1) / (maxx1 - minx1) * (MaxX - 50));
if (minx1 < 0 && maxx1 > 0)
pos_ejex += (int) ( -minx1 / (maxx1 - minx1) * (MaxX - 50));
minx1 = minx;
maxx1 = maxx;
for (i = 0; i < n; i++)
x[inser][i] = (int) ( (x0[i] - minx1) / (maxx - minx) * (MaxX - 50));
void SerieY(double y0[])
if(inser >= numser) return;
if(inser == 0)
y = new int[numser][n];
maxy1 = miny1 = y0[0];
for(i=1; i maxy1) maxy1 = y0[i];
if(y0[i] < miny1) miny1 = 0;//y0[i];
maxy = maxy1;
miny = miny1;
inc = (maxy1 - miny1)/numd;
if( Math.abs(maxy1 - miny1) > 1.0)
if(Math.abs(inc) < 1.0) inc = (double)1.0;
else inc = Math.round(inc+0.5);
for(i=0; i 0)
pos_ejey = MaxY -(int)(-miny1 /(maxy1 - miny1)*(MaxY-50));
maxy1 = maxy;
miny1 = miny;
for(i=0; i numser) mm = numser;
else mm = inser;
for(j=0; j<=mm; j++)
g.setColor(Color.blue);
for(i=0; i
Hola jota,
No he visto todo el codigo pero, lo que se puede ver a primera vista es que no tiene la clase main y sin ella no funciona tu codigo.
Más información sobre opciones de formato
Live in Blogs
Blog Bellezza
Butaca Diez
City Guides Blog
Cyfuss
Que Cocino
Solo Libros Blog
Apuntes para Vagos
Tu Curso de Francés
Tu Curso de Inglés
Vivir en Japón
Vivir en Irlanda
Vivir en Francia
Vivir en Alemania
Blog Boda Urubamba
Comentarios
Hola, Así, a bote pronto y
Hola,
Así, a bote pronto y sin tener el código para echarle un vistazo (es más fácil
), el error es por que está mal definida la clase '
main'. Revisa la definición de la clase, y los parámetros que hayas usado, seguramente será por eso.--
saludos
cyfuss
HOla! tengo el mismo
HOla!
tengo el mismo problema con un grafico. Porfa ayuda!
gracias
adjunto el codigo:
import java.awt.*;
public class Graficacion extends Canvas
{
private double Xpixel=0,Ypixel=0;
private double Xpixel1=0,Ypixel1=0;
private int x[][], y[][], numd;
private int n, MaxX, MaxY, posx[], posy[];
private int numser, inser;
private double maxy, miny, etiqx[], etiqy[];
private double maxx, minx;
private Color c[];
private int pos_ejex, pos_ejey;
private double xmouse=0,ymouse=0;
private double Ancho,Alto;
private double miny1, maxy1;
private double minx1, maxx1;
private double prop1,prop2; String Titulo="DIAGRAMA BHPBA vs QD",Variable1="BHPBA",Variable2="QD";
public Graficacion()
{
numd = 12;
this.prop1=0;this.prop2=0;
pos_ejex = 50;
pos_ejey = 450;
this.setBackground(Color.white);
numser = 12;
etiqx = new double[numd];
etiqy = new double[numd];
posx = new int[numd];
posy = new int[numd];
c = new Color[numser];
inser = 0;
c[0] = Color.blue;
c[1] = Color.red;
c[2] = Color.green;
c[3] = Color.darkGray;
c[4] = Color.cyan;
c[5] = Color.black;
c[6] = Color.orange;
c[7] = Color.pink;
c[8] = Color.darkGray;
c[9] = Color.cyan;
c[10] = Color.darkGray;
c[11] = Color.cyan;
}
public void setDimensiones(double anchos, double altos)
{
Ancho=anchos;
Alto=altos;
MaxX = (int)(Ancho-50); MaxY = (int)(Alto-50);
pos_ejey = (int)(Alto-50);
}
void Datos(double x[], double y[],double width,double height,String tit,String var1, String var2)
{
Ancho=width;
Alto=height;
Titulo=tit;
Variable1=var1;
Variable2=var2;
SerieX(x);
SerieY(y);
System.out.println("alto="+Alto+" ancho="+Ancho);
}
void SerieX(double x0[])
{
int i;
double inc, aux;
n = x0.length;
if (inser==0)
{
x = new int[numser][n];
maxx1 = minx1 = x0[0];
for (i = 1; i < n; i++) {
if (x0[i] > maxx1)
maxx1 = x0[i];
if (x0[i] < minx1)
minx1 = x0[i];
}
minx = minx1;
maxx = maxx1;
inc = (maxx1 - minx1) / numd;
if (Math.abs(maxx1 - minx1) > 1.0) {
if (Math.abs(inc) < 1.0)
inc = (double) 1.0;
else
inc = Math.round(inc + 0.5);
}
for (i = 0; i < numd; i++) {
aux = minx1 + inc * i;
aux = (Math.round(aux * 10000.0)) / 10000.0;
etiqx[i] = aux;
posx[i] = (int) ( (etiqx[i] - minx1) / (maxx1 - minx1) * (MaxX - 50));
}
if (minx1 < 0 && maxx1 > 0)
pos_ejex += (int) ( -minx1 / (maxx1 - minx1) * (MaxX - 50));
}
else
{
minx1 = minx;
maxx1 = maxx;
}
for (i = 0; i < n; i++)
x[inser][i] = (int) ( (x0[i] - minx1) / (maxx - minx) * (MaxX - 50));
}
void SerieY(double y0[])
{
int i;
double inc, aux;
if(inser >= numser) return;
if(inser == 0)
{
y = new int[numser][n];
maxy1 = miny1 = y0[0];
for(i=1; i maxy1) maxy1 = y0[i];
if(y0[i] < miny1) miny1 = 0;//y0[i];
}
maxy = maxy1;
miny = miny1;
inc = (maxy1 - miny1)/numd;
if( Math.abs(maxy1 - miny1) > 1.0)
{
if(Math.abs(inc) < 1.0) inc = (double)1.0;
else inc = Math.round(inc+0.5);
}
for(i=0; i 0)
pos_ejey = MaxY -(int)(-miny1 /(maxy1 - miny1)*(MaxY-50));
}
else
{
maxy1 = maxy;
miny1 = miny;
}
for(i=0; i numser) mm = numser;
else mm = inser;
for(j=0; j<=mm; j++)
{
g.setColor(Color.blue);
for(i=0; i
Hola jota, No he visto todo
Hola jota,
No he visto todo el codigo pero, lo que se puede ver a primera vista es que no tiene la clase main y sin ella no funciona tu codigo.
--
saludos
cyfuss
Enviar un comentario nuevo