Okay, I'm within a method that's being called from the main method. Don't worry about the HashSet stuff, I'm just trying to get this thing to read from a file.
public static void writeFileToHashTable(HashSet names, String inputFilePath) throws FileNotFoundException
{
File inputFile = new File(inputFilePath);
Scanner in = new Scanner(inputFile);
while (in.hasNext())
{
String test = in.next();
System.out.println(test);
}
in.close();
}
I know the filepath is working properly, because I've doublechecked the filepath and also it would throw the FileNotFound Exception if the filepath was wrong. I know there's content in the .txt file it's reading from. I can't figure out why the damn thing won't print anything. Am I missing something obvious?
My java knowledge is spotty, but are you set up to catch the exception if it's thrown, or would your IDE notify you of it regardless?
kedinik on
I made a game! Hotline Maui. Requires mouse and keyboard.
0
Options
ChanusHarbinger of the Spicy Rooster ApocalypseThe Flames of a Thousand Collapsed StarsRegistered Userregular
Okay, I'm within a method that's being called from the main method. Don't worry about the HashSet stuff, I'm just trying to get this thing to read from a file.
public static void writeFileToHashTable(HashSet names, String inputFilePath) throws FileNotFoundException
{
File inputFile = new File(inputFilePath);
Scanner in = new Scanner(inputFile);
while (in.hasNext())
{
String test = in.next();
System.out.println(test);
}
in.close();
}
I know the filepath is working properly, because I've doublechecked the filepath and also it would throw the FileNotFound Exception if the filepath was wrong. I know there's content in the .txt file it's reading from. I can't figure out why the damn thing won't print anything. Am I missing something obvious?
System.out.println prints to the terminal, I think. I think printing to a file is a different thing like PrintWriter I think it's called
Oh yeah, I'm trying to print to the terminal, just so I can immediately see what's going on. The problem is that this isn't even printing to the terminal; there's no output at all.
0
Options
y2jake215certified Flat Birther theoristthe Last Good Boy onlineRegistered Userregular
Okay, I'm within a method that's being called from the main method. Don't worry about the HashSet stuff, I'm just trying to get this thing to read from a file.
public static void writeFileToHashTable(HashSet names, String inputFilePath) throws FileNotFoundException
{
File inputFile = new File(inputFilePath);
Scanner in = new Scanner(inputFile);
while (in.hasNext())
{
String test = in.next();
System.out.println(test);
}
in.close();
}
I know the filepath is working properly, because I've doublechecked the filepath and also it would throw the FileNotFound Exception if the filepath was wrong. I know there's content in the .txt file it's reading from. I can't figure out why the damn thing won't print anything. Am I missing something obvious?
My java knowledge is spotty, but are you set up to catch the exception if it's thrown, or would your IDE notify you of it regardless?
An uncaught exception will filter out until it terminates the program.
I'd look at the documentation for scanner.in first thing.
MentalExercise on
"More fish for Kunta!"
--LeVar Burton
0
Options
Deebaseron my way to work in a suit and a tieAhhhh...come on fucking guyRegistered Userregular
Okay, I'm within a method that's being called from the main method. Don't worry about the HashSet stuff, I'm just trying to get this thing to read from a file.
public static void writeFileToHashTable(HashSet names, String inputFilePath) throws FileNotFoundException
{
File inputFile = new File(inputFilePath);
Scanner in = new Scanner(inputFile);
while (in.hasNext())
{
String test = in.next();
System.out.println(test);
}
in.close();
}
I know the filepath is working properly, because I've doublechecked the filepath and also it would throw the FileNotFound Exception if the filepath was wrong. I know there's content in the .txt file it's reading from. I can't figure out why the damn thing won't print anything. Am I missing something obvious?
System.out.println prints to the terminal, I think. I think printing to a file is a different thing like PrintWriter I think it's called
Oh yeah, I'm trying to print to the terminal, just so I can immediately see what's going on. The problem is that this isn't even printing to the terminal; there's no output at all.
Oh
Put test in quotes
it thinks test is a method/object/i forget which is the right term
Okay, I'm within a method that's being called from the main method. Don't worry about the HashSet stuff, I'm just trying to get this thing to read from a file.
public static void writeFileToHashTable(HashSet names, String inputFilePath) throws FileNotFoundException
{
File inputFile = new File(inputFilePath);
Scanner in = new Scanner(inputFile);
while (in.hasNext())
{
String test = in.next();
System.out.println(test);
}
in.close();
}
I know the filepath is working properly, because I've doublechecked the filepath and also it would throw the FileNotFound Exception if the filepath was wrong. I know there's content in the .txt file it's reading from. I can't figure out why the damn thing won't print anything. Am I missing something obvious?
System.out.println prints to the terminal, I think. I think printing to a file is a different thing like PrintWriter I think it's called
Oh yeah, I'm trying to print to the terminal, just so I can immediately see what's going on. The problem is that this isn't even printing to the terminal; there's no output at all.
Have you stepped through to see what is being put into test?
Okay, I'm within a method that's being called from the main method. Don't worry about the HashSet stuff, I'm just trying to get this thing to read from a file.
public static void writeFileToHashTable(HashSet names, String inputFilePath) throws FileNotFoundException
{
File inputFile = new File(inputFilePath);
Scanner in = new Scanner(inputFile);
while (in.hasNext())
{
String test = in.next();
System.out.println(test);
}
in.close();
}
I know the filepath is working properly, because I've doublechecked the filepath and also it would throw the FileNotFound Exception if the filepath was wrong. I know there's content in the .txt file it's reading from. I can't figure out why the damn thing won't print anything. Am I missing something obvious?
My java knowledge is spotty, but are you set up to catch the exception if it's thrown, or would your IDE notify you of it regardless?
My experience has been that my IDE terminates the program if it throws a FileNotFoundException.
I've checked and re-checked the file, though, and it's present, with the correct name, and it has content.
I'll try a different txt file and see if that works, but I think the issue is with the programming somewhere.
Nova_CI have the needThe need for speedRegistered Userregular
I bought a four pack of Starbound for me and my friends. One of 'em was all, "Now I need to get you something." I, of course, said he didn't have to, and I wasn't expecting anything like that.
About 20 mins later he asks, "So, what's a game you've been thinking about getting, but haven't?" I repeated that he really doesn't need to do that. "Oh, no, I'm not planning on getting you a game or anything."
Yeah. I said, "Oh, very subtle. I have no idea what you're planning, not at all."
Hi I'm Vee!Formerly VH; She/Her; Is an E X P E R I E N C ERegistered Userregular
Okay, I've narrowed it down a bit. I changed the system.out line to System.out.println(": " + test);
Which should have produced, at the very least, a bunch of lines of ": "
But nothing's being outputted, so I think the issue is that the program is, for some reason, immediately setting in.hasNext() to false, so the while loop never occurs. Still not sure why this is, though.
0
Options
21stCenturyCall me Pixel, or Pix for short![They/Them]Registered Userregular
LOL, I still feel guilty about playing a video game when I have finals soon...
maybe there's a space in the file or something so when it first reads it it doesn't see anything there?
It starts with "The name Shakespeare..." and goes on for awhile, but there's no space in the beginning or anything. As far as I can tell it's no different from the other text file I used, aside from having different words, obviously.
Fuck me this is so stupid.
0
Options
ShivahnUnaware of her barrel shifter privilegeWestern coastal temptressRegistered User, Moderatormod
maybe there's a space in the file or something so when it first reads it it doesn't see anything there?
It starts with "The name Shakespeare..." and goes on for awhile, but there's no space in the beginning or anything. As far as I can tell it's no different from the other text file I used, aside from having different words, obviously.
maybe there's a space in the file or something so when it first reads it it doesn't see anything there?
It starts with "The name Shakespeare..." and goes on for awhile, but there's no space in the beginning or anything. As far as I can tell it's no different from the other text file I used, aside from having different words, obviously.
maybe there's a space in the file or something so when it first reads it it doesn't see anything there?
It starts with "The name Shakespeare..." and goes on for awhile, but there's no space in the beginning or anything. As far as I can tell it's no different from the other text file I used, aside from having different words, obviously.
Fuck me this is so stupid.
Nothing screwy with the permissions of the file or the directory in question, I assume?
0
Options
y2jake215certified Flat Birther theoristthe Last Good Boy onlineRegistered Userregular
edited December 2013
i can't really think of other boys noizes so...
www.youtube.com/ watch?v=-CreEuaS8QY
(beware the video has a lot of random boobs i think despite not seeming like it should)
e: goddammit the still has to be a boob.
Posts
Probably going to lose a nail or 2 but nothing she hasnt dealt with before
Obama admin announces an initiative to ass
My java knowledge is spotty, but are you set up to catch the exception if it's thrown, or would your IDE notify you of it regardless?
Similar, though I still think American Beauty and Workingman's Dead are listenable albums
Oh yeah, I'm trying to print to the terminal, just so I can immediately see what's going on. The problem is that this isn't even printing to the terminal; there's no output at all.
we talkin like, katy perry california gurls jam party or like, hard jamz with a z
http://www.youtube.com/watch?v=SPxkp2F-nAQ
http://www.youtube.com/watch?v=_aZ-YRoJrnQ
http://www.youtube.com/watch?v=2Z3mYRGMWu0
http://www.youtube.com/watch?v=Zk-SDreueMw
maybe i'm streaming terrible dj right now if i am its here
An uncaught exception will filter out until it terminates the program.
I'd look at the documentation for scanner.in first thing.
--LeVar Burton
Subtle
Oh
Put test in quotes
it thinks test is a method/object/i forget which is the right term
Have you stepped through to see what is being put into test?
My experience has been that my IDE terminates the program if it throws a FileNotFoundException.
I've checked and re-checked the file, though, and it's present, with the correct name, and it has content.
I'll try a different txt file and see if that works, but I think the issue is with the programming somewhere.
oh god no, I have a large enough backlog as it is
I dont need anymore games, also there is nothing out there that interests me.
I was hoping to pick up South Park for my birthday but it got pushed back till Spring.
the hula hooper is hot
About 20 mins later he asks, "So, what's a game you've been thinking about getting, but haven't?" I repeated that he really doesn't need to do that. "Oh, no, I'm not planning on getting you a game or anything."
Yeah. I said, "Oh, very subtle. I have no idea what you're planning, not at all."
i just throwin things out there, i'll think of more stuff like boys noize
knew birdy nam nam was a stretch didn't really think you'd be throwing a spring breakers esque banger
maybe i'm streaming terrible dj right now if i am its here
He built a really shitty house with his sword.
Which should have produced, at the very least, a bunch of lines of ": "
But nothing's being outputted, so I think the issue is that the program is, for some reason, immediately setting in.hasNext() to false, so the while loop never occurs. Still not sure why this is, though.
But i studied all day, I should be okay monday...
Agh...
Check out my site, the Bismuth Heart | My Twitter
so your filepath will be like "\\Users\\Documents\\Mytext.txt"
maybe there's a space in the file or something so when it first reads it it doesn't see anything there?
It starts with "The name Shakespeare..." and goes on for awhile, but there's no space in the beginning or anything. As far as I can tell it's no different from the other text file I used, aside from having different words, obviously.
Fuck me this is so stupid.
WHAT DID YOU DO
What you call fun I call sin
That's strange.
http://threepanelsoul.com/2013/04/15/on-infinite-loops/
Are the files in the same directory?
--LeVar Burton
Nothing screwy with the permissions of the file or the directory in question, I assume?
www.youtube.com/ watch?v=-CreEuaS8QY
(beware the video has a lot of random boobs i think despite not seeming like it should)
e: goddammit the still has to be a boob.
http://www.youtube.com/watch?v=1Vh0iP5BziQ
http://www.youtube.com/watch?v=ftSUchAdVTE
(i just love this album so i'm putting the most partyish song)
and the no. 1 party song ever
http://www.youtube.com/watch?v=aINmJ5ieM6Y
maybe i'm streaming terrible dj right now if i am its here
lo that boys noize is pretty sweet