This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Error using FileInputStream

 
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;
}
 
Marshal
Posts: 25818
69
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.
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic