posted 22 years ago
Hi.
i'm just new to javabeans and have tried the javabeans tutorial from javasoft.com. I have troubled making the example program there into a jar files.
**********************
SimpleBean.java
_____________________
import java.awt.*;
import java.io.Serializable;
public class SimpleBean extends Canvas
implements Serializable {
private Color color = Color.green;
//getter method
public Color getColor() {
return color;
}
//setter method
public void setColor(Color newColor) {
color = newColor;
repaint();
}
//override paint method
public void paint (Graphics g) {
g.setColor(color);
g.fillRect(20,5,20,30);
}
//Constructor: sets inherited properties
public SimpleBean() {
setSize(60,40);
setBackground(Color.red);
}
}
manifest.tmp
________________________
Name: SimpleBean.class
Java-Bean: True
*************************************
I compiled already the SimpleBean.java and put it in the same directory with the manifest.tmp. As i execute the command :
jar cfm SimpleBean.jar manifest.tmp SimpleBean.class
an error occured:
E:\java\javabeans>jar cfm SimpleBean.jar manifest.tmp SimpleBean.class
java.io.IOException: invalid manifest format
at java.util.jar.Manifest.read(Manifest.java:185)
at java.util.jar.Manifest.<init>(Manifest.java:56)
at sun.tools.jar.Main.run(Main.java:125)
at sun.tools.jar.Main.main(Main.java:904)