Rechercher : dans
Par :

Echec chargement applet en java

Dernière réponse le 23 jan 2009 à 08:17:35 Deathwing, le 21 jan 2009 à 08:54:25 
 Signaler ce message aux modérateurs

Bonjour,

Voila j'ai un petit souci d'affichage de mon diaporama sur mon site web. Lorsque je le testé sous easyphp, il c'est trés bien charger et il fonctionné. Maintenant que je l'ai mis en ligne, il ne veut plus se charger.
Il me met "Applet Diapo Notinited" et "echec du chargement de l'applet java"
Je suis pas un pro en java loin de la donc est-ce que quelqu'un aurait une idée.

Merci d'avance

EDIT : voila l'adresse du site en question : http://droit-narbonne.univ-perp.fr


Voila mon code html :


<APPLET code="Diapo.class" WIDTH="550" height="319" hspace="0" vspace="0" archive="diapo.zip">
<PARAM name=mainDelay value=5000>
<PARAM name=delay value=100>
<PARAM name=between value=0>
<PARAM name=message value="diaporama 3D fac de droit de narbonne">
<PARAM name=target value="_self">
<PARAM name=image1 value="images/diapo/fac1.jpg">
<PARAM name=image2 value="images/diapo/media.jpg">
<PARAM name=image3 value="images/diapo/narbonne5.jpg">
<PARAM name=image4 value="images/diapo/narbonne1.jpg">
<PARAM name=image5 value="images/diapo/narbonne2.jpg">
<PARAM name=image6 value="images/diapo/narbonne3.jpg">
<PARAM name=image7 value="images/diapo/narbonne4.jpg">
</APPLET>


et le code java :


import java.awt.*;
import java.awt.image.*;
import java.applet.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.*;

/**
 * The diaporama applet class
 *
 * @version $Id: Diapo.java,v 1.38 1999/07/13 17:26:21 dfrick Exp $
 * @author Didier Frick (dfrick@dial.eunet.ch)
 */
public class Diapo extends java.applet.Applet {
    protected int between=5;
    protected int delay=100; /* ms */
    protected int mainDelay=2500;
    protected String message="diaporama 3D fac de droit de narbonne";
    protected String target="_blank";
    protected Image img;
    protected FadingImageSource src;
    protected Vector images;
    protected URL link;
    protected Thread thread;
    protected ThreadGroup threadGroup;


    /**
     * This flag is used to downgrade the behavior of this class if it is running in a
     * "problematic" environment like Netscape on the Macintosh.
     * If it is true, only the first image will be displayed
     */
    protected static boolean minimal=true;

    static {
	try {
	    String vendor=System.getProperty("java.vendor").toLowerCase();
	    String os=System.getProperty("os.name").toLowerCase();
	    minimal=vendor.startsWith("netscape")&&os.startsWith("mac");
	} catch(Exception xc) {
	    xc.printStackTrace();
	}
    }

    /**
     * Read the applet parameter values
     */
    public void init() {

	try {
	    between=Integer.parseInt(getParameter("between"));
	} catch (Exception x) {
	    ;
	}

	try {
	    mainDelay=Integer.parseInt(getParameter("mainDelay"));
	} catch (Exception x) {
	    ;
	}
    
	try {
	    delay=Integer.parseInt(getParameter("delay"));
	} catch (Exception x) {
	    ;
	}

	try {
	    link=new URL(getDocumentBase(),getParameter("link"));
	} catch (Exception x) {
	    ;
	}

	String param;
	param=getParameter("target");
	if(param!=null)
	    target=param;

	param=getParameter("message");
	if(param!=null)
	    message=param;

	images=new Vector();
	for(int nImages=0;(param=getParameter("image"+(nImages+1)))!=null; nImages++) {
	    try {
		Image i=getImage(getDocumentBase(),param);
		if(i!=null) {
		    images.addElement(i);
		    if(minimal)
			break;
		}
	    } catch (Exception x) {
		;
	    }
	}
	if(!minimal) {
	    threadGroup=Thread.currentThread().getThreadGroup();
	    src=new FadingImageSource(images,
				      between,
				      mainDelay,
				      delay,
				      bounds().width,
				      bounds().height);
	    img=createImage(src);
	} else {
	    img=(Image)images.elementAt(0);
	}
    }

    /**
     * Override update to suppress flashing
     */
    public void update(Graphics g) {
	paint(g);
    }

