File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JNLP I am getting the File Not found exception

 
srilatha nimmaneni
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI

I am new to JNLP
can any body help why i am getting this exception
 
srilatha nimmaneni
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
srilatha nimmaneni wrote:HI

I am new to JNLP
can any body help why i am getting this exception




this is the code i am writing while reading the normal text file this i am getting FileNotFoundException
BufferedReader br = new BufferedReader(new FileReader("C://FlashCardsData.ser"));

java.io.FileNotFoundException: http://localhost/MyJWS/MyQuiz.jnlp
at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source)
at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: http://localhost/MyJWS/MyQuiz.jnlp
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
... 18 more


can any tell me why iam getting this error, i am alredy jarsigned every thing correct only..
 
Paul Clapham
Sheriff
Pie
Posts: 20187
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
srilatha nimmaneni wrote:this is the code i am writing while reading the normal text file this i am getting FileNotFoundException
BufferedReader br = new BufferedReader(new FileReader("C://FlashCardsData.ser"));


Actually if you look at the stack trace more closely you should notice a couple of things about that:

(1) The "file" that can't be found isn't that file, it is http://localhost/MyJWS/MyQuiz.jnlp.

(2) The code that can't find the file isn't that code, it is something else entirely.

It's worth looking at the stack trace carefully, as it often provides more information than just the error message. In this case the message is that your application can't be launched because the URL http://localhost/MyJWS/MyQuiz.jnlp isn't responding. So check your server and make sure that it's running and that you have the correct URL.
 
srilatha nimmaneni
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wtiten this is java class

import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

public class FlashTest
{
JFrame frame1;
JTextArea txtA, txtQ;
JButton btnShowAns, btnNext;
JPanel panel1;
JScrollPane scroller1, scroller2;
ArrayList<String> strArray = new ArrayList<String>();
static int count = 0;
static int i = 0;

void buildGUI()
{
frame1 = new JFrame("Test Your Knowledge");

txtQ = new JTextArea(20, 30);
txtA = new JTextArea(20, 30);
txtQ.setLineWrap(true);
txtA.setLineWrap(true);
txtA.setVisible(false);
scroller1 = new JScrollPane(txtQ);
scroller2 = new JScrollPane(txtA);
//scroller1.add(txtQ);
//scroller2.add(txtA);
scroller1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroller1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scroller2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroller2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
btnShowAns = new JButton("Show Answer");
btnNext = new JButton("Next Question");
panel1 = new JPanel();
//panel1.add(txtQ);
//panel1.add(txtA);
panel1.add(scroller1);
panel1.add(scroller2);
panel1.add(btnShowAns);
panel1.add(btnNext);

frame1.getContentPane().add(panel1);
frame1.setSize(800, 570);
frame1.setVisible(true);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

btnShowAns.addActionListener(new ShowAnsListener());
btnNext.addActionListener(new NextListener());

try
{
BufferedReader br = new BufferedReader(new FileReader("FlashCardsData.ser"));

String line = null;
while((line = br.readLine())!=null)
{
String[] splitStrings = line.split("/");
for(String elt:splitStrings)
{
strArray.add(elt);
}
}
}
catch(Exception e)
{
System.out.println("Exception in buildGUI: " + e);
}

fillText();
}

void fillText()
{
i++;
if(i<(strArray.size()-2))
{
txtQ.setText((String) strArray.get(count));
txtA.setText((String) strArray.get(++count));
count++;

}
else
{
System.out.println("Sorry! No more data here!");
JOptionPane.showMessageDialog(null, "This is the last question.");
//JOptionPane.showOptionDialog(null, "Sorry!", "Create New");
}
}

void toggleButton()
{
if((btnShowAns.getText()).equals("Show Answer"))
{
btnShowAns.setText("Hide Answer");
txtA.setVisible(true);
}
else
{
btnShowAns.setText("Show Answer");
txtA.setVisible(false);
}
}

class ShowAnsListener implements ActionListener
{
public void actionPerformed(ActionEvent ae)
{
toggleButton();
}
}

class NextListener implements ActionListener
{
public void actionPerformed(ActionEvent ae)
{
try
{
toggleButton();
fillText();

}
catch(Exception e)
{
System.out.println("Exception in NextListener: " + e);
JOptionPane.showMessageDialog(null, "This is the last question.");
}
}
}

public static void main(String[] str)
{
FlashTest ft = new FlashTest();
ft.buildGUI();
}


}
 
srilatha nimmaneni
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="0.2 1.0"
codebase="http://localhost/MyJWS"
href="MyQuiz.jnlp">

<information>
<title>MyQuiz App</title>
<vendor>Me</vendor>
<homepage href="index.html"/>
<description>MyQuiz JWS App</description>

<offline-allowed/>
</information>

<resources>
<j2se version="1.3+"/>
<jar href="FlashTest.jar"/>
</resources>
<security><all-permissions/></security>


<application-desc main-class="FlashTest"/>
</jnlp>
 
srilatha nimmaneni
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html>
<body>
<center><br><a href="MyQuiz.jnlp">IDEA Launch Appln</a></center>
</body>
</html>
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic