• Post Reply Bookmark Topic Watch Topic
  • New Topic

BeanBox problems  RSS feed

 
Matt Holloway
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm just learning (or trying) Java Beans. I've been going through the Sun tutorial, as well I have several books, but I can't get the SimpleBean to work from the tutorial.
First, I had troubles even getting BeanBox to work properly. The buttons.jar had a problem, and I had to remove one of the classes to get it to work.
Now, I've done the SimpleBeans from sun tutorial verbatim, and when I try to load the jar, it says the jar contains no beans.
My manifest file is as follows:
Name: tutorial/SimpleBean.class
Java-Bean: True
When I perform jar tf simplebean.jar to get contents, results are:
META-INF/
META-INF/MANIFEST.MF
SimpleBean.class
Message from BeanBox is:
jar file c:\tutorial\simplebean.jar didn't have any beans!
Am I missing something basic here?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Am I missing something basic here?

Two things.
First, the manifest says that the class name is tutorial.SimpleBean, but in the JAR file it's stored as if it were just SimpleBean, in the default package. You need to get these two straight. I don't know which is correct in this particular case -- it depends on whether SimpleBean.java contains a "package tutorial" statement or not. Don't use a slash to separate the package components -- use a dot, like tutorial.SimpleBean .
Second, don't use the ".class" extension in the manifest file. The entries name classes, not files, so you're making it look as if there's a class named "class" in the package "tutorial.SimpleBean".
That should fix the problem.
 
Matt Holloway
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your continued help... I've followed your recommendations without success. Here is what I have now:
SimpleBean.java:

manifest.txt:

When I put the jar together, I use:
jar cfm SimpleBean.jar manifest.txt SimpleBean.class
jar tf SimpleBean.jar produces:

BeanBox response:
Jar file c:\tutorial\SimpleBean.jar didn't have any beans!
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the BeanBox installed, so I cut-and-pasted your files and command lines and tried them out, and then used the LoadJar menu command to load up the JAR file, and it worked. I was able to create and use a SimpleBean!
So I'm at a loss, really; sorry I can't think of anything else.
 
Matt Holloway
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help... maybe it's my computer. I'll boot up my other pc and get it installed on there and try it out.
This is the kind of thing I find frustrating about Java, there seems to be some ambiguous problems with it, maybe due to the open-source nature of Java? I like the language, and the robustness (is that a word) of it, but I seem to run into many roadblocks on some of the things that should be simple (although, by the time I get past the road block, I feel like I've really learned something). Anyway, I digress.
 
Matt Holloway
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I figured it out. I used winrar to go into the jar file and investigate my manifest file. The line Java-Bean: True was missing, so I checked my original manifest, and it was there... odd.
I then went back through the API spec and tutorial, and found the missing piece of info... must have a blank line at the end of the manifest file.
Guess that's why I'm a Greenhorn.
Anyway, it works now. Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!