hi
ich habe nen applet geschrieben was ne seltsame fehlermeldung ausgibt:
Applet:
Fehlermeldung:
also was ich nicht versteh ist folgendes: AVS3/APPAnzeigeLiveBild
Wo kommt das AVS3 her?
der code hat doch gar kein package...
versteh ich echt net...
kann da viellicht mal wer drüber gucken?
thx Kala
ich habe nen applet geschrieben was ne seltsame fehlermeldung ausgibt:
Applet:
Code:
import java.applet.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class APPAnzeigeLiveBild extends Applet {
boolean setgo=false;
boolean thread_is_start=false;
private JPanel jContentPane = null;
private JLabel jLabelBild = null;
String ip=""+this.getCodeBase().getHost();
public void init() {
getJContentPane();
}
public JPanel getJContentPane() {
if (jContentPane == null) {
jLabelBild = new JLabel();
jContentPane = new JPanel();
jContentPane.setBounds(new Rectangle(0, 0, 752, 480));
jContentPane.setLayout(new BorderLayout());
jContentPane.add(jLabelBild, BorderLayout.CENTER);
}
return jContentPane;
}
public void start() {
//Starte Thread für Livebild
startIt();
}
public Lock lock = new ReentrantLock();
public Thread runner = new Thread() {
public void run() {
while (true) {
while (setgo) {
try {
lock.lock(); // @jve:decl-index=0:
jLabelBild.setIcon(Lade_Bild());
try {
sleep(10L);
} catch (InterruptedException e) {
e.printStackTrace();
}
} finally {
lock.unlock();
}
}
try {
sleep(1000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
public void startIt() {
setgo=true;
if(!thread_is_start){
thread_is_start=true;
runner.start();
}
}
public ImageIcon Lade_Bild(){
Socket sock=null;
BufferedOutputStream out=null;
BufferedInputStream in=null;
String[] rueck;
int hoehe;
int breite;
byte[] bild;
ImageIcon ico1=null;
System.out.println(ip);
//int port=AVS3.camPort;
//System.out.println(ip+":"+port);
try { //Verbindung mit dem Cam herstellen
//sock = new Socket(ip, port); //Hier die Domain eintragen
//sock = new Socket("127.0.0.1", 10000); //Hier die Domain eintragen
sock = new Socket(ip, 10000); //Hier die Domain eintragen
System.out.println(sock.isBound());
out = new BufferedOutputStream(sock.getOutputStream());
in = new BufferedInputStream(sock.getInputStream());
//der folgende String enthält die zu übergebenden Variablen
String uebergabe = "getimagesize\n";
out.write(uebergabe.getBytes());
out.flush();
byte[] b = new byte[25];
rueck = new String[25];
int anz=0;
int anz_off_b=0;
anz_off_b = in.read(b,0,b.length);
for(int i=0; i<anz_off_b; i++){
String eing=""+(char) b[i];
String vergl=" ";
if((eing.compareToIgnoreCase(vergl)==0)||(eing.compareToIgnoreCase("\n")==0)){
anz=anz+1;
}else{
if(rueck[anz]!=null){
rueck[anz]=rueck[anz]+""+eing;
}else{
rueck[anz]=""+eing;
}
}
}
breite = Integer.parseInt(rueck[1]);
hoehe = Integer.parseInt(rueck[2]);
int b_groesse = breite*hoehe;
bild = new byte[b_groesse];
in.close();
out.close();
sock.close();
sock = new Socket(ip, 10000); //Hier die Domain eintragen
out = new BufferedOutputStream(sock.getOutputStream());
in = new BufferedInputStream(sock.getInputStream());
String uebergabe1 = "snap\n";
out.write(uebergabe1.getBytes());
out.flush();
int anz_off=0;
int anz_off_new=0;
int off=0;
int leng=b_groesse;
anz_off = in.read(bild,off,leng);
anz_off_new = anz_off;
while (anz_off<b_groesse){
off = anz_off;
leng = leng - anz_off_new;
anz_off_new = in.read(bild,off,leng);
anz_off=anz_off+anz_off_new;
}
in.close();
out.close();
sock.close();
//TODO: data Array mit Grauwerten füllen
BufferedImage img = new BufferedImage(breite, hoehe, BufferedImage.TYPE_BYTE_GRAY);
img.getRaster().setDataElements(0, 0, breite, hoehe, bild);
ico1 = new ImageIcon(img);
} catch (IOException ex) {
System.err.println("41"+ex.toString());
System.exit(1);
}finally{
try{
if(in != null){
in.close();
}
if(out != null){
out.close();
}
if(sock != null){
sock.close();
}
} catch (IOException ex) {
System.err.println("5"+ex.toString());
System.exit(1);
}
}
return ico1;
}
public void stop() {
}
public void destroy() {
}
public void paint(Graphics g) {
}
}
Fehlermeldung:
Code:
java.lang.NoClassDefFoundError: APPAnzeigeLiveBild (wrong name: AVS3/APPAnzeigeLiveBild)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
also was ich nicht versteh ist folgendes: AVS3/APPAnzeigeLiveBild
Wo kommt das AVS3 her?
der code hat doch gar kein package...
versteh ich echt net...
kann da viellicht mal wer drüber gucken?
thx Kala