a.class als applet in html seite einbinden?

Status
Nicht offen für weitere Antworten.

headgrowe

Aktives Mitglied
hey,
hab jt einiges mit java programmiert, aber ab es bis jt immer nu auf meinem rechner genutzt. jt will ich das mal im web probieren (hab einen server(php+mysql)) und würde gerne meine a.class in eine wabseite einbinden? wie mach ich das...muss ich da was im text änder wie soll ich das compiliren...bis jt hat das eclipse immer für mich gemacht....
geht meine idee überhaupt? geht das wie mit flash?

ich krieg immer den ewich langen fehler(hab aber auch keine jar oder ähnliches darauß gemacht):

Code:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at ICQJJ.db(ICQJJ.java:39)
	at ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Jacob Schneider\workspace\ICQJJ\bin\com\mysql\jdbc\Driver.class (Das System kann den angegebenen Pfad nicht finden)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 23 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at ICQJJ.db(ICQJJ.java:39)
	at ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Jacob Schneider\workspace\ICQJJ\bin\com\mysql\jdbc\Driver.class (Das System kann den angegebenen Pfad nicht finden)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 23 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at ICQJJ.db(ICQJJ.java:39)
	at ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Jacob Schneider\workspace\ICQJJ\bin\com\mysql\jdbc\Driver.class (Das System kann den angegebenen Pfad nicht finden)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 23 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at ICQJJ.db(ICQJJ.java:39)
	at ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Jacob Schneider\workspace\ICQJJ\bin\com\mysql\jdbc\Driver.class (Das System kann den angegebenen Pfad nicht finden)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 23 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException

falls der code wichtig is:
Java:
import java.applet.Applet;
import java.awt.*;
import java.io.*;
import java.sql.*;
import javax.swing.*;

@SuppressWarnings("serial")
public class ICQJJ extends JFrame implements ActionListener{
	private static String text = null;
	JTextField textField;
	JTextArea textArea;
	public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { 
		ICQJJ frame = new ICQJJ();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
        frame.setSize(300, 400);
		frame.setVisible(true);     
		
	}
	public static String db(String abfrage, String textUser) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException{
		Class.forName("com.mysql.jdbc.Driver").newInstance();
		Connection con = DriverManager.getConnection("jdbc:mysql://localhost/java","root", "");	Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,	ResultSet.CONCUR_UPDATABLE);ResultSet rs = st.executeQuery("SELECT * FROM icq");ResultSetMetaData rsmd = rs.getMetaData();int cmax = rsmd.getColumnCount();
		if(abfrage != "abfrage"){
			rs.moveToInsertRow();
			rs.updateString("name", getName("name.icqJJ"));
			rs.updateString("text", textUser);
			rs.insertRow();
			rs.beforeFirst();
		}
			text = "";
			while(rs.next()){
				for(int i=1 ; i<=cmax ; i++ ){
					//System.out.print(rs.getString(i)+"  ") ;					
					text += rs.getString(i)+"  ";
				}/*System.out.println();*/ 
				text += " \n";
				//text += " <br>";
			}
			//text += "<image>a.gif</image></body></html>";
		return text;
	}
	public ICQJJ(){
		super("ICQJJ");
		setLayout( new GridLayout(2, 1) );
        textField = new JTextField();
        textField.addActionListener(this);
        textArea = new JTextArea();
        
        textArea.setEditable(false);
        JScrollPane scrollPane = new JScrollPane(textArea);
        add(scrollPane);
        add(textField);        
        
        pack();
        try {db("abfrage",null);} catch (SQLException e) {e.printStackTrace();} catch (InstantiationException e) {e.printStackTrace();} catch (IllegalAccessException e) {e.printStackTrace();} catch (ClassNotFoundException e) {e.printStackTrace();}
		textArea.setText(text); 
		textArea.setCaretPosition(textArea.getDocument().getLength());
		//textArea.setCursor(textArea.getText().length());
	}
    public void actionPerformed(ActionEvent evt) {
    		String textUser = textField.getText();
        	try {db(null,textUser);} catch (SQLException e) {e.printStackTrace();} catch (InstantiationException e) {e.printStackTrace();} catch (IllegalAccessException e) {e.printStackTrace();} catch (ClassNotFoundException e) {e.printStackTrace();}
        	textArea.setText(text);   		
    		textField.selectAll();
            //textArea.setCaretPosition(textArea.getDocument().getLength());
    }
    @SuppressWarnings("deprecation")
	public static String getName(String path) {
		File file = new File(path);
		String name = new String();
		try {
			FileInputStream fis = new FileInputStream(file);
			BufferedInputStream bis = new BufferedInputStream(fis);
			DataInputStream dis = new DataInputStream(bis);			
			while (dis.available() != 0) {
				name += dis.readLine();
			}			
			fis.close();
			bis.close();
			dis.close();

		}catch(FileNotFoundException e) {
			name = JOptionPane.showInputDialog(null,
					  "Gib deinen Namen ein:",
					  "Registrieren",
					  JOptionPane.QUESTION_MESSAGE);
			writeNameFile(path, name);
			//e.printStackTrace();
		}catch(IOException e) {
			e.printStackTrace();
		}
		return name;
	}
	private static void writeNameFile(String path, String name) {
		
		File file = new File(path);
		FileWriter out = null;
		try {out = new FileWriter(file);} catch (IOException e2) {e2.printStackTrace();}try {
			out.write(name);
		} catch (IOException e1) {e1.printStackTrace();}try {out.close();} catch (IOException e) {e.printStackTrace();}
	}
}
 
Zuletzt bearbeitet:

radiac

Bekanntes Mitglied
Ohjee... ich will ja nicht meckern, aber deine Frage ist einfach nur schrecklich zu lesen :autsch:.

Ich hoffe doch, das nicht alle Menschen so schreibfaul werden xD. Jetzt wird schon "jetzt" abgekürzt zu jt??? Hört das denn nie auf ;(.


save the german language!!! <--- Natürlich in Englisch xD.
 

L-ectron-X

Gesperrter Benutzer
wie mach ich das...muss ich da was im text änder wie soll ich das compiliren...bis jt hat das eclipse immer für mich gemacht....
geht meine idee überhaupt? geht das wie mit flash?
Du kompilierst Applets wie jedes andere Java-Programm auch.
Warum soll das nicht gehen, schreibst du zum ersten Mal ein Programm in Java? :confused: Was willst du mit Flash? Ich denke du willst ein Applet in eine Webseite einbinden...
Hier findest du, wie Applets eingebunden werden: http://www.java-forum.org/java-faq-...ein-browser-die-anzeige-von-java-applets.html

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Du musst den Treiber (also die Jar-Datei) in den Classpath setzen.
Wie das geht, steht auch im obigen Link.
 

headgrowe

Aktives Mitglied
ja, ich arbeite wie gesagt immer nur mit eclipse, was alles vereinfacht....
den db traiber hab ich mit eclipse verlinkt....run -> run configuration -> classpath -> add external jar....

ich würde gerne lernen dei projekte in eine .jar zu bringen....wie mach ich das...verkürzt ja die ladezeit

ich hab die compilierte datei mit diesem html text aufgerufen...:
HTML:
<html><head></head><body>

  <applet code="ICQJJ.class" alt="Java-Applets mit HTML-Farbw&auml;hler">
    <param name="TestText" value="SELFHTML">
  </applet>

</body></html>
 

headgrowe

Aktives Mitglied
also ich hab den db traiber wie beschrieben eingebunden und mit eclipse gehts....
ich habs jt probiert mit eclipse zu packen, doch dieser fehler kam...

Code:
JAR export finished with warnings. See details for additional information.
  Exported with compile warnings: ICQJJ/src/ICQJJ.java
  Jar export finished with problems. See details for additional infos.
    Fat Jar Export: Could not find class-path entry for 'C:Java/jdk/mysql-connector-java-5.1.8-bin.jar'
doch die jar datei is dort!! was mach ich falsch

dein link is gut, doch "appletviewer [optionen] htmldatei.html" geht leider bei mir nicht...und im browser kommt immer der fehler mit der .jar
 
Zuletzt bearbeitet:

headgrowe

Aktives Mitglied
ok, schde...wie machst denn du deine .jar ich möchte einfach das alle classen da drinnen sind....in der jar...

gut, also der error im anhang
 

L-ectron-X

Gesperrter Benutzer
Für Applikationen mache ich das auch mit meiner IDE. Für Applets geht das auch, aber es geht auch (wenn du es mit deiner IDE nicht hinbekommst), mit einem ganz normalen Packprogramm.

Die Fehlermeldung zeigt, dass du den Befehl nicht verstanden hast.
Versuche mal
Code:
appletviewer hi.html
 

headgrowe

Aktives Mitglied
ja, immer der gleiche fehler, er kann den db traiber nicht finden..
deshalb will ich ja eine komplette jar datei erstellen
error code in anhang
 
Zuletzt bearbeitet:

headgrowe

Aktives Mitglied
...hab den db einfach extrahiert grrr aber naja...
es bleibt doch noch ein error...;

Java Plug-in 1.6.0_14
Verwendung der JRE-Version 1.6.0_14-b08 Java HotSpot(TM) Client VM
Home-Verzeichnis des Benutzers = C:\Users\Jacob Schneider
----------------------------------------------------
java.lang.NoClassDefFoundError: ICQJJ (wrong name: ICQJJ/ICQJJ)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NoClassDefFoundError: ICQJJ (wrong name: ICQJJ/ICQJJ)
java.lang.NoClassDefFoundError: ICQJJ (wrong name: ICQJJ/ICQJJ)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NoClassDefFoundError: ICQJJ (wrong name: ICQJJ/ICQJJ)
 
Zuletzt bearbeitet:

L-ectron-X

Gesperrter Benutzer
Also noch mal. Alles, was du wissen musst, damit dein Applet richtig eingebunden wird und alle Klassen gefunden werden, findest du hier: http://www.java-forum.org/java-faq-...ein-browser-die-anzeige-von-java-applets.html

Du musst den Treiber mit in den Classpath setzen und wenn du eine Jar-Datei erzeugt hast, in dem dein Applet liegt, musst diese auch mit dort aufführen.
Deine Klasse liegt offenbar in einem Package. Also: auch mit angeben. ;)

Könnte dann etwa so aussehen:
HTML:
<applet archive="mysql-connector-java-5.1.8-bin.jar, meinjar.jar" code="ICQJJ.ICQJJ" width="800" height="500">
</applet>
 

headgrowe

Aktives Mitglied
ja, den link hab isch schon die ganze zeit offen...der is supa....nur leider sagt mir der nicht wie ich diesen blöden traiber in in jar bzw in den classpath bringe....ich hab probiert eine manifest.txt zu machen, doch das ging iwei net mit eclipse...
also leider gehts net ...
 
Zuletzt bearbeitet:

headgrowe

Aktives Mitglied
also,
ICH HAB ES GESCHAFT...
alle die eclipse nutzen und externe jars benutzen....einfach die jar ins projekt reinkoppieren und dann mit rechtem klick bulid path-> add jar hinzufügen...
genaueres hier.
dann kann man das ganze projekt ohne den oben genannten fehler in eine jar exportieren :D
 

headgrowe

Aktives Mitglied
runnable jar funktioniert, wenn ich drauf doppelklicke....doch nach der anleitung in deinem link, schaffe ich es trotz nicht es in der browser zu bringen...
bei den versuchen 2 und 3 kommt der gleiche fehler glaub ich....und der liegt galub ich wieder an dem db traiber.....die jar funktioniert!!! auch mit db zugriffen!!!

versuch 1: geht nicht weil ich scheinbar ein packed hab...

HTML:
 <applet archive="test.jar" code="ICQJJ.class" width="400" height="300">
</applet>
Code:
Laden: Klasse ICQJJ.class nicht gefunden
java.lang.ClassNotFoundException: ICQJJ.class
	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Users\Jacob Schneider\Desktop\ICQJJ\class.class (Das System kann den angegebenen Pfad nicht finden)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at java.io.FileInputStream.<init>(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source)
	at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	... 7 more
Ausnahme: java.lang.ClassNotFoundException: ICQJJ.class

versuch 2:

HTML:
 <applet archive="test.jar" code="ICQJJ.ICQJJ.class" width="400" height="300">
</applet>
Code:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.801.441 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at ICQJJ.ICQJJ.db(ICQJJ.java:40)
	at ICQJJ.ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.801.441 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
	... 28 more
Caused by: java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3306 connect,resolve)
	at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:404)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:265)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:290)
	... 29 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ.ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException

versuch 3:

HTML:
<applet archive="test.jar" code="ICQJJ.ICQJJ" width="400" height="300">
</applet>
Code:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.230.214 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at ICQJJ.ICQJJ.db(ICQJJ.java:40)
	at ICQJJ.ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.230.213 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
	... 28 more
Caused by: java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3306 connect,resolve)
	at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:404)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:265)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:290)
	... 29 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ.ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.280.732 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at ICQJJ.ICQJJ.db(ICQJJ.java:40)
	at ICQJJ.ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.280.731 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
	... 28 more
Caused by: java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3306 connect,resolve)
	at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:404)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:265)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:290)
	... 29 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ.ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException
 
Zuletzt bearbeitet:

L-ectron-X

Gesperrter Benutzer
Wo liegt denn der Treiber? Hast du den entpackt und in dein Test-Jar gepackt?
Warscheinlich wirst du die Applet-Version zusätzlich noch signieren müssen.
 

headgrowe

Aktives Mitglied
neeee, den db traiber hab ich einfach ins projekt gezogen und auf add to classpath geklickt.... als runnable jar gehts ja jt. ( is da ein unterschied ob ich das als runnable jar oder als jar zusammenfassen lasse?)

ich hab die jar mal entpackt und geschaut was drinnen is:
es sind 4 ordner drinnen mit den namen ICQJJ, com,org, MET-INF.......(ich denke im com und org is der db traiber und im META-INF is ein ordner service enhalten und 2dateien eine INDEX.LIST und MANIFEST:MF datei drinnen ...manifest datei hat folgendem inhalt:

Code:
Manifest-Version: 1.0
Class-Path: .
Main-Class: ICQJJ.ICQJJ

Name: common
Implementation-Vendor: Sun Microsystems Inc.
Implementation-Title: MySQL Connector/J
Implementation-Version: 5.1.8
Implementation-Vendor-Id: com.mysql
Specification-Vendor: Sun Microsystems Inc.
Specification-Title: JDBC
Specification-Version: 4.0

und im ICQJJ ordner die ICQJJ:class

und was is das jt mit dem signieren wieder?
 
Zuletzt bearbeitet:

L-ectron-X

Gesperrter Benutzer
Ein runnable Jar enthält ein ausführbares Programm und ist per Doppelklick startbar. Ein normales Jar kann z.B. eine Bibliothek anthalten, also eine Sammlung von Klassen.
Der einzige Unterschied sollte der Main-Class Eintrag im Verzeichnis META_INF sein.

Signieren musst du Applets und Webstart-Anwendungen, wenn sie erweiterte Rechte auf dem Client-Rechner benötigen, oder Dinge ausführen sollen, die die Systemsicherheit potenziell gefährden.

Wenn du also mit einem Applet auf eine Datenbank zugreifen möchtest, muss es und der DB-Treiber signiert sein, weil ein Zugriff auf einen anderen Server erfolgen soll, was unsignierten Applets nicht erlaubt ist. Dazu gibts auch einen FAQ-Beitrag.
 

headgrowe

Aktives Mitglied
danke danke!! wenn du mir so wiederhilfst, werde ich das zum schluss noch schaffen!!!
dieses thema könnte man schon fast als tutorial für idioten verwenden

also die fehlermeldung kommt, wegen dem signieren? gut ich frag jt nicht wie das geht...ich google es einfach mal^^ (so wie alles was ich bis jt gefragt hab???:L nur irgendwie is das unglaubwürdig)

Code:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.801.441 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:352)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at java.sql.DriverManager.getConnection(Unknown Source)
	at ICQJJ.ICQJJ.db(ICQJJ.java:40)
	at ICQJJ.ICQJJ.<init>(ICQJJ.java:73)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1.249.218.801.441 milliseconds ago.  The last packet sent successfully to the server was 0 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2137)
	... 28 more
