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

  • Home
  • SEARCH
  • 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 7012447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:15:26+00:00 2026-05-27T22:15:26+00:00

System.out.println(READ); String currentWorldName = RANDOM; String propertiesFileDirectory = propertiesFolder + currentWorldName + /props.properties; String

  • 0
    System.out.println("READ");

    String currentWorldName = "RANDOM";
    String propertiesFileDirectory = propertiesFolder + currentWorldName + "/props.properties";
    String entitiesFolderDirectory = propertiesFolder + currentWorldName + "/Entities";

    try 
    {
        properties.load(new FileInputStream(propertiesFileDirectory));
    } 

    catch (FileNotFoundException e)
    {
        //Since it doesn't exist either it was deleted by the user or hasn't been created yet.
        createNewPropertiesFile();
    } 

    catch (IOException e) 
    {
        outputToLog("IOException when loading properties file for the world: '" + currentWorldName + "'.\n" + e.getStackTrace().toString());
    }

    //getting values from properties

    //Now to read each properties file in Entities
    File entitiesFolder = new File(entitiesFolderDirectory);

    try 
    {
        List<String> entitiesDirectoryContents = Arrays.asList(entitiesFolder.list());

        //Read each file in the entities directory and load it into memory.
        for (String entityPropertiesFileName : entitiesDirectoryContents)
        {
            if (propertiesBelongsToEntityCH(entityPropertiesFileName))
            {
                                 //Get properties one way
            }

            else //The properties file we're working does not belong to CH.
            {
                //Get properties from the same file a different way
            }
        }
               //This should never be hit since we have the file to read.
    catch (FileNotFoundException e) 
    {
        outputToLog("FileNotFoundException when loading entity properties file." + e.getMessage().toString());
    } 

    //I don't know when/if this would be hit. It hasn't happened.
    catch (IOException e) 
    {
        outputToLog("IOException when loading entity properties file." + e.getMessage().toString());
    }

    catch (NullPointerException e)
     {
          entitiesFolder.mkdirs();
     }

This HAS been working, I swear. It just started doing this.
Java keeps claiming that the “entitiesFolder” directory doesn’t exist (I check with entitiesFolder.exists()). I have a solution for when that happens as you can see, because while my program is running it definitely can happen. Well it still claims that the folder doesn’t exist, over and over.

I’m absolutely positive that it’s the right directory because I print the “entitiesFolderDirectory” out to the console. It’s correct. I can also be looking at the files inside of that folder and when mkdirs() runs it just deletes them all.

Java bug? This has completely broken my program.

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

    I would write it without throwing a NullPointerException.

    File entitiesFolder = new File(entitiesFolderDirectory);
    entitiesFolder.mkdirs();
    for (String entityPropertiesFileName : entitiesFolder.list()) {
         //Do stuff
    }
    

    This will always work unless the folder could not be created.

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

Sidebar

Related Questions

What is the nicest way to read the output (i.e. via System.out.println) of a
This code: System.out.println(String.format(%f, Math.PI)); System.out.println(Math.PI); produces that result on my computer: 3,141593 3.141592653589793 Why
String input = txtInput.getText(); char[] charArray = input.toCharArray(); char[] flipArray = null; System.out.println(charArray.length); for
System.out.println( Arrays.deepToString( abc<def>ghi.split((?:<)|(?:>)) ) ); This prints [abc, def, ghi] , as if I
System.out.println(matcher.group(1)); System.out.println(matcher.group()); I like to know what's the difference between the above two codes.
class A { void F() { System.out.println(a); }} class B extends A { void
Object o = new Long[0] System.out.println( o.getClass().isArray() ) System.out.println( o.getClass().getName() ) Class ofArray =
public abstract class Master { public void printForAllMethodsInSubClass() { System.out.println (Printing before subclass method
public class Animal { public void eat() { System.out.println("I eat like a generic Animal.");
The output of the fist System.out.println() is not same as the second System.out.println() What

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.