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 7073219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:54:11+00:00 2026-05-28T05:54:11+00:00

I am working on a collaborative project in Java, and thought it would be

  • 0

I am working on a collaborative project in Java, and thought it would be easiest to have it as an applet embedded in a webpage, and then everyone can add their child classes (of bonuses, enemies, etc) as they make them into the respective folders. And to make this work, I wanted the applet to check the folders on the website, gather the names of the files in each folder, and then put those names of the classes into an array as they’d each be randomly generated from this.

I originally tried making a File object and calling .listFiles() to get it into an array, but the file object would not recognize the path I gave it, getCodeBase().toString()+"bonus.txt", so I tried just putting the names of all of the classes that would be in a folder in a .txt file, opening the file, and just reading each line. This would work in eclipse, but when I uploaded the .class and .txt files to the website, I got a permissions error, so i put the class into a .jar, self signed it and uploaded it again but the applet would not work, it just froze.
Any time I did not have a file retreval statement, in or out of a .jar, the applet would work just fine, but if I had those lines of code it would freeze or give an error.

I’ve tried new scanner(new file("bonus.txt"));
different variations of buffered readers found through google of similar issues, as well as different ways of loading the address through File class, but none of them have worked.

All I have been trying to get the applet to do this far is just load a .txt file (in the same directory as the .class file), read the contents and print them in the applet, with no success. Much appreciated if you could point me in the right direction.

  • 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-28T05:54:12+00:00Added an answer on May 28, 2026 at 5:54 am

    A File established by a (trusted) applet will point to a location on the file-system of the end user’s computer (which probably will not exist). File objects can never point back to the server, that is not how they work.

    To access resources from an applet, you would generally use an URL instead. E.G.

    URL urlToList = new URL(getCodeBase(), "bonus.txt");
    Scanner scanner = new Scanner(urlToList.openStream());
    

    Note that neither of those lines would require the applet to be signed/trusted.

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

Sidebar

Related Questions

Working on a project at the moment and we have to implement soft deletion
Working on a project that parses a log of events, and then updates a
I shall be working with my classmates over a Flex project, and we would
I'm working on a large collaborative C++ project that is both developed and run
I'm working on a web project, where a user can share his screen and
I'm working on a project that is hosted on Bitbucket. I would also like
I am working on designing a collaborative system where multiple users can edit the
I'm working on a project constructing an online collaboration tool. Looking at Wikipedia, I
I am working on a solo project, writing all code myself so no collaboration
I'm about to begin working on a collaborative effort with another vendor. The vendor

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.