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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:08:21+00:00 2026-06-01T17:08:21+00:00

I am just messing around with reading input files with java until I got

  • 0

I am just messing around with reading input files with java until I got stumped at the most basic of steps… finding the input file!

The input.txt file is in the same directory as my class file that is calling it yet eclipse still gives me an error that it cant be found:

“Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Unhandled exception type FileNotFoundException”

My code:

package pa;
import java.util.Scanner; 

public class Project {
 public static void main(String[] args) {
    java.io.File file = new java.io.File("input.txt");
    System.out.println(file.getAbsolutePath());
    Scanner input = new Scanner(file);
 }
}

input.txt is in the same package, same folder and everything. I’m confused 🙁

  • 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-01T17:08:22+00:00Added an answer on June 1, 2026 at 5:08 pm

    I don’t know about eclipse, but in netbeans the path doesn’t start from the package (folder) your class is in, but the root folder of your project. to find that file in netbeans, you would have to put new File("src/pa/input.txt").

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

Sidebar

Related Questions

In an effort to learn about synchronization via Java, I'm just messing around with
I'm just messing around with Visual Basic in Visual Studio 2010. Anyone know how
Im just messing around with Ruby on Rails and HTML. This question isn't about
I was just messing around to answer someone's question here on Stack Overflow, when
I am just messing around trying to make a game right now, but I
I am just messing around with an app that streams audio and I wanted
I'm just messing around learning about JavaScript and I wanted to change the color
I'm just messing around with a Ndk tutorial I found. The native code uses
Just by messing around a little it seems that the video stream is not
I was just messing around with templates, when I tried to do this: template<typename

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.