    /**
     * The paint method: draw the animated image if defined, otherwise
     * clear the background.
     */
    public void paint(Graphics g) {
	if(img!=null)
	    g.drawImage(img,0,0,this);
    }

    /**
     * The start method: create the ImageProducer and animated image
     */
    public void start() {
	thread=new Thread(threadGroup,src);
	thread.start();
	repaint();
    }

    /**
     * The stop method stops the animation thread
     */
    public void stop() {
	if(thread!=null)
	    thread.stop();
	thread=null;
    }

    public void destroy() {
	src=null;
	img=null;
	images=null;
	System.gc();
    }

    public String getAppletInfo() {
	return "Diaporama $Revision: 1.38 $, Copyright (C) 1997,1998 by Didier Frick (dfrick@dial.eunet.ch)";
    }

    public String[][] getParameterInfo() {
	return pinfo;
    }

    private String pinfo[][] = {
	{ "between", "int", "Number of interpolated images between each image"},
	{ "mainDelay", "int", "Time to display a non-interpolated image (ms)"},
	{ "delay", "int", "Time to display an interpolated image (ms)"},
	{ "link", "URL", "Document to show when user clicks on applet"},
	{ "target", "String", "Frame in which to display link"},
	{ "message", "String", "Text to display in status bar when mouse cursor enters applet"},
	{ "image1", "URL", "First image. Used via Applet.getImage"},
	{ "image2", "URL", "Next image. And so on... (without gaps)"}
    };

    /**
     * Display message if mouse cursor enters applet.
     */
    public boolean mouseEnter(Event evt,
			     int x,
			     int y) {
	showStatus(message);
	return true;
    }

    /**
     * Display linked document if mouse clicked
     */
    public boolean mouseDown(Event evt,
			     int x,
			     int y) {
	if(link!=null)
	    getAppletContext().showDocument(link,target);
	return true;
    }

}

Configuration: Windows XP
Firefox 2.0.0.20

Meilleures réponses pour « echec chargement applet en java » dans :
Installer Java sous Ubuntu VoirPar défaut, Firefox n'est pas fourni avec Java. Voici comment procéder pour l'installer: Ouvrez un terminal (Menu Applications > Accessoires > Terminal) et tapez: sudo aptitude install sun-java6-jre sun-java6-plugin ou sudo aptitude install ...
Télécharger Applet deroule_menu VoirDans les pages web, les menus sont souvent présentés en détails, c’est à dire que vous voyez tous les liens affichés au premier plan. Ceci gâche de l’espace et n’est pas très esthétique. Applet déroule_menu est un outil permettant...
Java - Premier programme VoirPremière application avec Java La première chose à faire est de créer un simple fichier texte (sans mise en forme) et de taper les quelques lignes suivantes : // Votre premiere application en Java class FirstApp { public static void main...

1

Deathwing, le 21 jan 2009 à 10:19:11

Personne n'a une idée???

Répondre à Deathwing

2

tarek_dotzero, le 21 jan 2009 à 10:31:44

Salut,

J'ai pensé que je connais un peu java mais là je reste bloqué sur ce truc:

   static {
	try {
	    String vendor=System.getProperty("java.vendor").toLowerCase();
	    String os=System.getProperty("os.name").toLowerCase();
	    minimal=vendor.startsWith("netscape")&&os.startsWith("mac");
	} catch(Exception xc) {
	    xc.printStackTrace();
	}
    }




Est ce que ça marche?

( Java déplace les initialisations des variables vers le constructeur, donc la fontion "init" en Applet).

Répondre à tarek_dotzero

3

Deathwing, le 21 jan 2009 à 15:03:49

J'en ai vraiment aucune idée. Ce programme je l'ai récupéré sur le net
C'est un gars qui l'a mis en téléchargement et je l'ai juste récupéré. Moi perso je n'y connait pratiquement rien en java.
Et ce que je tyrouve surtout bizarre c'est que lorsque je l'essaye en local l'applet se charge nikel mais dès que je le met en ligne sa coince.

Répondre à Deathwing

4

Deathwing, le 22 jan 2009 à 10:28:30

Personne???

Répondre à Deathwing

5

 Deathwing, le 23 jan 2009 à 08:17:35

Vraiment personne??

Répondre à Deathwing
Collection CommentÇaMarche.net