dcsimg
Converting a String value to a File type.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   joseph_george
Posted On:   Monday, August 11, 2003 07:37 PM

Yes I am working with a class I created that uses the File data type: File indexDir = new File(args[0]); File dataDir = new File(args[1]); So what I did was add this class to my project, inited it, and made a new instance of it when the Form I am using is loaded. The thing is this, I try to perform: String str = jTxtIndexDir.getText(); String str2 = jTxtSearchDir.getText(); jTxtStatus.setText("compiling data... <" + str + "-" + str2 + ">"); inx.index(str, str2); it tells me that: MainxLog.java [91] index(java.io.File,java.   More>>

Yes I am working with a class I created that uses the File data type:






File indexDir = new File(args[0]);

File dataDir = new File(args[1]);


So what I did was add this class to my project, inited it, and made a new instance of it when the Form I am using is loaded.


The thing is this, I try to perform:




String str = jTxtIndexDir.getText();


String str2 = jTxtSearchDir.getText();

jTxtStatus.setText("compiling data... <" + str + "-" + str2 + ">");

inx.index(str, str2);



it tells me that:



MainxLog.java [91] index(java.io.File,java.io.File) in Indexer cannot be applied to (java.lang.String,java.lang.String)

inx.index(str, str2);



can someone please help me out? How do i convert a string value to a File data type value in order to use my class?


Please use html tags to format code blocks.

   <<Less

Re: Converting a String value to a File type.

Posted By:   joseph_george  
Posted On:   Monday, August 11, 2003 08:01 PM

Ok I figured out how to convert the String value to a File value:



String str = jTxtIndexDir.getText();

String str2 = jTxtSearchDir.getText();



File indexDIR = new File(str);

File searchDIR = new File(str2);

inx.index(indexDIR, searchDIR);



Now I get a new error:




MainxLog.java [91] unreported exception java.io.IOException; must be caught or declared to be thrown

inx.index(indexDIR, searchDIR);


So what gives? Can anyone help me out? Thanks!
About | Sitemap | Contact