CONNEXION
  • RetourJeux
    • Sorties
    • Hit Parade
    • Les + populaires
    • Les + attendus
    • Soluces
    • Tous les Jeux
    • Gaming
  • RetourActu Gaming
    • News
    • Astuces
    • Tests
    • Previews
    • Toute l'actu gaming
  • RetourBons plans
    • Bons plans
    • Bons plans Smartphone
    • Bons plans Hardware
    • Bons plans Image et Son
    • Bons plans Amazon
    • Bons plans Cdiscount
    • Bons plans Decathlon
    • Bons plans Fnac
    • Tous les Bons plans
  • RetourJVTech
    • Actus High-Tech
    • Intelligence Artificielle
    • Smartphones
    • Mobilité urbaine
    • Hardware
    • Image et son
    • Tutoriels
    • Tests produits High-Tech
    • Guides d'achat High-Tech
    • JVTech
  • RetourCulture
    • Actus Culture
    • Culture
  • RetourVidéos
    • A la une
    • Gaming Live
    • Vidéos Tests
    • Vidéos Previews
    • Gameplay
    • Trailers
    • Chroniques
    • Replay Web TV
    • Toutes les vidéos
  • RetourForums
    • Hardware PC
    • PS5
    • Switch 2
    • Xbox Series
    • Switch
    • Pokemon pocket
    • FC 25 Ultimate Team
    • League of Legends
    • Tous les Forums
  • PC
  • PS5
  • Xbox Series
  • Switch 2
  • PS4
  • One
  • Switch
  • iOS
  • Android
  • MMO
  • RPG
  • FPS
En ce moment Genshin Impact Valhalla Breath of the wild Animal Crossing GTA 5 Red dead 2
Liste des sujets

[JAVA] Eclipse Probleme launcher minecraft 1.8

yeypiz
yeypiz
Niveau 1
15 mai 2016 à 10:40:52

Bonjour,
J'ai suivi un tuto sur internet pour crée son launcher Minecraft mais j'ai une erreur lorsque j'execute le code. (Mon niveau en Java n'est pas tres haut).

Erreur sur la console eclipse :

Exception in thread "Thread-3" java.lang.NoClassDefFoundError: net/wytrem/wylog/LoggerFactory
	at fr.theshark34.supdate.SUpdate.<clinit>(SUpdate.java:82)
	at fr.yeypiz.launcher.Launcher.update(Launcher.java:45)
	at fr.yeypiz.launcher.LauncherPanel$1.run(LauncherPanel.java:109)
Caused by: java.lang.ClassNotFoundException: net.wytrem.wylog.LoggerFactory
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	... 3 more

Mes Class:

Launcher.java

package fr.yeypiz.launcher;

import java.io.File;
import java.io.IOException;

import fr.theshark34.openauth.AuthPoints;
import fr.theshark34.openauth.AuthenticationException;
import fr.theshark34.openauth.Authenticator;
import fr.theshark34.openauth.model.AuthAgent;
import fr.theshark34.openauth.model.response.AuthResponse;
import fr.theshark34.openlauncherlib.LaunchException;
import fr.theshark34.openlauncherlib.internal.InternalLaunchProfile;
import fr.theshark34.openlauncherlib.internal.InternalLauncher;
import fr.theshark34.openlauncherlib.minecraft.AuthInfos;
import fr.theshark34.openlauncherlib.minecraft.GameFolder;
import fr.theshark34.openlauncherlib.minecraft.GameInfos;
import fr.theshark34.openlauncherlib.minecraft.GameTweak;
import fr.theshark34.openlauncherlib.minecraft.GameType;
import fr.theshark34.openlauncherlib.minecraft.GameVersion;
import fr.theshark34.openlauncherlib.minecraft.MinecraftLauncher;
import fr.theshark34.supdate.BarAPI;
import fr.theshark34.supdate.SUpdate;
import fr.theshark34.supdate.application.integrated.FileDeleter;
import fr.theshark34.swinger.Swinger;

public class Launcher {

	public static final GameVersion L_VERSION = new GameVersion("1.8", GameType.V1_8_HIGHER);
	public static final GameInfos L_INFOS = new GameInfos("YOLO TEST", L_VERSION, new GameTweak[] {GameTweak.FORGE});
	public static final File L_DIR = L_INFOS.getGameDir();
	
	private static AuthInfos authInfos;
	private static Thread uptdateThread;
	
	public static void auth(String username, String password) throws AuthenticationException 
	{
		Authenticator authenticator = new Authenticator(Authenticator.MOJANG_AUTH_URL, AuthPoints.NORMAL_AUTH_POINTS);
		AuthResponse response = authenticator.authenticate(AuthAgent.MINECRAFT, username, password, "");
		
		authInfos = new AuthInfos(response.getSelectedProfile().getName(), response.getAccessToken(), response.getSelectedProfile().getId());
	}
	
