• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read a file, then select a line and use what comes after the selected characters.

 
matthew christensen
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm writing a simple event logging program for my game. But I have a problem. I have a .properties file. That contains 3 lines of text(lines of text below)



I want to scan the file, then somehow use the data darkened below to set the path, max file size, and the save path.

max-file-size=15
log-path=C:\LWLW\
log-file-name=LWLog.txt


How would I go about doing this? I tried google for answers but alas nothing came of my search. Thanks guys!
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you were going to describe the bolded part in English, how would you do that?
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, actually you said you have a .properties file. So you don't have to parse it yourself (which is what I was mistakenly getting at in my previous post). Just create a Properties object to read that file and extract the properties from it. (You'll have to format it correctly, though, I think the backslash has a special meaning in a .properties file, check that out.)
 
matthew christensen
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by a properties object?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start here: Java Tutorials
 
matthew christensen
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Start here: Java Tutorials


Thanks! got it to work!
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You’re welcome and well done.
 
matthew christensen
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the code if anyone is interested!

 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for showing us that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic