Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 24374
55
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.
 
Hey cool! They got a blimp! But I have a tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!