Home | » | Java | » | Advance Java | » | Java Beans | » | Developing a Simple Bean |
---|
This section presents an example that shows how to develop a simple Bean and connect it to other components via BDK.
Following steps to be adopted to create a new Bean:
This example creates a simple bean button
Diagram 25.9 Type run in the command prompt |
Working of the Code:
To create a bean, type the above code and save it as SimpleBean.java. Comiple the above code using the javac.exe compiler as under:
javac SimpleBean.java
Create a manifest file with a .mf extension as under. The Manifest file is a text file which contains the name of the class file.
SimpleBean.mf
Name: SimpleBean.class
Java-Bean: True
Creating a jar (Java Archive) file
As you are aware that javac.exe creates a separate .class file for every class defined in the program. Hence, if a program has five classes, the compiler will create five class file each with their respective name and a .class extension.
This proved to be drawback as the applet loader makes separate connections for each file while loading the applet. To overcome this problem, the engineers at Java Soft, the Sun Microsystems subsidiary for Java introduced the idea fo compressing all the files together which can be unzipped at the applet's client machine when the applet executes.
Jar is a zip or compression utility tailored to Java's needs. Pass the names of all the files in the project to the JAR utility, which compresses all of them together and creates a compressed file with a .jar extension.
jar [-cvfmOM][jar-file name][manifest-file name] list of .class file
Options:
-c | Creates a new archive. |
-t | List table of contents for archive. |
-x | Extracts named (or all) files from archive. |
-f | Specify archive file name. |
-m | Include manifest information from specified manifest file. |
-O | Store only: use no Zip compression. |
-M | Do not create a manifest file for the entries. |
Creating a JAR file for the example code created eariler on.
This will create a jar file:SimpleBean.jar. Copy this file in the jars directory under the BDK folder and start the Bean Box. The ToolBox of the Bean Box now displays the bean created underline.
|
Diagram 25.10 The SimpleBean can be dragged and dropped in the BeanBox |
Thanks for sharing this informative post.
ReplyDeleteDevops Training
Website designing Company Shamli
ReplyDeleteWebsite Designing Company Varanasi
Web Designing Gorakhpur
Website designing Company Ghazipur
Website designing Company Dehradun
Website designing Company Shahjahanpur
Website designing Company Lucknow
Very good and detailed article.
ReplyDeleteJava Training in OMR
Best way to convert json to xml is JSON to XML
ReplyDelete
ReplyDeleteI have read your blog and I got very useful DevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
I appreciate you finding the time and effort to put this article together reading and leaving comments. But so what, it was still
ReplyDeleteworthwhile!
Best Digital Marketing Agency !
Nice Information and keep posting this type of Information.You can also visit us in need of any assistance with Ecucational information.ADTP Course
ReplyDelete