	public static void update() throws Exception 
	{
		SUpdate su = new SUpdate("http://mc0yolotest.net16.net/MonPack/", L_DIR);
		su.addApplication(new FileDeleter());
		uptdateThread = new Thread()
			{
			private int val;
			private int max;
			
				@Override
				public void run()
				{
					while(!this.isInterrupted()) {
						if(BarAPI.getNumberOfFileToDownload() == 0)
						{
							LauncherFrame.getInstance().getLauncherPanel().setToolTipText("Verification des fichiers...");
							continue;
						}
						val = (int) (BarAPI.getNumberOfTotalDownloadedBytes() / 1000);
						max = (int) (BarAPI.getNumberOfTotalBytesToDownload() / 1000);
						
						LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setMaximum(max);
						LauncherFrame.getInstance().getLauncherPanel().getProgressBar().setValue(val);
						
						LauncherFrame.getInstance().getLauncherPanel().setToolTipText("Telechargement des fichiers " + 
								BarAPI.getNumberOfDownloadedFiles() + "/" + BarAPI.getNumberOfFileToDownload() + " " +
								Swinger.percentage(val, max) +	"%");
					}
				}
			};
			uptdateThread.start();
		su.start();
		uptdateThread.interrupt();
	}
	
	public static void launch() throws LaunchException
	{
		InternalLaunchProfile profile = MinecraftLauncher.createInternalProfile(L_INFOS, GameFolder.BASIC, authInfos);
		InternalLauncher launcher = new InternalLauncher(profile);
		
		LauncherFrame.getInstance().setVisible(false);
		
		launcher.launch();
				
		GameLauncher gameLauncher = GameLauncher(L_INFOS, GameFolder.BASIC, authInfos);
		Process p = gameLauncher.launch();
		try {
			Thread.sleep(5000L);
		}catch (InterruptedException e)
		{
		}
			try {
				p.waitFor();
			}catch (InterruptedException e)
			{
			}
			System.exit(0);
	}
	
	public static void interruptThread()
	{
		uptdateThread.interrupt();
	}
}

LauncherFrame.java

package fr.yeypiz.launcher;


import javax.swing.JFrame;

import fr.theshark34.swinger.Swinger;
import fr.theshark34.swinger.util.WindowMover;



@SuppressWarnings("serial")
public class LauncherFrame extends JFrame
{
    private static LauncherFrame instance;
    private LauncherPanel launcherPanel;
    
    public LauncherFrame()
    {
        this.setTitle("YOLO TEST LAUNCHER v1.0");
        this.setSize(976, 626);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        this.setLocationRelativeTo(null);
        this.setUndecorated(true);
        this.setIconImage(Swinger.getResource("icone.png"));
        this.setContentPane(launcherPanel = new LauncherPanel());
        WindowMover mover = new WindowMover(this);
        this.addMouseListener(mover);
        this.addMouseMotionListener(mover);
        
        this.setVisible(true);
    }
    
    public static void main(String [] args)
    {
        Swinger.setSystemLookNFeel();
        Swinger.setResourcePath("/fr/yeypiz/launcher/ressources/");
        instance = new LauncherFrame();
    }
    
    public static LauncherFrame getInstance()
    {
        return instance;
    }
    
    public LauncherPanel getLauncherPanel()
    {
        return this.launcherPanel;
    }
}

LauncherPanel.java

package fr.yeypiz.launcher;

import static fr.theshark34.swinger.Swinger.drawFullsizedImage;
import static fr.theshark34.swinger.Swinger.getResource;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

import fr.theshark34.openlauncherlib.util.Saver;
import fr.theshark34.swinger.colored.SColoredBar;
import fr.theshark34.swinger.event.SwingerEvent;
import fr.theshark34.swinger.event.SwingerEventListener;
import fr.theshark34.swinger.textured.STexturedButton;

@SuppressWarnings("serial")
public class LauncherPanel extends JPanel implements SwingerEventListener
{
	private Image background = getResource("background.png");
	
	
	private JTextField usernameField = new JTextField();
	private JPasswordField passwordField = new JPasswordField();
	
	private STexturedButton playButton = new STexturedButton (getResource("play.png"));
	private STexturedButton quitButton = new STexturedButton (getResource("close.png"));
	private STexturedButton hideButton = new STexturedButton (getResource("hide.png"));
	
	private SColoredBar progressBar = new SColoredBar (new Color(255, 255, 255, 15), (new Color(255, 255, 255, 20)));
	
	public LauncherPanel ()
	{
		this.setLayout(null);
		
    	usernameField.setForeground(Color.black);
    	usernameField.setFont(usernameField.getFont().deriveFont(25F));
    	usernameField.setCaretColor(Color.gray);
    	usernameField.setOpaque(false);
    	usernameField.setBorder(null);
    	usernameField.setBounds(400, 468, 314, 57);
    	this.add(usernameField);  
		
		    	
    	passwordField.setForeground(Color.black);
    	passwordField.setFont(usernameField.getFont().deriveFont(25F));
    	passwordField.setCaretColor(Color.gray);
    	passwordField.setOpaque(false);
    	passwordField.setBorder(null);
    	passwordField.setBounds(400, 553, 314, 57);
    	this.add(passwordField);
		
    	playButton.setBounds(740, 490);
    	playButton.addEventListener(this);
    	this.add(playButton);
		
    	quitButton.setBounds(940, 1);
    	quitButton.addEventListener(this);
    	this.add(quitButton);
		
    	hideButton.setBounds(910, 1);
    	hideButton.addEventListener(this);
    	this.add(hideButton);
		
    	progressBar.setStringPainted(true);
    	progressBar.setString("");
    	progressBar.setBounds(12, 447, 951, 15);
    	this.add(progressBar);
	}
	
