Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Error using FileInputStream  RSS feed

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,

I am experiencing the following problem:

I have a Java program that receives a binary file. This file is received in a parameter from a JavaScript program (Applet). I need to read this file with FileInputStream. But at that moment is occurring an error. I do not know what kind of error can be.

Can anyone help me?

Below the code:

public class InJava extends Applet {
String parameter;

public void sayHello () {
parameter = getParameter ("parameter");
java.io.FileInputStream fis = null;
try {fis = new java.io.FileInputStream (parameter); //<-- HERE IS OCCURRING THE ERROR!!!
}
Catch (Exception e) {
return;
}
 
Sheriff
Posts: 23873
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Fernando Skackauskas wrote:I have a Java program that receives a binary file. This file is received in a parameter from a JavaScript program (Applet). I need to read this file with FileInputStream.



I don't think that can be right. Are you receiving the name of the file only? And if so, is it really supposed to be the name of a file on the server? How should the person using the client computer know the names of files on the server? And more importantly, why should the client be able to change them?

If you're trying to do a file upload, then just passing the name of the file isn't the way to do it.

And the error is occuring in an applet? Then open the applet console to see the stack trace.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!