Java Web Start Faq's - Techincal Questions

Do I need to change my application to work with Java Web Start?
If your application is written to the Java 2 platform, and is delivered as a set of

JAR files, there should be no need to revise your application. Make sure that your

application retrieves all its resources (such as images and resource bundles) from

a JAR file, since Java Web Start launches an application by invoking the public

static void main(String[] args) method.
If your application needs unrestricted access to the system, (for example,

network or disk access), you will need to sign your code.

Is there a migration path from applets to applications?
Java Web Start is primarily designed for application deployment. You specify all

requirements for your application in the JNLP file, and off you go. It does

provide the ability to launch applets in much the same way as the traditional

AppletViewer. The built-in AppletViewer provides an easy migration path for

existing applets that want to take advantage of Java Web Start. However, it is

not intended to be a full implementation of the Plug-In. The Plug-In is the primary

launching vehicle for applets. The built-in AppletViewer in Java Web Start has

limitations, for example, you cannot specify class files as resources and it does

not accept policy files.

Is there a way to pass VM arguments to the Java Runtime?
Java Web Start allows certain JVM flags to be set with the java-vm-args attribute

of the j2se element (see Developer's Guide). Allowing the complete set could

compromise security as well as limit portability across different platforms and

implementations. You can set the maximum and initial heap size using the initial

-heap-size and max-heap-size attributes of the j2se element, for example:


I don't want to rely on a server timestamp. How can I specify a versioned JAR

and how can I get incremental updates of JARs?
Java Web Start supports versioned JARs and incremental updates. You can

specify exact versions of the JAR files you want, instead of relying on timestamp

information to determine if an update is available. Using version IDs also allows

you to provide incremental updates from one version to another. See the JNLP

Specification or the
Developer's Guide for details.

Are JAR files shared between applications?
Each JAR file that a JNLP Client (such as Java Web Start) downloads, is uniquely

identified with a URL. If two JNLP files use the same URL, then the resource will

only be downloaded once and shared. This is similar to the caching

implementations used by web browsers.

How can I provide my own splash screen?
Java Web Start needs to put up the initial splash screen while Java is loading. For

subsequent access, you can specify an image file to use for the splash screen in

the JNLP file with the tag

where mysplash.jpg is the image file for your splash screen. The first time your

application runs, it will use the standard splash screen. After that, it will use the

image you provide.

How can I save the application state on the local system?
A sandboxed application can store state using the PersistenceService API. This

API is similar to cookies for HTML pages. Thus, it is a secure way to store

persistent information on the client computer. For more information, see:
 JNLP Specification
 Java Web Start Developers Guide

My application requires a specific version of the JRE. How do I specify this my

JNLP file?
The tag specifies a platform version, where versionNum is 1.2, 1.3, 1.4, or 1.5.
You can request a specific product version by including a vendor URL in the href

attribute. For Sun's JREs, the URL is http://java.sun.com/products/autodl/j2se

For example, the following J2SE tag will request any Sun 1.3.1 implementation:


You can see all the versions of the installed JREs in the Java tab of the Java

Control Panel.

Can I rely on Class-Path in the manifest file?
Java Web Start does not support the Class-Path entry in the manifest file. The

Class-Path attribute is entirely file-centric, whereas Java Web Start and JNLP is

web-centric, i.e., based on URLs. Thus, the two models do not merge easily.
Instead of relying on the Class-Path entry, you can list multiple JAR files in the

JNLP file, for example:




In a JNLP file, you can factor out dependencies on a set of JAR files to another

JNLP file using the element. Thus, you can achieve the same kind of re-usability

and ease of maintenance as you do with the Class-Path entry. This feature is

described in the specification.
JNLP also implements a just-in-time downloading mechanism, similar to applets.

For each resource in a JNLP file, you can specify which parts should be eagerly

or lazily downloaded. Eagerly loaded resources are loaded before the application

is launched, lazily loaded resources later. Default is eager download.

Furthermore, the specification includes an API for which you can programatically

query Java Web Start about which resources are available and request them to be

downloaded. Thus, you can write download/network aware applications.
See the JNLP specification for more information.

Can I use Java Web Start even if my application depends on or uses native code?
You can use Java Web Start to deploy Java Technology-based applications that

depend on native code such as DLLs and SOs. Use the element to specify required

native libraries. See the Developer's Guide for details.

How can I load resources within my application using Class.forName and

ClassLoader.getSystemClassLoader?
Java Web Start uses a user-level classloader to load all the application resources

specified in the JNLP file.

This classloader implements the security model and the downloading model

defined by the JNLP specification. This is no different than how the AppletViewer

or the Java Plug-In works.
This has the, unfortunate, side-effect that Class.forName will not find any

resources that are defined in the JNLP file. The same is true for looking up

resources and classes using the system class loader

(ClassLoader.getSystemClassLoader).
To find application resources in Java Web Start, use the classloader that loaded

your application, for example use the following call in the in the application;s

main thread:
this.getClass().getClassLoader();
You can also use:
Thread.getCurrent().getContextClassLoader();

How can I launch Java Web Start from the command line?
You can launch Java Web Start from the command line as follows:
javaws [options] your-app-JNLP-URL
where your-app-JNLP-URL is the location of your application's JNLP file. For

example:
javaws http://java.sun.com/products/javawebstart/apps/swingset2.jnlp
For complete command line syntax see: the Developer's Guide

How do I use multiple JAR files signed by different certificates?
The JNLP 1.0 specification requires all JAR files used in a JNLP file to be signed

by the same certificate. This restriction avoids requiring the user to accept

multiple certificates from the same source, and enables Java Web Start to know

if the user has accepted all certificates used for an application.
However, Java Web Start can use multiple JAR files signed by different

certificates, by using the component extension mechanism and multiple JNLP

files. The only requirement is that the JAR files contain code from different

packages. So, instead of the following:

Java Web Start Faq's - General Questions

What is Java Web Start?
Java Web Start provides a platform-independent, secure, and robust deployment technology. It enables developers to deploy full-featured applications to end-users by making the applications available on a standard web server. With any web browser, end-users can launch the applications and be confident they always have the most-recent version.

Where do I get more information?
Look at the online documentation for Java Web Start .
If you are a developer, go to the Developer's Guide for detailed technical information on how to deploy applications using Java Web Start.

Why should I use Java Web Start?
It's an easy, robust, and secure way to deploy applications directly from the web. Developers can make applications readily available via the web. In addition, Java Web Start provides Java runtime environment (JRE) management capabilities, it's easy to set up, it's browser-independent, and it's an efficient way to deploy web application solutions.
Users can easily access applications much as they would a web page--without a separate installation step. From the desktop, users can access and use Java applications, using a richer and more responsive user interface than is available on a web page. And, once a Java Web Start based application is installed, users simply click to run the application whenever needed.
Users do not need to manually update applications because each time they launch an application, it is transparently updated from the web--so they always use the most recent version available.

How can I launch applications with Java Web Start?
You initially launch a new application by clicking on a link from a web page.
If you use an application frequently, create a shortcut from your desktop or from the Start Menu by allowing Java Web Start to place an icon on your desktop. Java Web Start may ask if you would like to create
shortcuts or an entry in the Start Menu. If you say "yes," all future launches of the application can start without a browser.
Java Web Start also provides an Application Cache Viewer which you can launch from the Java Control Panel. The Cache Viewer enables you to directly launch applications you have downloaded.
You can also launch an application from a command prompt by typing “javaws ” where
Does it matter how I launch an application?
No, applications launch in the same manner no matter which method you use: from a web page, from the shortcut on the desktop, from the Start menu, or through the Java Application Cache Viewer.
Java Web Start always checks to see if a newer version of the application is available for use and automatically downloads it if so.
If the application you are using has not been digitally signed, Java Web Start will launch it in a restricted and secure execution environment. An application that is not signed, or one that you do not trust, will never be run with unrestricted access to your local system or network.

What are the system requirements for Java Web Start?
Any client system that supports the Java version 1.2.2 or higher can use Java Web Start. Java Web Start works with virtually all browsers.

What platforms does Java Web Start run on?
Sun Microsystems provides versions for Windows 98/NT/2000/XP/2003, Solaris Operating Environment (SPARC and Intel editions) and Linux/i486. Apple provides a version for their OS X release.

What are the server requirements for Java Web Start?
Java Web Start uses HTTP for communication between the client and the server. You can use a standard web server to host an application. If you require additional services, such as version-based downloading, incremental updates, or pack200 compression for your applications, the web server will need to support servlets or Java Server Pages. A sample servlet implementing these features is provided in the samples directory of the JDK.

Is Java Web Start based on a standard?
Yes. Java Web Start 1.5.0 is the product-quality reference implementation of Java Network Launching Protocol (JNLP) technology, which was developed through the Java Community Process. JNLP is specification number JSR 056. Other platform vendors are encouraged to port Java Web Start to their platform or implement the specification.
For more information, see the JNLP specification.

Can I implement my own Java Web Start?
The underlying technology for Java Web Start, the Java Network Launching Protocol and API is being developed through the Java Community Process, so you can implement this protocol in any product. However additional licensing and terms must be met to implement any JCP technology including the JNLP technology.

What are the supported browsers?
Java Web Start supports primarily Internet Explorer 4 or higher and Mozilla. However any browser can launch JNLP files if you have set the MIME-type association correctly. Java Web Start uses the browser's settings and may launch a browser to show a URL; this feature may not work with unsupported browsers.

Is there a comprehensive list of online resources for Java Web Start?
 Java Web Start documentation page: http://java.sun.com/j2se/1.5.0/docs/guide/javaws/index.html
 Developer's Guide: http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/contents.html
 Java Web Start Discussion Forums: http://forum.java.sun.com/forum.jsp?forum=38
 JSR-56: http://jcp.org/en/jsr/detail?id=56

Can I deploy any application with Java Web Start?
Java Web Start is an application launcher for Java applications that are written to be web-deployed.
An application must be delivered in a set of JAR files and all application resources, such as images, configuration files, and native libraries must be included in the JAR files. The resources must be looked up using the method ClassLoader.getResource() or an equivalent method. Java Web Start only transfers JAR files from the web server to the client.
If an application is written to run in a restricted execution environment (sandbox), then access to disk is not permitted and the application may only connect to the host on which it resides.

Is Java Web Start a software distribution mechanism like Marimba and MS SMS?
Java Web Start is an application launcher for Java applications. It allows easy distribution of full-featured applications based on the Java platform from a web server to a client machine with minimal user interaction.
The software distribution technology is only one aspect of Java Web Start. It also provides security, updates to the applications, ease-of-use for end users, and flexibility for developers when they create the applications.

Is Java Web Start an application installer?
Java Web Start is an application launcher for Java applications that are written to be web-deployed. Java Web Start caches resources locally on the disk, but also provides a secure execution environment and a virtually transparent updating facility for applications. The end user does not need to manually initiate a software update because the application is updated each time it is used.

What version of the Java platform does Java Web Start work with?
Java Web Start launches only applications written for the Java platform versions 1.2.2 and higher.

How does Java Web Start relate to Java Plug-in Technology (applets)?
The two approaches are very similar. The key difference is in the user experience. If the Java application/applet needs to interact with a web page and be tightly bound to a web browser, then applets may be the solution. On the other hand, if browser independence is important, then Java Web Start is the deployment platform of choice. There are a number of other differences, but this is the fundamental difference.
Java Plug-in technology enables users to run Java applets inside a browser.
Java Web Start enables users to download full-featured applications with any browser. Once they have downloaded and launched an application, the browser can be closed, while the application continues working. The application does not depend on an open browser to function. The browser can be shut down or you can go to a different web page and the application will continue running.

J2EE Important notes

· First write the Session bean.: No need to write the session bean home and remote as they are provided by lead.

· Then prepare Meta-Inf folder in same folder as that of .java file.

· Prepare ejb-jar.xml in meat-inf:

PDMController

com.lti.lead.ejb.business.LFIControllerHome //This is lead provided remote and home interface

com.lti.lead.ejb.business.LFIControllerRemote

com.fso.business.pdm.CPDMController

Stateless

Container

PDMController

Remote

*

Required

· Then prepare weblogic-ejb-jar.xml file in meta-inf

PDMController //This is the name as mentioned in the ejb-jar.xml

10

com.fso.business.pdm.CPDMController //This is used in the ServerTaskManager

· Now from the current directory run

javac -d .*.java //This will create class file with full package structure with the .class file

jar -cvf0

jar –cvf0 pdmController.jar *.java META-INF

java weblogic.ejbc pdmController.jar pdmControllerBean.jar

Then deploy this bean using the console of the weblogic.

Put the class file of the controller in C:\Lead2.0\sampleapplication\LeadExample\WEB-INF\classes with complete folder structure as that of the package.

· Create the form handler servlet and put the clas file in C:\Lead2.0\sampleapplication\LeadExample\WEB-INF\classes with complete folder structure as that of the package.

· In web.xml of C:\Lead2.0\sampleapplication\LeadExample\WEB-INF put following for formhandler

CPDMFormHandler

com.fso.forms.pdm.CPDMFormHandler

CPDMFormHandler

/CPDMFormHandler

In Each request ID for that form handler must be here else parameter ot defined IPE0001 exception.

LFCRequestProcessor

com.lti.lead.server.util.LFCRequestProcessor

REQPDM0001

CPDMFormHandler //This is url pattern.

i.e.

· In the html invoking the request

· In response map

TEMPLATE="examplegui/leadtry.jsp" CHANGEABLE="N">

· In leadtry.jsp

examplegui/output.xsl" flgDOM="LF_CURRENT_DOM"/>

This out put XSL for the request.

· In TaskManager, this is for the form handler.

The request ID as given in input.html The response ID as mentioned in response map. The command ID is used in formhandler’s process() switch case, controller execute() switch case. And in task manager.

· In server task manager for Controller.

suhas

com.fso.business.pdm.CPDMController //This is the controller name as mentioned in weblogic-ejb-jar.xml

localhost

7001


· Entity bean:

3files + ejb-jar.xml, weblogic-cmp-rdbms-jar.xml, weblogic-ejb-jar.xml

· ejb-jar.xml

containerManaged

com.fso.data.pdm.IPDMHome

com.fso.data.pdm.IPDMRemote

com.fso.data.pdm.CPDMEntityBean

Container

com.fso.data.pdm.ProductPK

False

m_strProdId //This is the name of the variables used in entity bean.

m_strProdName

m_dPrice

m_strUOM

containerManaged

Remote

*

Required

· weblogic-cmp-rdbms-jar.xml

'-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB RDBMS Persistence//EN'

'http://www.bea.com/servers/wls510/dtd/weblogic-rdbms-persistence.dtd'>

samplePool //This pool should be defined in the config.xml of weblogic.

Product_Master //Name of the table to be accessed.

m_strProdId //Name of variable in Entity bean

productID //Name of table field

m_strProdName

productName

m_dPrice

price

m_strUOM

UOM

findByProdName

java.lang.String

false

· weblogic-ejb-jar.xml

containerManaged

1000

isModified

WebLogic_CMP_RDBMS

5.1.0

META-INF/weblogic-cmp-rdbms-jar.xml

WebLogic_CMP_RDBMS

5.1.0

com.fso.data.pdm.IPDMHome //This name is used to find the home interface in the controller for lookup using context object.


Deploying EJB.

put the 3 xmls in Meta-inf.

Then run the three commands as that of session bean to create deplayable jar, and deplay it using weblogic console.

This will produce following entry in config.xml of weblogic

If the path is wrong correct the path yourself by modifying this file.

The pool entry for the database is:

Name="samplePool"

Properties="user=wf;password=wf;dll=ocijdbc8;protocol=thin"

Targets="myserver" TestTableName="Product_Master" URL="jdbc:oracle:thin:@172.25.5.97:1521:SAMPLE"/>

· For this the tnsname.ors of the oracle/network/admin should have the entry

SAMPLE.LNTINFOTECH.COM =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 172.25.5.97)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = sample.lntinfotech.com)

)

)

This can be created using the net8 config assistant.

· If this does not work :

The winnt/System/drivers/etc/Hosts should have the entry of

172.25.5.97 selva.lntinfotech.com //name of the pc and domain name

Removing elements from STL Conatainers.

While removing a number of items from containers such as list and vectors, we should always remove them in reverse order.

If we start from the beginning, then after removing one element, the positions of the elements in the container will change and then the positions of the items to be removed will not match to the present elements in the container.

Thus always start removing in the reverse order.

e.g.

If there is a list of 10 elements.

You have to remove 4th, 6th and 9th element.

Now if you remove 4th element first, 6th element will now become 5th element. Now if you remove 6th element, it will not be the element you want to remove.

But if you start removing in the reverse order i.e. first remove the 9th element. Now the position of the 4th and 6th elements is not affected and thus can be easily removed.

While removing a number of elements from the list and vector always start deletion in the reverse order.

Interview Questions Collections

Object-Orientation Concepts, UML interview Questions

1. What is inheritance?

2. Difference between Composition and Aggregation.

3. Difference: Sequence Diagrams, Collaboration Diagrams.

4. Difference: 'uses', 'extends', 'includes'

5. What shall I go for Package Diagram?

6. What is Polymorphism?

7. Is class an Object? Is object a class?

8. Comment: C++ "includes" behavior and java "imports"

