Results 1 to 5 of 5
- 09-10-2009, 02:16 AM #1
Member
- Join Date
- Sep 2009
- Posts
- 5
- Rep Power
- 0
Need to read an .ini and .abook file line by line (both files contain texts)
Hi,
All I need to do is to make this Applet works. Assuming the Applet is signed (I already know how to sign an Applet).
Thx a lot for your help!Java Code:import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.io.*; public class ContactImporter_V2 extends java.applet.Applet { public void paint(java.awt.Graphics contexteGraphique){ String windows_login = windows_login = System.getProperty("user.name"); String th_profile_path_1 = "C:\\Documents and Settings\\" + windows_login + "\\Application Data\\Thunderbird\\Profiles\\"; String th_profile_path_2 = "C:\\Utilisateurs\\" + windows_login + "\\Appdata\\Roaming\\Thunderbird\\Profiles\\" ; String th_profile_path_3 = "C:\\Users\\" + windows_login + "\\Appdata\\Roaming\\Thunderbird\\Profiles\\"; String th_profile_ini_1 = th_profile_path_1 + "profiles.ini"; String th_profile_ini_2 = th_profile_path_2 + "profiles.ini"; String th_profile_ini_3 = th_profile_path_3 + "profiles.ini"; File fileHnd1 = new File(th_profile_ini_1); File fileHnd2 = new File(th_profile_ini_2); File fileHnd3 = new File(th_profile_ini_3); if( fileHnd1.canRead() ) { // Read each line into the file // If line contains "Path=Profiles/" then // retrieve string that comes after "Path=Profiles/" } else if( fileHnd2.canRead() ) { // Read each line into the file // If line contains "Path=Profiles/" then // retrieve string that comes after "Path=Profiles/" } else if( fileHnd3.canRead() ) { // Read each line into the file // If line contains "Path=Profiles/" then // retrieve string that comes after "Path=Profiles/" } } }
Stephane
- 09-10-2009, 08:41 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
What do you mean by make it work?
What does it do now and what do you want it to do instead?
- 09-10-2009, 09:44 AM #3
The above code is not understandable.But,I can give small suggestion for reading .ini file.
Generally .ini files contain key value pairs
Ex:test.ini
Name = Ramya
Place = Chennai
In java using Properties you can load the ini file and using getProperty() method u can retreive the value associated with the key.
Gothru the piece of code below
------------------------------
Properties p = new Properties();
p.load(new FileInputStream(new File("test.ini")));
System.out.println(p.getProperty("Place"));Ramya:cool:
- 09-10-2009, 10:13 AM #4
Member
- Join Date
- Sep 2009
- Posts
- 5
- Rep Power
- 0
Well, all I need to do is to get the content of a file which path may look like the paths below where "stephane" is the windows session username (I read somewhere that I can get this username using System.getProperty("user.name"); ):
ORJava Code:C:\Documents and Settings\stephane\Application Data\Thunderbird\Profiles\h93ya70s.default\abouk.mab
ORJava Code:C:\Utilisateurs\stephane\Appdata\Roaming\Thunderbird\Profiles\h93ya70s.default\abouk.mab
If there is a direct way to look for such a file and read its content it will be good!Java Code:C:\Users\stephane\Appdata\Roaming\Thunderbird\Profiles\h93ya70s.default\abouk.mab
Well, this is the Thunderbird address book and I'm coding an Applet allowing the user of my website to import their Thunderbird addresses book!
- 09-10-2009, 10:18 AM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
[SOLVED] read last line
By Azndaddy in forum New To JavaReplies: 22Last Post: 04-22-2012, 09:22 PM -
How to make Scanner read the same line
By mcollins in forum New To JavaReplies: 2Last Post: 03-03-2009, 06:41 AM -
Data files - how to read random line?
By Exhonour in forum New To JavaReplies: 4Last Post: 01-20-2009, 08:28 PM -
read the file from different line number
By vaskarbasak in forum Advanced JavaReplies: 3Last Post: 06-02-2008, 01:31 PM -
Reading in data from file line by line
By bluekswing in forum New To JavaReplies: 1Last Post: 10-02-2007, 12:19 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks