Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6986169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:46:28+00:00 2026-05-27T18:46:28+00:00

My java database applet program read the file from their current directory like FileInputStream

  • 0

My java database applet program read the file from their current directory like
FileInputStream fstream = new FileInputStream("details.txt");

When I run through appletviewer, it works but through browser, it doesn’t showing any output.
error :

Error: details.txt (The system cannot find the file specified)

I put this file in same directory.

My applet tag is :

<applet code="hack.database.MyApplet.class" archive="MyApplet.jar, ojdbc14.jar" height="800" width="1000">
</applet>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:46:28+00:00Added an answer on May 27, 2026 at 6:46 pm

    Naturally you can’t use a FileInputStream for this, FileInputStream is for reading files, and you can’t access the local file system in an unsigned applet. Your resources are available over the net, not as files. If your applet is signed, the code you’ve quoted will look for the “details.txt” file in the user’s current working directory in their file system, not necessarily the directory containing the class file.

    You can load resources from within the jar the applet class is in using Class#getResource to get a URL you can open, or using Class#getResourceAsStream to do it all in one. So for instance, this code within an instance method within an applet will open an InputStream to the “details.txt” file in the same directory in the jar as the applet class file:

    InputStream is = getClass().getResourceAsStream("details.txt");
    

    I know that works for resources within the jar. Whether it works for other resources on the same codebase I couldn’t say, I always bundle everything into the jar. See also this related question (and its answers).

    So two steps: Put the file in the jar, and use the code above to retrieve its contents.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've built a Lucene Directory implementation for jdbm , an embedded Java database. Part
I want to access a MySQL database from Java, but remote connection is disabled
I am running a java program that sets up a database connection to an
I am trying to connect my Java Applet to a MySQL Database. I know
I am new to java and database connections and I am trying to make
I have a java applet what has embeeded h2 database, and table with 200.000
I have a java applet that queries an Oracle database for data. When run
I have a Java Applet that is generating an image. Ultimately, I would like
I'm new to Java and even newer to java database connections. I've managed to
I know that Open Office Database uses a java database backend. Does anyone have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.