I need to scan the file and print it to console. But at first its ok but at the end I get an error
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(Scanner.java:1516)
at readfile.readFile(readfile.java:25)
at Test.main(Test.java:9)
I think it is something to do with my usage of Scanner.nextLine method.... Could someone help me out? Here is my code...
And another question if I may =)
I need to save this data as a separate file which should be an HTML template. I have really no clue how to do that, or if it is even possible =)
It is my first post btw If those are really nooby questions please dont be too harsh on me
Another problem I face is how to get this from consol into another text document. Would appreciate any help. This is what I came up with so far.
And what exactly is the problem you are facing? You need to be more specific and TellTheDetails so we can help you.
The only thing that I see might be wrong with your code is that the path you are using to write to a file is not correct. There is a drive missing at the beginning, meaning that your other methods shouldn't work too.
Also make sure you follow the naming convention. Class names are written in camel case, starting with a capital letter; methods start with a lower letter as well as variables.
The quieter you are, the more you are able to hear.
Thank you =) Will try and follow the naming conventions in the future =)
The pathways all should be correct - as I am working on a mac. The other method work just fine with those pathways.
What I am wanting to do is to create a java program to read data from a .txt file and create a web page presenting this information in a suitable format.
So far I have managed to open the file and present all the data to appear on the console. Now what I willing to do is to create a method to be able to put all those lines from the console and create a new .txt document with them. This is what I think should be responsible for this action - but it is not working =(
My next step would be writing a webpage template onto which I will hopefull to rewrite the data again.
A sidenote: if you run the program with the standard output redirected into a file, then the System.out... stuff will go there.
I think this works with the Apple command line (is it maybe bash?) as well: