Best view in Firefox and Chrome

JavaScript to Java Communication - Packages Object in LiveConnect

Friday, January 9, 2009
Convert Article to PDFPrint ArticleEmail Article to FrinedBookmark this Article


In my previous post I explained about the JavaScript to Java Communication and the LiveConnect. Here I like to continue the with that. If a Java class is not part of the java, sun, or netscape packages, you access it with the Packages object. For example, suppose you created your own package like "org.eID.client.Desktop" which uses a Java package contain various Java classes like XMLparser.java, WSClient.java, ConnectTOApplication.java and ect.. ect.. that it implements for my project. To create an instance of the ConnectTOApplication class in org.eID.client.Desktop, you access the constructor of the class as follows: var red = new Packages.org.eID.client.Desktop.ConnectTOApplication(); You can also access classes in the default package (that is, classes that don't explicitly name a package). For example, if the HelloWorld class is directly in the CLASSPATH and not in a package, you can access it as follows: var helloWorld = new Packages.HelloWorld(); The LiveConnect java, sun, and netscape objects provide shortcuts for commonly used Java packages. For example, you can use the following: var myName = new java.lang.String("My name is Subanu"); instead of the longer version you can use like this : var myName = new Packages.java.lang.String("My name is Subanu"); I think this would definitely help you to understand how we can use the the Packages Object in LiveConnect. Enjoy :)

Read these Articles :

0 comments:

Why Breeze

This is a new technological rhythm in the web. It blooms like a Breeze in your technological face with more than 75 technoligical atricles and guidences.

Contact Me
Contact Me Send an Email Facebook Account LinkedIn profile Twitter/Shayanth
Share And Save
Social Share with Twitter Facebook Share Add to Google Save on Delicious
Get Updates

The RSS will facilitate you to get the updates from Breeze. Click Here to redirect to the RSS link.

Designed by Posicionamiento Web | Bloggerized by GosuBlogger | Blue Business Blogger | Customized by SHAUOM