9. What do you mean by "Realization"?

10. What is a Presistent, Transient Object?

11. What is the use of Operator Overloading?

12. Does UML guarantee project success?

13. Difference: Activity Diagram and Sequence Diagram.

14. What is association?

15. How to resolve many to many relationship?

16. How do you represent static members and abstract classes in Class Diagram?

17. Can we use UML for user interface (UI) design?

18. Every object has : state, behavior and identity - explain

19. How to reverse engineer C++ code in UML?

20. What are the tools you used for OOAD?

21. Difference: Object Oriented Analysis (OOA) and Object Oriented Design (OOD)?

22. What are the four phases of the Unified Process ?

23. How do you convert uses cases into test cases?

24. Explain Class Diagram in Detail.

25. What are the Design Patterns you know.

26. When do you prefer to use composition than aggregation?

27. UML: IS it a process, method or notation?

28. Does a concept HAVE to become a class in Design?

29. What are the good practices to use while designing for reuse?

30. Can you think of some nice examples where *multiple* actors are associated with a use case ?

31. How to use CRC Cards for Class Design?

Java Interview Questions

1. Meaning - Abstract classes, abstract methods

2. Difference - Java,C++

3. Difference between == and equals method

4. Explain Java security model

5. Explain working of Java Virtual Machine (JVM)

6. Difference : Java Beans, Servlets

7. Difference : AWT, Swing

8. Disadvantages of Java

9. What is BYTE Code ?

10. What gives java it's "write once and run anywhere" nature?

11. Does Java have "goto"?

12. What is the meaning of "final" keyword?

13. Can I create final executable from Java?

14. Explain Garbage collection mechanism in Java

15. Why Java is not 100% pure object oriented language?

16. What are interfaces? or How to support multiple inhertance in Java?

17. How to use C++ code in Java Program?

18. Difference between "APPLET" and "APPLICATION"

Here is a listing of questions you can expect to face while taking an interview for a Java developer's position. (Answers)

1. What are the four corner stones of OOP ?

2. What do you understand by private, protected and public ?

3. Difference between a Class and an Object ?

4. What is Downcasting ?

5. What is Polymorphism ? What kinds ?

6. What is the difference between method overriding and overloading ?

7. What is the restriction on an Overridden methods’ accessibility ?

8. What is the concept of a Virtual Function ?

9. What is the implication of a Virtual Destructor ? Virtual Constructor ?

10. Can a method be overloaded based on different return type but same argument type ?

11. What is a "stateless" protocol ?

12. What happens to a static var that is defined within a method of a class ?

13. What is constructor chaining and how is it achieved in Java ?

