*** il veut pas trouver mon main :( ***

Résolu
JMBeaucoup Messages postés 16 Date d'inscription samedi 4 avril 2009 Statut Membre Dernière intervention 24 juin 2009 - 8 avril 2009 à 11:27
JMBeaucoup Messages postés 16 Date d'inscription samedi 4 avril 2009 Statut Membre Dernière intervention 24 juin 2009 - 8 avril 2009 à 20:05
Bonjour,

En voulant compiler mon code, un message d'erreur vient ce claquer sur mon écran.

Le message est: Could not find the main class:javax.baja.naming.BIpHost. Program will exit.

Seulement là je vois pas! J'ai fais attention à tout, enfin je croix :) et il me semble plutôt propre mon code non??? pourquoi ne voit-il pas mon main?

Voici mon code:

/**
 *  Tri d'un tableau d'entier en échangeant la valeur des éléments.
 */

import java.io.IOException;

public class TrieParEchange
{
  public void main() throws IOException {
  //public static void main(String args[]) throws IOException {

  int tab [] = { 2, 5, 1, 3, 0, 4};
 
  int i,j ;
 
  i=0;
  j=0;
 
  j=i;
 
  //  Affichage du tableau à trier.
  System.out.println("Affichage du tableau à trier");
  TrieParEchange.afficher(tab);
 
  //  Parcourir tableau,
  for(i=0; i<tab.length; i++)
  {
    for(j=i+1; j<tab.length; j++)
    {
      if(i<j)
      {
        j++;
      }
      else if(i>j)
      {
        //  Echange de deux valeurs.
        int tmp = 0;
        tab[i]=tmp;
        tab[j]=tab[i];
        tab[j]=tmp;
      }
    }
  }
  //    Affichage du tableau trier.
  System.out.println("Affichage du tableau trier");
  TrieParEchange.afficher(tab);
 
  }

//Affichage à l'écran
  public static void afficher(int tab[])
  {
    for(int a=0; a<tab.length; a++)
      System.out.println(tab[a]);
    return;
  }
}

3 réponses

JMBeaucoup Messages postés 16 Date d'inscription samedi 4 avril 2009 Statut Membre Dernière intervention 24 juin 2009
8 avril 2009 à 20:05
c bon ca marchouille :)
j'ai fais des trucs que j'ai trouvé sur le net et peut etre que la somme de tou ca ... ;)
enfin, bonne soirée
3
cs_irraxen Messages postés 4 Date d'inscription mercredi 30 avril 2003 Statut Membre Dernière intervention 11 juin 2009
8 avril 2009 à 13:05
Bonjour,

Ta méthode main fonctionnerait mieux si elle était "static"

exemple : public static void main(String args[]) throws IOException {

--------------------------------------------------------------------------
si tu tape ta tête contre une cruche et que cela sonne creux n'en déduis pas obligatoirement que c'est la cruche qui est creuse
0
JMBeaucoup Messages postés 16 Date d'inscription samedi 4 avril 2009 Statut Membre Dernière intervention 24 juin 2009
8 avril 2009 à 13:15
ben j'ai déjà testé mais :( sans succès.
0
Rejoignez-nous