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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:10:05+00:00 2026-05-27T23:10:05+00:00

I am making an application where the user picks a file from: FilePicker.PickFile(filename) where

  • 0

I am making an application where the user picks a file from:

FilePicker.PickFile(filename)

where filename is a string.

In the method, it will translate into:

File file = new File(filename);

and nothing is wrong with that. Next, I do,

if(file.exists()){
    System.out.println(file.getName());
}
else{
    System.out.println("Fail.");
}

and this is where the problem begins. I want to get the name of the file, say “HELLO.txt,” but if filename is “hello.txt,” it still passes the file.exists() check, and file.getName() returns as “hello.txt,” not “HELLO.txt”. Is there a way, to return file.getName() as the case-sensitive version as “HELLO.txt?” Thanks!

An example:

HELLO.txt is the real file

FilePicker.PickFile("hello.txt");

OUTPUT:

hello.txt

  • 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-27T23:10:06+00:00Added an answer on May 27, 2026 at 11:10 pm

    When you are using Windows, which is case preserving (FAT32/NTFS/..), you can use file.getCanonicalFile().getName() to get the canonical name of the selected file.

    When you are using Linux or Android and you want to select a file based on a file name that does not necessarily match case, iterate through all files in the file’s directory (file.getParent()), and pick the one that .equalsIgnoreCase the filename. Or see Case-insensitive File.equals on case-sensitive file system

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

Sidebar

Related Questions

I am making a application that the user will have to interact with one
I'm making a windows application where user selects a type from combo box. Based
HI am making a application in which the the user enter data into text
I am making an application in which I am taking some information from user
Hi guys i am making an application for iPhone that will allow user to
Starting from the top, I am making an application that in the new project
I am making an application in which user will be making gestures on screens
I'm wondering how i would go about making the following application: a user signs
I am making an application which is a user interface to access 2 types
I'm making a small tool application that user can minimize in the taskbar .

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.