	private Saver Saver(File file) {
		// TODO Auto-generated method stub
		return null;
	}

	private Color getTransparentWhite(int i) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void onEvent (SwingerEvent event)
	{
		if (event.getSource() == playButton)
		{
			setFieldEnabled(false);
			
			if(usernameField.getText().replaceAll(" ", "").length() == 0 || passwordField.getText().replaceAll(" ", "").length() == 0)
			{
				JOptionPane.showMessageDialog(this, "Erreur, veuillez entrer un pseudo valide.", "Erreur", JOptionPane.ERROR_MESSAGE);
				setFieldEnabled(true);
				return;
			}
			
			Thread t = new Thread()
			{
				@Override
				public void run()
				{		
				try
				{
					Launcher.update();
					
				}
					catch (Exception e)
					{
						Launcher.interruptThread();
						JOptionPane.showMessageDialog(LauncherPanel.this, "Erreur, impossible de mettre à jour les fichiers : " + e, "Erreur", JOptionPane.ERROR_MESSAGE);
						setFieldEnabled(true);
						return;
					}
					
					try
					{
						Launcher.update();
					}
					catch (IOException e)
					{
						Launcher.interruptThread();
						JOptionPane.showMessageDialog(LauncherPanel.this, "Erreur, impossible de lancer le jeu : " + e, "Erreur", JOptionPane.ERROR_MESSAGE);
						setFieldEnabled(true);
					} catch (Exception e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					try
					{
						Launcher.launch();
						
					}
						catch (Exception e)
						{
							JOptionPane.showMessageDialog(LauncherPanel.this, "Erreur, impossible de lancer le jeu : " + e, "Erreur", JOptionPane.ERROR_MESSAGE);
							setFieldEnabled(true);
							return;
						}
					
				}
			};t.start(); 
			
		}
		
		else if (event.getSource() == quitButton)
			System.exit(0);
		else if (event.getSource() == hideButton)
			LauncherFrame.getInstance().setState(JFrame.ICONIFIED);
	}
	
	@Override
	public void paintComponent(Graphics graphics)
	{
		super.paintComponent(graphics);
		
		drawFullsizedImage(graphics, this, background);
	}
	
	public void setFieldEnabled(boolean enabled)
	{
		passwordField.setEnabled(enabled);
		usernameField.setEnabled(enabled);
		playButton.setEnabled(enabled);
	}
	
	public SColoredBar getProgressBar()
	{
		return progressBar;
	}

	public void setInfoText(String string) {
		// TODO Auto-generated method stub
		
	}
	
}

Voila, j’espère que quelqu'un pourra m'aider. Merci.

Cj1993
Cj1993
Niveau 12
15 mai 2016 à 11:39:19

L'erreur parle d'elle même : java.lang.ClassNotFoundException: net.wytrem.wylog.LoggerFactory

VaultDeveloper
VaultDeveloper
Niveau 5
15 mai 2016 à 13:05:13
ClassNotFoundException

Tu as oublié d'importer une classe à ton projet.

net.wytrem.wylog.LoggerFactory

Le nom de la classe qu'il te manque.

Apparemment à télécharger par ici :
https://github.com/Wytrem/WyLog

yeypiz
yeypiz
Niveau 1
15 mai 2016 à 19:48:18

J'ai importer la class que je n'avais pas mais le resultat est le meme :/

Teddou
Teddou
Niveau 1
19 mai 2016 à 22:36:49
 private Image background = getResource("background.png"); 

Ce n'est pas chargé avec swinger?

	private Image background = Swinger.getResource("background.png");
yeypiz
yeypiz
Niveau 1
22 mai 2016 à 19:59:25

Si je me suis tromper mais j'ai remit comme il faut. L'erreur est la meme je cherche mais je ne trouve pas.

Teddou
Teddou
Niveau 1
22 mai 2016 à 20:23:34

https://youtu.be/V2Q6KcYB2Cw?t=374

Reprend la partie Launcher.auth il te la manque je crois bien, d'ailleurs tes erreurs parlent ce ca.

Teddou
Teddou
Niveau 1
22 mai 2016 à 20:30:57
setFieldEnabled(true);

Replace par

setFieldsEnabled(true);
Sous forums
  • Aide à l'achat Mac
  • Internet
  • Macintosh
  • Création de sites web
  • Création de Jeux
  • Linux
  • Programmation
  • Steam Deck
  • Hardware
La vidéo du moment