Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem getting JavaBean to work properly

Status
Not open for further replies.

Perra

Technical User
Dec 28, 2000
38
SE
This problem rises from a try to work through an example in the following
book: The Complete Reference, Java 2 4th edition, chapter 25 (if you have
this book).

It´s all about creating a new Bean. The source listing for the Bean is on
page 860.

I do exactly as the instructions tell me.

PREREQUISITES:

CLASSPATH variable set to E:\BDK\DEMO
JDK1.3.0 installed in e:BDK (Bean Development Kit) installed in e:
1. compile the Colors.java to the following location
e:\bdk\demo\sunw\demo\colors\Colors.class

2. Create a manifest file (colors.mft) in e:\bdk\demo with the following contents:
Name: sunw/demo/colors/Colors.class
Java-Bean: True

3. Create JAR file (colors.jar) in e:\bdk\jars with the following command:
jar cfm ..\jars\colors.jar colors.mft sunw\demo\colors\*.class

***SUCCESS*** ***SUCCESS*** ***SUCCESS***
added manifest
adding: sunw/demo/colors/Colors$1.class(in = 505) (out= 322)(deflated 36%)
adding: sunw/demo/colors/Colors.class(in = 1414) (out= 830)(deflated 41%)


4. Run the BDK with run.bat from the e:\bdk\beanbox directory
***FAILURE*** ***FAILURE*** ***FAILURE***
I´m told the following (output in the console):
E:\bdk\beanbox>java sun.beanbox.BeanBoxFrame
Jar file E:\bdk\jars\colors.jar didn't have any beans!
Each jar file needs to contain a manifest file describing
which entries are beans. You can should provide a suitable
manifest when you create the jar.

5. The tools come up alright, but my bean (Colors) doesn´t appear
in the toolbox as it should.

It´s very strange because everything is alright until I run the BDK-
environment. I´m told that the manifest file was added to colors.jar
and that it compressed and added the .class file(s). Another strange
thing is that the very first time I ran everything my bean appeared
in the Beanbox toolkit. But when I tried to add it to the workspace
I got NullPointerException...something about serialized...
After that, the bean has never appeared in the toolkit.

Can someone help me. I don´t enclose the source code at this stage as I think it´s OK.

Best regards Perra
:cool:

Swedish programmer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top