RECHERCHER :
COMMUNAUTE MP
Identifiez vous ...
Devenir Membre
J'ai oublié mon MDP
DOMAINE MP
Bavardages
Langages Généraux
Langages Web
Langages DotNet
Autres langages
Dev. Jeux Video
Sécurité
Sys. Exploitation
Graphismes
Logiciels
Réseaux
Bases de données
Méthodologies
Emplois High-tech
Aide juridique
Articles juridiques
FORUM
Index des forums
Ajouter un sujet
Rechercher sujet
Contact Responsable
Devenir modérateur
CHAT MP IRC
Votre pseudo ...
Srv: irc.moteurprog.com
Chan: #MoteurProg
PARTICIPER
Plus de 3500 emplois.
Rechercher un job
Déposez votre CV
Emplois High-tech

Visiteur MP

 Problème compilation(package)

Forum : APPLET
Sous Catégorie : Aucune
Type du sujet : Sujet Normale
FAQ : FAQ APPLET

SUIVI DES SUJETS PAR MAIL

SUIVI PAR MAIL INACTIF

RESOLUTION DU SUJET SUJET NON RESOLU
BLOQUAGE DU SUJET SUJET ACTIF
APPARTENANCE A LA FAQ N'APPARTIENT PAS A LA FAQ


PAGE : [1]

POSTER UN NOUVEAU SUJET REPONDRE A CE SUJET

FORUM APPLET

PREMIERE PAGE

PAGE PRECEDENTE

Page précedente

Page suivante

PAGE SUIVANTE

DERNIERE PAGE
debutsql
Membre MP
Inscrit : 24/08/2004
Messages : 176
Message
#93691
Posté le 12/04/06 à 20:36
Bonsoir tout le monde

J'ai un problème de compilation avec javac en mode console.

Il me sort une erreur que je ne comprend pas

Voici l'erreur:

[quote]
Exception in thread "main" java.lang.NoClassDefFoundError: Monnayeur/java
[/quote]

Voici la class Machine:

[code]
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import machine_a_cafe.Monnayeur;

public class Machine extends Applet {

public void init()

{
Monnayeur m;
setBackground(Color.darkGray);
setSize(580, 490);
setLayout(new BorderLayout());
add(m=new Monnayeur(),"Center");
add(new Element(m),"Center");

}

public static void main(String[] args)
{


}

}

[/code]


[code]
import java.awt.*;
import java.awt.event.*;
import javax.swing.ImageIcon;


public class Element extends Panel

{

public Element(Monnayeur m)
{

setBackground(Color.lightGray);

Button bparamettre = new Button("Ouverture paramêttre");
bparamettre.addActionListener(new Coeurmc(1,m));
this.add(bparamettre);

Label titre = new Label("Machine à café");

Button cafe = new Button("café");
cafe.addActionListener(new Coeurmc(2,m));
this.add(cafe);

Button cafelait = new Button("café au lait");
cafelait.addActionListener(new Coeurmc(3,m));
this.add(cafelait);


Button chocolat = new Button("chocolat");
chocolat.addActionListener(new Coeurmc(4,m));
this.add(chocolat);

Button the = new Button("the");
the.addActionListener(new Coeurmc(5,m));
this.add(the);

TextField animation = new TextField(20);
animation.addActionListener(new Coeurmc(16,m));
this.add(animation);



Button cinqcent = new Button("0,5 centimes");
cinqcent.addActionListener(new Coeurmc(6,m));
this.add(cinqcent);


Button dixcent = new Button("0,10 centimes");
dixcent.addActionListener(new Coeurmc(7,m));
this.add(dixcent);

Button vingtcent = new Button("0,20 centimes");
vingtcent.addActionListener(new Coeurmc(8,m));
this.add(vingtcent);

Button cinquantcent = new Button("0,50 centimes");
cinquantcent.addActionListener(new Coeurmc(9,m));
this.add(cinquantcent);

Button uneurro = new Button("1€");
uneurro.addActionListener(new Coeurmc(10,m));
this.add(uneurro);



Label rendmoncinqcent = new Label("Nombre de piece de 5 centimes à rendre");

TextField txtrendmoncinqcent = new TextField(15);
txtrendmoncinqcent.addActionListener(new Coeurmc(11,m));
this.add(txtrendmoncinqcent);

Label rendmondixcent = new Label("Nombre de piece de 10 centimes à rendre");

TextField textrendmondixcent = new TextField(15);
textrendmondixcent.addActionListener(new Coeurmc(12,m));
this.add(textrendmondixcent);

Label rendmonvingtcent = new Label("Nombre de piece de 20 centimes à rendre");

TextField textrendmonvingtcent = new TextField(15);
textrendmonvingtcent.addActionListener(new Coeurmc(13,m));
this.add(textrendmonvingtcent);

Label rendmoncinquantcent = new Label("Nombre de piece de 50 centimes à rendre");

TextField textrendmoncinquantcent = new TextField(15);
textrendmoncinquantcent.addActionListener(new Coeurmc(14,m));
this.add(textrendmoncinquantcent);
Label rendmonunerro = new Label("Nombre de piece de 1€ à rendre");

TextField textrendmonunerro = new TextField(15);
textrendmonunerro.addActionListener(new Coeurmc(15,m));
this.add(textrendmonunerro);

}

}

