File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JNLP and Web Start and the fly likes Unable to Launch JWS A[pplication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Unable to Launch JWS A[pplication" Watch "Unable to Launch JWS A[pplication" New topic
Author

Unable to Launch JWS A[pplication

Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Hi All,

while Starting the JWS a Popup is coming saying that "Unable to Launch Application".

I am not able to determine that what is the problem.Please help me.

Thanks
Kushagra
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

There will be "Details" button on this dialog.
Click it to find what caused the launch to fail.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Hi,
I just remove that exception.
But the problem is now that the Swing page which I just want to open get close as soon as I select some files and click on open buton to process them.

Please suggest me if there is any solution.

Thanks
Kushagra
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41620
    
  55
Are there any messages or exceptions in the Java Console?

Just to make sure I understand: Your application has an "Open" button somewhere, and once you click that a file chooser pops up, and upon selecting a file in the file chooser the application quits? Is that what happens?
[ November 13, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Ya Exactly that is what is happening to my application. And I am not able to understand what wrong going on here.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

Originally posted by Kushagra Bindal:
Ya Exactly that is what is happening to my application. And I am not able to understand what wrong going on here.


How are you handling the file choose opening and processing?
Can you provide us the code?
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Ya sure.
Code is given below

Vector vectorFiles = new Vector();

Vector path = new Vector();
Vector fileNames = new Vector();
if(v==null){
path = new Vector();
fileNames = new Vector();
}
else{
Vector tempPath = (Vector)v.get(0);
Vector tempFile = (Vector)v.get(1);
for(int i=0;i<tempPath.size();i++){
path.add(tempPath.get(i));
fileNames.add(tempFile.get(i));
}
}
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setMultiSelectionEnabled(true);
int arr = chooser.showOpenDialog(new JFrame());
if (arr == JFileChooser.APPROVE_OPTION) {
selectedFiles = chooser.getSelectedFiles();
for(int i=0;i<selectedFiles.length;i++){
if(selectedFiles[i].isDirectory()){
strAllFiles = selectedFiles[i].list();
for(int j=0;j<strAllFiles.length;j++){
if(new File(selectedFiles[i]+"\\"+strAllFiles[j]).isFile()){
path.add(selectedFiles[i]+"\\"+strAllFiles[j]);
fileNames.add(strAllFiles[j]);
}//END Inner IF
}//END Inner FOR LOOP
}
else{
path.add(selectedFiles[i]);
fileNames.add(selectedFiles[i].getName());

}
}//End Outer For Loop
vectorFiles.add(path);
vectorFiles.add(fileNames);
}
return vectorFiles;


here the file selected will be send back and the path and file name will be stored in the vector

Please suggest me the way to solve the problem.

This code is working fine if I am running the code using main(String[] args) method.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10268
    
    8

I am unable to read and understand your code as it is not formatted. Can you please edit your existing post by using the CODE tags?
Thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41620
    
  55
Which is the last line of code to be executed before the application quits/crashes?
Kushagra Bindal
Ranch Hand

Joined: Oct 15, 2008
Posts: 156
Actually this code is called from another class and this code is just called to fetch the files. I am also mentioning the code which will call this method. The method that contain this code is browseFile().


public SampleMainFrame(PLMTDTO plmtDto, String url) {
this.plmtDto=plmtDto;
this.url=url;

JFrame myFrame = new JFrame();
myFrame.setSize(new Dimension(650,400));
myFrame.setLayout(new FlowLayout(FlowLayout.LEFT,2,5));
myFrame.setResizable(false);

/*Container container = this.getContentPane();
container.setLayout(new FlowLayout(FlowLayout.LEFT,2,5));
*/
/* Code to Add Images on the Panel */

LogoPanel logoPanel = new LogoPanel();
myFrame.add(logoPanel);
/* ******************************************************************** */
generateAttributeButton.setEnabled(false);

//Panel That Will Contain Browse Button Panel

BrowseFiles browse = new BrowseFiles();
vectorFiles = browse.browseFiles(vectorFiles);
if(vectorFiles!=null && vectorFiles.size()>0){
generateAttributeButton.setEnabled(true);
System.out.println("Size of Vector ++++ :"+vectorFiles.size());

path=(Vector)vectorFiles.get(0);
fileName=(Vector)vectorFiles.get(1);
//System.out.println("Size of Vector ++++ :"+fileName);

ColorPane colPane = browse.putFiles(fileName);
scrollPane.getViewport().add(colPane);
Vector newPathAndFiles = browse.findDocFiles(path, fileName);
docPath = (Vector)newPathAndFiles.get(0);
docFiles= (Vector)newPathAndFiles.get(1);
System.out.println("New Path :"+docPath.size());
System.out.println("New File :"+docFiles.size());







//Panel Contains Selected Files

JPanel selectedFilesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT,2,2));
selectedFilesPanel.setPreferredSize(new Dimension(175,229));
selectedFilesPanel.setBackground(new Color(214, 212, 213));


JLabel lblSelectedFiles = new JLabel("Following Files are selected:");
lblSelectedFiles.setFont(new Font("Verdana", 1, 10));

scrollPane.setBackground(new Color(250,250,250));
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
scrollPane.setPreferredSize(new Dimension(173,210));

selectedFilesPanel.add(lblSelectedFiles);
selectedFilesPanel.add(scrollPane);


JPanel panel3 = new JPanel();
panel3.setPreferredSize(new Dimension(1,229));
panel3.setBackground(new Color(94,68,133));

//JPanel mainpanel = new JPanel(new FlowLayout(FlowLayout.LEFT,6,6));
mainpanel.setPreferredSize(new Dimension(410,229));
mainpanel.setVisible(false);

//JPanel filedetails = new JPanel(new FlowLayout(FlowLayout.LEFT,4,4));
filedetails.setPreferredSize(new Dimension(200,140));


JPanel filenamedetails = new JPanel(new FlowLayout(FlowLayout.LEFT,6,6));
JLabel filename = new JLabel("File Name:");
filename.setFont(new Font("Verdana", 1, 10));
name.setFont(new Font("Verdana", 0, 9));
filenamedetails.add(name);

JPanel fileWordCountDetails = new JPanel(new FlowLayout(FlowLayout.LEFT,6,6));
JLabel fileWordCount = new JLabel("Width:");
fileWordCount.setFont(new Font("Verdana", 1, 10));
wordCount.setFont(new Font("Verdana", 0, 9));
fileWordCountDetails.add(wordCount);

filedetails.add(filenamedetails);
filedetails.add(fileWordCountDetails);
mainpanel.add(filedetails);

JPanel hzline = new JPanel();
hzline.setPreferredSize(new Dimension(588,1));
hzline.setBackground(new Color(94,68,133));

myFrame.add(selectedFilesPanel);
myFrame.add(panel3);
myFrame.add(mainpanel);
myFrame.add(hzline);


//Code to Display Buttons

panelButtons.setBackground(new Color(255, 255, 255 ));
panelButtons.setPreferredSize(new Dimension(588,40));
String htmlText = "<html><p><font color=\"#FFFFFF\" " + "size=\"2\" face=\"Verdana\">Process</font> </p> </em></font></html>";
String htmlText1 = "<html><p><font color=\"#FFFFFF\" " + "size=\"2\" face=\"Verdana\">close</font> </p> </em></font></html>";
String htmlText3 = "<html><p><font color=\"#FFFFFF\" " + "size=\"2\" face=\"Verdana\">finish</font> </p> </em></font></html>";


generateAttributeButton.setBackground(new Color(130,166,202));
generateAttributeButton.setPreferredSize(new Dimension(150,20));
generateAttributeButton.setToolTipText("Process");
generateAttributeButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
generateAttributeButton.setEnabled(false);
mainpanel.setVisible(true);
new Thread(runnable).start();
}

});

JButton closeButton = new JButton(htmlText1);
closeButton.setBackground(new Color(130,166,202));
closeButton.setPreferredSize(new Dimension(75,20));
closeButton.setToolTipText("close application");
closeButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});