14. How do you define a local inner class ?

15. How many static init can you have ?

16. What is passed by ref and what by value ?

17. How do you ensure size of a primitive data type ?

18. Describe the Garbage Collection process in Java ?

PERSONAL

These questions help the hiring authority determine what makes you tick. Answer thoroughly, using organic conversation techniques to determine if the direction of your answer is correct. Remember to stay positive.

What makes you unique?

Tell me about yourself.

What goals have you set for yourself? How are you planning to achieve them?

To what do you owe your present success?

What is your favorite hobby and tell me why?

What motivates you?

What type of work environment appeals to you most?

Are you willing to travel?

Why have you chosen this particular profession?

What do you like most about your current job?

What has been your greatest challenge?

What work experiences have been most valuable to you and why?

Tell me about a situation in which you were under tremendous pressure and how you dealt with it.

Give me an example of a time in your life in which you had to overcome great adversity to get the job done.

Tell me about your most difficult decision and how you went about making it.

Where do you think your interest in this career comes from?

Give me a situation in which you failed, and how you handled it.

PEOPLE SKILLS

These questions will be used to determine how you interact with others, both your team members and users. Show yourself as a team player who can take initiative and drive projects.

Have you ever supervised people?

What is your management style?

How do you interface with users?

How do you handle a customer or user who becomes irate?

What would your management say about you?

In this particular leadership role, what was your greatest challenge?

Describe the project or situation that best demonstrates your management/supervisory skills.

Tell me about a team project of which you are particularly proud and your contribution.

Have you taken/How do you take specifications from users?

Describe a situation where you had to work with someone who was difficult, how did you handle it?

Tell me about a problem you have with one of your work associates.

Which area of technical expertise do you feel is your strongest?

Describe the type of manager you prefer.

What are your team-player qualities? Give examples.

When you take on a project do you like to attack the project in a group or individually?

Tell me about your relationship with your previous boss.

How do you take direction?

WORK HABITS AND ANALYTICAL SKILLS

These questions will be used to determine not only your background experience and skills, but also your suitability for the discussed position. Don't be bashful. Thoroughly explain your background, experience and skills.

What accomplishments are you most proud of?

What part of the project life cycle have you worked on?

Describe the project or situation that best demonstrates your coding skills.

Describe the project or situation that best demonstrates your analytical abilities.

Give me an example of a problem you solved and the process you used.

Give me an example of an idea that has come to you and what you did with it.

Tell me about a project you initiated.

How have your educational and work experiences prepared you for this position?

What is your most significant accomplishment?

QUESTIONS THAT SET THE STAGE FOR SELLING YOURSELF

Use these questions to explore why you are the perfect candidate for the vacant spot. Match your strengths to the job requirements, point for point.

Why are you interested in our organization?

Give me an example of the most creative project that you have worked on.

What type of position are you seeking?

What makes you think you can handle this position?

Why should my company be interested in you?

What challenges are you looking for in a position?

What interests you about this job?

DANGER QUESTIONS

Be careful. The only reason to ask these questions is to determine why NOT to hire you. Make your answers as short and bland as possible. Remember not to disparage any past employers, companies or co-workers.

What turns you off at your current employer?

What pisses you off?

What interests you least about your current job?

What types of situations put you under pressure, and how do you deal with pressure?

What industry besides this one are you looking into?

With which other companies are you interviewing?