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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:46:32+00:00 2026-05-13T09:46:32+00:00

OK I have so much questions regarding my file sharing application that I don’t

  • 0

OK I have so much questions regarding my file sharing application that I don’t know where to start. My Java knowledge is very limited and I will be satisfied with any help you provide me.

That being said, here come the questions.

Firstly, I’m working on a user login method that needs to look sort of like this:

import java.io.File;
import java.util.ArrayList;


public class User {

    String username;
    String IPAdresa;

    public User(String username, String IPAdresa) {

         this.username = username.toLowerCase();
         this.IPAdresa = IPAdresa;

    }

    public void fileList() {

        ArrayList<String> list = new ArrayList<String>();

        File folder = new File("C:\\userfolder");

           File[] files = folder.listFiles();

           for (int i = 0; i < files.length; i++) {

                list.add(i, files[i].toString());

           }

    }
}

As you can see I have user class that contains parameters regarding user, such as username and IPAddress, and also fileList method that lists files from a certain folder and creates the arraylist containing those file names as strings.

The next thing I have to do is make a class or a method that provides search function to clients/users. For example, when users logs on to the application, he will want to search for a certain file and also he will provide the list of files from his shared folder to other users. The way I understood my menthor, the Request class needs to contain for each loops that are able to search within the users respective file lists. I’m not sure how to pull that off and I have a lot of problems regarding working with array lists.

This how it’s supposed to look like approximately: (I’m using sort of pseudo-code for this one so far)

public class RequestForFile {

    ArrayList list = new ArrayList();
    User user = new User("Slavisha","123.23.34.45");

    public RequestForFile() {
        list.add(user);
            foreach (User user in userlist) {
              foreach (String str in User.fileList()) {
                  if (str == request)
                  ...
              }
            }

    }

}

Next question:
How do users log in to Java application? I’ve been thinking about it all day and tried to get around it but I just failed. I don’t have GUI/Swing yet, hope to do it in the end.

I have 3 more classes that represent Client, Server and HandleClient.

As I said any contribution is welcome. I will be back with more questions for sure.
Thanks

  • 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-13T09:46:32+00:00Added an answer on May 13, 2026 at 9:46 am

    You’re asking too many questions in one question. One question concerns how your RequestForFile object knows which user it’s dealing with. That’s the log-in question. Suggest you raise that separately.

    Let’s assume for the moment that we know it’s Slavisha on that ipaddress who is asking. There’s quite a few problems here:

    1). What’s being asked for? RequestForFile() doesn’t take any parameter to say which file is being requested. So what’s the resposbility of RequestForFile()? is it suppsed to represent one request? Is it responsible for actually finding the file? Returning it?

    2). Your User.fileList() method doesn’t actually do anything useful. It doesn’t return anything, so on completion everything it has figured out it lost.

    3). Anyway, every user seems to be looking in the same folder: “C:\userfolder” did you intend to have a separate directory for each user.

    4). Looking through lists is probably not efficient, you need to read about Sets and Maps.

    I think you need a pretty detailed redesign. Your user class needs to answer questions such as “does this user have that file”. The REquest class needs to identify a particular User and ask it for the file. I’m not clear how you then intend to transfer the file from client to server.

    I should say that doing Client/Server programming as an early education exercise is pretty ambitious.

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

Sidebar

Related Questions

I know that similar questions have been asked before, but I am very much
I don't know much css or html, so I have a question about taking
I have some general questions regarding the java.util.zip library. What we basically do is
I want to make my own text file compression program. I don't know much
I have several questions regarding CI application design. Q. When creating a new form
I am very new to these issues, please help. I have two questions regarding
I know that there are similar questions to mine that have been answered, but
Let's assume that on a hard drive I have some very large data file
This post on SO answers most of the questions I have (much thanks to
I don't have much experience working with resultsets, but as ResultSet is an interface,

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.