panelButtons.add(generateAttributeButton);
panelButtons.add(closeButton);
//ButtonPanel panelButtons = new ButtonPanel();

JButton finishButton = new JButton(htmlText3);
finishButton.setBackground(new Color(130,166,202));
finishButton.setPreferredSize(new Dimension(75,20));
finishButton.setToolTipText("close application");
finishButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
sendFinish(SampleMainFrame.this.plmtDto, SampleMainFrame.this.url);
System.exit(0);
}
});
finishButtons.add(finishButton);
finishButtons.setVisible(false);
JPanel hzline1 = new JPanel();
hzline1.setPreferredSize(new Dimension(420,1));
hzline1.setBackground(new Color(94,68,133));
mainpanel.add(hzline1);
//mainpanel.add(finishButtons);


//Progress Bar

progressbarpanel.setPreferredSize(new Dimension(420,60));
JPanel currentprogressbarpanel = new JPanel(new FlowLayout(FlowLayout.LEFT,0,6));
currentprogressbarpanel.setPreferredSize(new Dimension(420,30));
JLabel currentfile = new JLabel("Current File ");
currentfile.setFont(new Font("Verdana", 0, 10));
currentprogressBar.setPreferredSize(new Dimension(175,10));
currentprogressBar.setForeground(new Color(130,166,202));
currentprogressBar.setBackground(new Color(255,255,255));
currentprogressBar.setFont(new Font("Verdana", 0, 9));
currentprogressBar.setValue(0);
currentprogressBar.setStringPainted(false);
currentprogressBar.setBorderPainted(true);
currentprogressbarpanel.add(currentfile);
currentprogressbarpanel.add(currentprogressBar);
//currentprogressbarpanel.add(name);

JPanel totalprogressbarpanel = new JPanel(new FlowLayout(FlowLayout.LEFT,0,4));
totalprogressbarpanel.setPreferredSize(new Dimension(420,30));
JLabel totalfile = new JLabel("Total Files ");
totalfile.setFont(new Font("Verdana", 0, 10));
filenumberdetails.setFont(new Font("Verdana", 1, 10));
totalprogressBar.setPreferredSize(new Dimension(175,10));
totalprogressBar.setForeground(new Color(130,166,202));
totalprogressBar.setBackground(new Color(255,255,255));
totalprogressBar.setFont(new Font("Verdana", 0, 9));
totalprogressBar.setValue(0);
totalprogressBar.setStringPainted(false);
totalprogressBar.setBorderPainted(true);
totalprogressbarpanel.add(totalfile);
totalprogressbarpanel.add(totalprogressBar);
totalprogressbarpanel.add(filenumberdetails);

progressbarpanel.add(currentprogressbarpanel);
progressbarpanel.add(totalprogressbarpanel);

mainpanel.add(progressbarpanel);

plmtDto.setFileName(fileNames);

myFrame.add(panelButtons);
myFrame.add(finishButtons);


//myFrame.setDefaultCloseOperation(EXIT_ON_CLOSE);
myFrame.setVisible(true);
}
}




And the last line which will get print is System.out.println("New File :"+docFiles.size());
this SOP.


Thanks
Kushagra
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

You have several instances of this line of code:

If one of them were executed then the result would be exactly what you are complaining about, no?

However your code isn't indented so I can't tell whether any of them are likely to be executed at any particular time. It would be helpful if you would edit your code and enclose it in the [CODE] tags. And then indent it in the normal way so it isn't just a big lump of Java.
 
 
subject: Unable to Launch JWS A[pplication