Win a copy of Kotlin for Android App Development this week in the Kotlin 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
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

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: 24089
54
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!