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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:40:37+00:00 2026-06-11T12:40:37+00:00

My java program keeps thinking that every new file is not a file but

  • 0

My java program keeps thinking that every new file is not a file but a folder.

I have been bug hunting and now it will not let me save a file using FileWriter. If I create a new File, and then check if it is a file or a directory, it says it is a directory.

I originally had a long path that was created, so I got rid of that. I also used to have the writing done in a separate thread, and got rid of that as well, but still the problem persists.

If I create a new class, with just a simple

java.io.File file = new java.io.File("test.csv");
output.print(file.isDirectory());

This comes out as true.

I can however still save graphics using javax.imageio.*

Can anyone help?

Edit: I am using eclispe 3.7.2 with java 1.7.0…
File.isFile() is false, File.createNewFile() fails (java.io.FileNotFoundException (Access is Denied)). When looking in the directory I specify, there is a new folder there called test.csv. So it is creating a new folder, and is treating it as a folder, despite the fact that I am specifying it is a csv file. I have tried other file types, even no file type. But the same problem. It thinks it is a folder and not a file. This is just baffling me.

  • 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-06-11T12:40:38+00:00Added an answer on June 11, 2026 at 12:40 pm

    Java’s new File() does NOT create files or directories by itself. So you should show your code that does. I suspect that you have something like file.mkdirs(); somewhere – if your file is referring to “test.csv” at this point it will create a directory called “test.csv”

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

Sidebar

Related Questions

I have a small Java program that reads list of IPs from text file
In a java program, I create a file with File temp = new File(temp);
I have a java program that performs 5 different tasks. When I run the
I have developed a Java program that will count the number of files in
I am somewhat new to JAVA. I've been working with it in college, but
I have a batch file which calls a java program. The output is redirected
I have a Java program which depends on a native library that crashes randomly
I have a Java program that runs on Linux and telnets into a remote
I have a Big O notation question. Say I have a Java program that
I have tried to narrow this down a bit but my program keeps on

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.