• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error using FileInputStream

 
Fernando Skackauskas
Ranch Hand
Posts: 68
  • 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;
}
 
Paul Clapham
Sheriff
Posts: 21969
36
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!