[/code]

Voici la class Coeumc:

[code]

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.net.*;

public class Coeurmc extends Applet implements ActionListener

{


Monnayeur m;

int button;



public Coeurmc(int choix, Monnayeur m)

{


button=choix;

this.m=m;

}


public void actionPerformed(ActionEvent e)

{

switch (button){

case 16:

m.instruct();


break;

case 15:

m.instruct();


break;

case 14:

m.instruct();

break;

case 13:

m.instruct();

break;

case 12:

m.instruct();

break;

case 11:

m.instruct();

break;

case 10:

m.instruct();


break;

case 9:

m.instruct();


break;

case 8:

m.instruct();

break;

case 7:

m.instruct();

break;

case 6:
m.instruct();

break;

case 5:

m.instruct();

break;

case 4:

m.instruct();


break;

case 3: m.instruct();



break;

case 2: m.instruct();


break;

case 1:
try {

URL paramettre;


paramettre=new URL(getDocumentBase(), "paramettre.html");
getAppletContext().showDocument(paramettre);

repaint();

} catch (MalformedURLException b) {


}
break;

}

}

}


[/code]

Voici la class Monnayeur:

[code]
package machine_a_cafe.Monnayeur;

import java.awt.*;
import java.awt.event.*;

public class Monnayeur

{

int sr, sar, cout;

String animation="Prenez un momment de détente.";


public Monnayeur()

{

instruct();

achatbistrot();

rendmonnaie();

}

public static void main (String [] args)

{


}

public void achatbistrot()
{

String cinqcent="", dixcent="", vingtcent="", cinquantcent="", uneurro="";


if(cinqcent.equals("0,5 centimes"))
{

sr=+5;

}
if(dixcent.equals("0,10 centimes"))
{

sr=+10;

}

if(vingtcent.equals("0,20 centimes"))
{


sr=+20;


}


if(cinquantcent.equals("0,50 centimes"))
{

sr=+50;

}

if(uneurro.equals("1€"))
{

sr=+100;

}



}
public void instruct()

{

String cafe="", cafelait="", chocolat="", the="";



if((cafe.equals("café") && sr==0) ||(cafelait.equals("café_au_lait") && sr==0)||(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))

{

animation="Somme insuffisante";


}

else
{
sar = sr-cout;

sar = sar*10;


}

}


public void piecedispo()

{



int nb5c, nb10c, nb20c, nb50c, nb1e;

int cinpc=0, dixc=0, vingtc=0, cinquc=0, uneurro=0;

nb5c = 0 ;

String texteDansCinpc = Integer.toString(cinpc);
if ( texteDansCinpc != null && texteDansCinpc.length() > 0 )
{
nb5c = Integer.parseInt( texteDansCinpc );
}


nb10c = 0 ;
String texteDansDixc = Integer.toString(dixc);
if ( texteDansDixc != null && texteDansDixc.length() > 0 )
{
nb10c = Integer.parseInt( texteDansDixc );
}



nb20c = 0 ;
String texteDansvingtc = Integer.toString(vingtc);
if ( texteDansvingtc != null && texteDansvingtc.length() > 0 )
{
nb20c = Integer.parseInt( texteDansvingtc );
}


nb50c = 0 ;
String texteDanscinquc = Integer.toString(cinquc);
if ( texteDanscinquc != null && texteDanscinquc.length() > 0 )
{
nb50c = Integer.parseInt( texteDanscinquc );
}


nb1e = 0 ;
String texteDansuneurro = Integer.toString(uneurro);
if ( texteDansuneurro != null && texteDansuneurro.length() > 0 )
{
nb1e = Integer.parseInt( texteDansuneurro );

}



if(nb5c==0 && nb10c==0 && nb20c==0 && nb50c==0 && nb1e==0)

{

animation="Je ne rend pas la monnaie.";


}




}

public void rendmonnaie()
{


piecedispo();

int nb5c, nb10c, nb20c, nb50c, nb1e;
int textrendmonunerro, textrendmoncinquantcent, textrendmonvingtcent, textrendmondixcent, txtrendmoncinqcent;

do
{



if(sar<=200)

{

nb1e=-1;
textrendmonunerro=+1;



}



else if(sar>=50)

{

nb50c=-1;
textrendmoncinquantcent=+1;



}



else if(sar>=20)

{

nb20c=-1;
textrendmonvingtcent=+1;



}


else if(sar>=10)

{
nb10c=-1;
textrendmondixcent=+1;



}



else if(sar>=5)

{

nb5c=-1;

txtrendmoncinqcent=+1;


}



} while(sar==sr);


}

}
[/code]

Pourriez vous m'expliquer comment compiler lorsequ'on a des package.

Merci

Cordialement

A bientôt

ERREUR BBCODE SUR CE MESSAGE :
- La valeur de la balise "quote" n'est pas correcte !

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 

Publicité
Inscrit : X
Messages : X
Message
#Aucun

HAUT DE PAGE

  

fanch
Membre du club
Inscrit : 02/08/2004
Messages : 596
Message
#93781
Posté le 14/04/06 à 08:17
il doit te manquer le nom de teon package quand tu essaie de compiler, du coup il te dit qu'il ne trouve pas ta classe car il la cherche sans package.

Conne chance

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 

debutsql
Membre MP
Inscrit : 24/08/2004
Messages : 176
Message
#93783
Posté le 14/04/06 à 09:26
Bonjour tout le monde

Pourriez vous me dire où je dois mettre le nom de ce package.

Je pense l'avoir mis il me semble Avoir mis le nom du package dans la class monnayeur.

[quote]
package machine_a_cafe.Monnayeur;
[/quote]

Dans la classe Monnayeur

Mon dossier où se trouve tout mon programme s'appelle machine_a_cafe.

Dois je le mettre sur tout mes class.

Pourriez vous me réexpliquer comment réaliser les packages.

Car mes livres ne sont pas précis la dessous.

Merci

Cordialement

A bientôt

ERREUR BBCODE SUR CE MESSAGE :
- La valeur de la balise "quote" n'est pas correcte !

HAUT DE PAGE

PROFIL MEMBRE LUI ECRIRE 
POSTER UN NOUVEAU SUJET REPONDRE A CE SUJET

PREMIERE PAGE

PAGE PRECEDENTE Page précédente

Page suivante

PAGE SUIVANTE DERNIERE PAGE

FORUM APPLET



    PAGE : [1]



.: Site Web développé par Julien Pichot et l'équipe MPWG avec www.evolvia-web.com :.