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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:45:33+00:00 2026-06-03T20:45:33+00:00

So here is my constructor for a library class package OOD_PROJECT_PACKAGE; import java.awt.Event; import

  • 0

So here is my constructor for a library class

          package OOD_PROJECT_PACKAGE;

import java.awt.Event;
import java.io.File;
import java.io.FileNotFoundException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Scanner;
import javax.swing.DefaultListModel;

import java.util.ArrayList;
import java.util.Date;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;


 public class Library {
 private ArrayList<Book> books = new ArrayList<Book>();
private ArrayList<Member> members = new ArrayList<Member>();
 private DefaultListModel mod1;
 //private DefaultListModel mod2;
private int nextValidId;
public Library(){
try {
    String fileName = "id.txt";
    Scanner in = new Scanner(new File(fileName));
    nextValidId = in.nextInt();

}
catch (FileNotFoundException e){
JOptionPane.showMessageDialog(null, "File not found");
//this wont happen,file will always be there

       }}

And i have a id.txt file in the source files.Yet it does not seem to be finding it and an expection occurs.I presume this has something to do with the fact the .txt does not have any form of package OOD_PROJECT_PACKAGE,so my library class cant see it.

How do i fix this?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-06-03T20:45:34+00:00Added an answer on June 3, 2026 at 8:45 pm

    If your project folder is H:/netbeans/OOD_PROJECT/ then you should put the id.txt in that folder, not H:/netbeans/OOD_PROJECT/src/.

    In case you’re planning on using the absolute path then the string should be: “H://netbeans//OOD_PROJECT//” or “H:\netbeans\OOD_PROJECT\” (I normally don’t pay attention to whether I used \ or / but both seems to work for me).

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

Sidebar

Related Questions

Here is the textbook standard way of describing a 'class' or constructor function in
Look here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx It says: (1) Do not define public or
Microsoft shows how to create a dynamic class here: http://msdn.microsoft.com/en-us/library/system.reflection.emit.modulebuilder(v=vs.71).aspx This defines a custom
I am writing a game engine/library in which I have an event dispatcher class
I've created some UserControl. Here is its constructor: public ZoomableChart() { InitializeComponent(); this.mainChart =
Here is my problem: Create a constructor for a telephone number given a string
I was wondering about the last constructor for std::string mentioned here . It says:
I know that you can't have a constructor in an interface, but here is
I do not seem to understand how to catch constructor exception. Here is relevant
I'm trying to access a field of a constructor from a nested function. Here

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.