Caused by: java.net.SocketException: java.security.AccessControlException: access denied (java.net.SocketPermission [0:0:0:0:0:0:0:1]:3306 connect,resolve)
	at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:404)
	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:265)
	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:290)
	... 29 more
java.lang.reflect.InvocationTargetException
	at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: ICQJJ.ICQJJ cannot be cast to java.applet.Applet
	at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Ausnahme: java.lang.reflect.InvocationTargetException
java.lang.NullPointerException
	at sun.plugin2.applet.Plugin2Manager.findAppletJDKLevel(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Ausnahme: java.lang.NullPointerException
 
Zuletzt bearbeitet:

L-ectron-X

Gesperrter Benutzer
Ich weiß nicht genau, ob dein unsigniertes Applet an dieser Stelle schon eine Rolle spiel. Eine AccessControlException wird ja in der Fehlermeldung schon aufgeführt.

Ich denke eher, dass du eine Datenbank lokal laufen lässt und die IP vom Localhost nicht aufgelöst werden kann. Benutze mal deine Netzwerk-IP.
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
Dilandau html applet: .jar laden statt .class Java Basics - Anfänger-Themen 4
J Java Applet XPLUG.JAR / XPLUG.CLASS Java Basics - Anfänger-Themen 4
T IntelliJ / SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". Java Basics - Anfänger-Themen 4
wolei Java generic interface in a generic class Java Basics - Anfänger-Themen 6
Say Class scope und Instance scope und Getter nur selbstgeschrieben Methoden Java Basics - Anfänger-Themen 11
Say abstract class und Objekt erzeugen - Dringend Hilfe Java Basics - Anfänger-Themen 10
C Was tun wenn .class erwartet wird ? Java Basics - Anfänger-Themen 6
M "Class<T> clazz" im Constructor - auch für int möglich? Java Basics - Anfänger-Themen 7
M error: '.class' expected switch(char) Java Basics - Anfänger-Themen 32
123456789sssssaaaa Java Wrapper Class Java Basics - Anfänger-Themen 13
FHEFHJHFJH error: class names, 'summe_bsp', are only accepted if annotation processing is explicitly requested Java Basics - Anfänger-Themen 3
N Variabel in eine class mit "extends JLabel" übertragen Java Basics - Anfänger-Themen 2
J Methode als Class anlegen Java Basics - Anfänger-Themen 7
A Fehler beim Ausführen einer class Datei Java Basics - Anfänger-Themen 6
G Could not initialize class “NoClassDefFoundError" Java Basics - Anfänger-Themen 2
Mr_Kleeblatt Operatoren if (arri[i] != "test.java"&& arri[i] != "test.class") Java Basics - Anfänger-Themen 3
S Generics-Problem: Class, Class<?>, Class<Object> Java Basics - Anfänger-Themen 4
J Klassen .class Datei öffnen Java Basics - Anfänger-Themen 31
C "HelloWorld" - Dateien erstellt, aber ist es eine class-Datei? Java Basics - Anfänger-Themen 2
O Verständniss Problem bei abstract class Java Basics - Anfänger-Themen 7
H .class Datei wird nicht ausgeführt Java Basics - Anfänger-Themen 2
H .jar unterschied .class Java Basics - Anfänger-Themen 3
J class version 52 und 56 Java Basics - Anfänger-Themen 6
L Fehler bei der AUsführung der .class Datei Java Basics - Anfänger-Themen 23
A Class not found - Jar liegt am classpath Java Basics - Anfänger-Themen 2
A Wie erkennt die JVM welche class verwendet werden muss? Java Basics - Anfänger-Themen 3
dapzoo Class File Version zu niedrig? Ausführen über Eingabeaufforderung nicht möglich Java Basics - Anfänger-Themen 14
J Methoden Methoden einer public class AutoCompleteTextField verwenden Java Basics - Anfänger-Themen 14
R HTTP-Links in Java Class finden Java Basics - Anfänger-Themen 3
D jsoup get class name mit leerzeichen Java Basics - Anfänger-Themen 7
D doc.seect jsouo bestimmtes class element finden Java Basics - Anfänger-Themen 1
B Objekte zählen/ Vererbung/ Kopplung/ Interface/ Abstract Class Java Basics - Anfänger-Themen 5
N Fehlende .class Datei Java Basics - Anfänger-Themen 4
S Daten aus eigenständiger .class-Datei abrufen Java Basics - Anfänger-Themen 1
C Was macht `public class ClassName<T extends Comparable<T>>`? Java Basics - Anfänger-Themen 14
W Externe class in Eclipse importieren Java Basics - Anfänger-Themen 0
X Variablen Problem bei Aufteilung in verschiedene Class-Files Java Basics - Anfänger-Themen 4
Javafan01 Dateiname und Public class Java Basics - Anfänger-Themen 4
S Klassen Class mit Funktionen importieren Java Basics - Anfänger-Themen 1
L jar, class, java und wieder zurück Java Basics - Anfänger-Themen 8
T class Datei auslesen Java Java Basics - Anfänger-Themen 5
B Classpath Class lässt sich nicht öffnen Java Basics - Anfänger-Themen 3
J Compiler-Fehler Fehler bei Vektor (E extends Object declared in class Vector) Java Basics - Anfänger-Themen 9
temi Verständnisproblem Class.forName() Java Basics - Anfänger-Themen 3
S setText aus anderer class heraus Java Basics - Anfänger-Themen 6
L Classpath Zwei Bibliotheken enthalten gleiche .class Datei Java Basics - Anfänger-Themen 6
F Taschenrechner "Error loading class..." Java Basics - Anfänger-Themen 5
D Interface Amazon Skill Kit, Interface but method in other class? Java Basics - Anfänger-Themen 3
J Compiler-Fehler class interface or enum expected Java Basics - Anfänger-Themen 1
wilmaed protected class Java Basics - Anfänger-Themen 0
C Erste Schritte Fehler beim *.class Aufruf über cmd.exe Java Basics - Anfänger-Themen 9
N class in class Java Basics - Anfänger-Themen 13
B Linux - Error: Could not find or load main class application.Main Java Basics - Anfänger-Themen 28
V Was bewirkt das Schlüsselwort extends in Verbindung mit class bzw. public class ? Java Basics - Anfänger-Themen 2
Azazel Ist die abstract class das selbe wie ein interface ? Java Basics - Anfänger-Themen 33
lBlKha0s Fehlermeldung : class interface or enum expected Java Basics - Anfänger-Themen 9
P could not find main class obwohl da Java Basics - Anfänger-Themen 17
UnityFriday method getPrevious in class List<ContentType> cannot be applied to given types Java Basics - Anfänger-Themen 29
T error: class, interface, or enum expected Java Basics - Anfänger-Themen 5
D Compiler-Fehler error: .class expected Java Basics - Anfänger-Themen 2
S Dataflow von Start bis die SystemProperties class Java Basics - Anfänger-Themen 1
Detox Class Datei erzeugen nicht möglich über cmd Java Basics - Anfänger-Themen 1
M Scanner class Java Basics - Anfänger-Themen 6
A attach source: Zusammenhang zwischen JAR und .class/.java Dateien? Java Basics - Anfänger-Themen 2
L Compiler-Fehler error: class, interface or enum expected Java Basics - Anfänger-Themen 2
C Klassen Class Files nachladen (mehrer .jar Dateien) Java Basics - Anfänger-Themen 2
P Compiler-Fehler Could not load or find main class fehler Java Basics - Anfänger-Themen 15
J Gestaltung der GUI.class Java Basics - Anfänger-Themen 1
P Compiler-Fehler could not find or load main class Java Basics - Anfänger-Themen 5
Z Gleiches Verzeichnis für class und java unter Windows Muss? Java Basics - Anfänger-Themen 11
S Class Dateien decompilieren Java Basics - Anfänger-Themen 4
D neue public static class variablen in array speichern? Java Basics - Anfänger-Themen 6
T Wie vergleiche ich die Jahre aus der while Schleife die in ( public class) fuer cbx geschrieben sind Java Basics - Anfänger-Themen 5
S Vererbung Fehlermeldung: the hierarchy of the type "class name" is inconsistent Java Basics - Anfänger-Themen 10
J Erste Schritte .class datei in meine form inkludieren Java Basics - Anfänger-Themen 3
O Objekt weitergeben Meth Class NullPointerException Java Basics - Anfänger-Themen 2
M Class Datein aus einen Unterordner verwenden Java Basics - Anfänger-Themen 2
B .class-File mit Reflection auslesen Java Basics - Anfänger-Themen 8
C class in main aufrufen (SWT Oberfläche) Java Basics - Anfänger-Themen 5
P Compiler-Fehler .java Dateien kompilieren und .class Dateien zur .jar Java Basics - Anfänger-Themen 4
D error: Class names, >>>HILFE, anfänger<<< Java Basics - Anfänger-Themen 4
M Class nach Namensänderung nicht mehr vorhanden Java Basics - Anfänger-Themen 6
P .class 2 .exe ? Java Basics - Anfänger-Themen 5
N Compiler-Fehler HundTestlauf class Fehler Java Basics - Anfänger-Themen 4
S Class File Editor gibt beim Start der Programms die Fehlermeldung Source not found aus Java Basics - Anfänger-Themen 1
3 OOP static class in einer Klasse Java Basics - Anfänger-Themen 6
H Umgebungsvariable In DOS-Box läuft die fehlerfreie Class-Datei nicht. Java Basics - Anfänger-Themen 5
J Compiler-Fehler bootstrap class path not set in conjunction with -source 1.6 Java Basics - Anfänger-Themen 2
J Interface compatible to a class Java Basics - Anfänger-Themen 7
Phil42 "Local variable i is accessed from within inner class" Java Basics - Anfänger-Themen 3
F .class expected Java Basics - Anfänger-Themen 3
S Erste Schritte Ausführen einer Class Datei Java Basics - Anfänger-Themen 6
C Klassen Minesweeper Problem. int needs to be final (inner class problem) Java Basics - Anfänger-Themen 3
K Frage zu Class Operator Java Basics - Anfänger-Themen 2
G Threads SuM Class Animation Java Basics - Anfänger-Themen 13
F Befehle von Java class ausführen Java Basics - Anfänger-Themen 3
G default class type Java Basics - Anfänger-Themen 3
Luk10 Generisches Class<...>[] Java Basics - Anfänger-Themen 15
Luk10 instanceof Class<T> Java Basics - Anfänger-Themen 6
N Probleme mit Class in andere Class adden (Cardlayout) Java Basics - Anfänger-Themen 2

Ähnliche Java Themen


Oben