cs_bescherelle
Messages postés3Date d'inscriptionjeudi 15 mai 2003StatutMembreDernière intervention27 février 2007
-
27 févr. 2007 à 15:21
cs_bygui
Messages postés51Date d'inscriptionlundi 10 avril 2006StatutMembreDernière intervention16 juin 2008
-
27 févr. 2007 à 15:42
Bonjour, je n'arrive pas à compiler mes deux programmes j'ai une erreur du type java.lang.NoDefClassFoundError. Je compile ca marche et j'ai les fichiers.class correspondant. Lorque je veux executer cela ne marche pas, j'ai alors l'erreur. Je vous signale que je compile et exécute en ligne de commande sur un terminal DOS.Voici les programmes:
Serveur:
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
public class Serveur {
private static final int BUF_SIZE = 1024;
public static void main(String[] args) throws IOException {
byte msg[]= new byte[BUF_SIZE];
DatagramSocket so= new DatagramSocket(Integer.parseInt(args[0]));
DatagramPacket paquet= new DatagramPacket(msg, 0,msg.length);
while(true){
so.receive(paquet);
String s= new String(msg,0,paquet.getLength());
byte[] renvoi=s.toUpperCase().getBytes("ASCII");
paquet.setData(renvoi);
so.send(paquet);
paquet.setData(msg);
} } }