All Questions
157 questions
0
votes
1
answer
71
views
Does the `File` Class have an equivalent of the `InvalidPathException` of the `Path` Class? Java
If a file-path that includes Illegal characters (such as ':' in a file-name) is passed into a Method of the Path Class—like Path my_path = Paths.get(/*invalid file-path as a String*/);—an ...
0
votes
1
answer
220
views
find max ,min in csv file in Java [duplicate]
For this assignment, I need two java classes to find the max and min temperatures in a CSV file.
Using the command line like this:
$ java TemperatureStats Temperatures_Feb2021.csv
output example:
$ ...
0
votes
1
answer
158
views
Receiving an exception and code failing when trying to delete a line from a .txt file using java
I am trying to delete a specific line from my text file using java, My code is supposed to write the file to a temp file and skip writing the username (chosen to be deleted), it is then supposed to ...
0
votes
0
answers
33
views
Not receiving the reversed text in java file handling
I am trying to create a new file that write a string to a file. Then , I read that file and reverse the text in the file and store the text in my new file.
This is my codes
package OpenFile;
import ...
0
votes
3
answers
849
views
I am trying to send File as a parameter to a method but dont know how?
public static void createFile() {
File file = new File("C:\\Users\\egecoskun\\Desktop\\javafiles\\ananınamı.txt");
try {
if (file.createNewFile()) {
System.out....
0
votes
2
answers
69
views
Order in column a N number of number rows on a txt file with java
I was trying to make an assignment my teacher gave and I have to order in column a set of number rows in a text file with Java
Disclaimer: my teacher doesn't want the Scanner class for this assigment: ...
-2
votes
2
answers
593
views
AccessDeniedException after folder deleted
I run test case and save files created during execution in 'execution' directory (files from each tests in separated subdirectory)
At the beginning of suite I want to clean this folder
So in @...
0
votes
1
answer
790
views
Java - print list in 2 or 3 columns
My program is running. but, I wonder, If the result can be printed in 2 or 3 columns because the list of names is long (69 names). I tried to use f.format before for loop and string.format into ...
-1
votes
2
answers
326
views
Exception in thread "main" java.io.FileNotFoundException: java.io.BufferedInputStream@73035e27 (The system cannot find the file specified) [closed]
I have to read an outside file from my \\resource file in git. I have to use the resource folder, as I am sharing the project with other people, so our paths for the trainingData file will be ...
1
vote
1
answer
99
views
Integer.parseInt(String) throws a NumberFormatExpression [duplicate]
I'm reading in from a file that contains an item name and its quantity. I'm getting a NumberFormatExpression when I try to convert the quantity amount to an int. I feel it may be due to the - sign, ...
0
votes
3
answers
373
views
Why object of array from file has NumberFormatException in Java?
I need to read a .txt file line by line and store each line to an array. Each array has 3 elements, empId, name, salary, which are fields of SalariedEmployee class. My code has a NumberFormatException,...
-2
votes
3
answers
155
views
FileNotFoundException and exception handling in Java
I made sure to have all the exceptions I think are needed but it keeps giving me this error:
exception FileNotFoundException has already been caught
catch(FileNotFoundException fnfe)
public class ...
0
votes
2
answers
199
views
How to deal with NoSuchElementException in java?
I have a java program that reads from a cvs file that looks like this:
1111,John,23
2222,Mary,32
...
I want to store each field in an array. Whenever I run the following program I get the following ...
0
votes
1
answer
40
views
unknownSource when writing into a file
I have to write into a file everytime a change is made to it, i.e. someone changes the quantity or something of the sorts. The method I have chosen populate an ArrayList with the items, create them ...
0
votes
2
answers
1k
views
Doesn't save the words in array
i've got a propably simple question. I try to read the file and i want to add each single word to my array "phrase". The problem occures in for loop. I got the exception "index 0 out of bounds for ...