Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners need solution to get file name from path which should give by user
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sharada ananya
need solution to get file name from path which should give by user
1 Answer(s)      3 years and a month ago
Posted in : Java Beginners


how do i write a program in java that i should get file path from arguments.currently this code creates the file at d:\ but i need to get this file name as a argument how do i do it???am using netbeans for this.

    StringWriter sw = new StringWriter();
    StreamResult result = new StreamResult(sw);
    DOMSource source = new DOMSource(doc);
    transformer.transform(source, result);
    String xmlString = sw.toString();
    File file = new File("d:/Exported.xml");
    BufferedWriter bw = new BufferedWriter
   (new OutputStreamWriter(new FileOutputStream(file)));
   bw.write(xmlString);

 bw.flush();
     bw.close();

Advertisement
View Answers

October 14, 2011 at 4:32 PM


Use file.getName() method of File class.



Related Tutorials/Questions & Answers:
need solution to get file name from path which should give by user
need solution to get file name from path which should give by user  how do i write a program in java that i should get file path from arguments.currently this code creates the file at d:\ but i need to get this file name
which path we have to give in order to upload a file from any where in the system
which path we have to give in order to upload a file from any where... to specifying a path in the code from that path only it is taking image . what i have...; <td><INPUT NAME="file" TYPE="file"></td> </tr> <
Advertisements
Need Solution to get vaues from sql database in java
Need Solution to get vaues from sql database in java  hi I have... file. please provide me solution to get values for xml tags from database... need to get values from sql database for values in the blank field(" "). how do i
Need solution to get values for XML namespace tags from SQL database in Java
Need solution to get values for XML namespace tags from SQL database... comp:loc=" "/> now i need to get values from sql database for values... and created xml tags in separate file. please provide me solution to get values for xml
Java Get File Name
Java Get File Name       In this section, you will study how to obtain the name of file.  In order to get the file name, we have provided the path of file 'Hello.txt
Getting path name of uploading file in struts 2.8.1
Getting path name of uploading file in struts 2.8.1  Hai! I am using struts 2.8.1. I want to upload file into database with the path name. How can I can get the original path name of the file in struts 2.8.1? It only display
Constructing a File Name path
construct a file name path. By using the constructing filename path it is possible to set dynamic path, which is helpful for mapping local  file name... Constructing a File Name path   
executing a batch file which depends on jar files from a system tray but console should not display.
executing a batch file which depends on jar files from a system tray but console should not display.  Hi all, I got following requirement, I have to run a batch file which is depending on some jar files and it displays a frame
Getting path name of uploading file in struts 2.1.8
Getting path name of uploading file in struts 2.1.8  In my question I used struts 2.8.1 instead of 2.1.8. Sorry
Java file get name
Java file get name In this section, you will learn how to get the name... get the name of any file. Output: File name is: out.txt... called the method getName() through the object of File class which returns
Constructing a File Name path in Java
Constructing a File Name path        In Java, it is possible to set dynamic path, which is helpful for mapping local  file name with the actual path of the file using
How to give path to the Dfile?
on sphinx, i have to give path to the sphinx4.jar file which is present in my...How to give path to the Dfile?  Hello erveryone, I want to make... not linux ,i want to try above but in this i can't get the write Dfile path , can
How to get the browsed file path into controller bean using JSF icefaces
How to get the browsed file path into controller bean using JSF icefaces  Hi All, I've a requirement as, 1) Need to browse a file from my local system/machine 2) Path of the file from which I browsed need to be stored
solution to get values for xml namespace tags from sqldatabase in java
solution to get values for xml namespace tags from sqldatabase in java ...=" "/> now i need to get values from sql database for values in the blank... tags in separate file. please provide me solution to get values for xml tags
Want solution to get values for xml namespace tags from database in java
Want solution to get values for xml namespace tags from database in java ...:loc=" "/> now i need to get values from sql database for values in the blank... xml tags in separate file. please provide me solution to get values for xml tags
how to find which user has modified the file
how to find which user has modified the file  how to find which user has modified the file
How to create file and save it into user defined path using jsp/servlet?
How to create file and save it into user defined path using jsp/servlet?  Hi.. Onclick event I have created one file.When file will create it should asked where to save file(like browse option
Storing content from file path to an array
Storing content from file path to an array  Hi, I have a path... would like to access the "Animation.txt" file from this path and store the contents in this text file to an array. I am using jsp. I can access my path but how
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle... Oracle database and I want to know how to retrieve the path of the file... table for each spreadsheet but I want to obtain the path and filename of each
File path for jar file
not found for the template file. Also I had tried to get that path from user...File path for jar file  Hi Experts, I have created one eclipse... path of the template, which is working as per expectation. But I have created
Delete a File
a specified file or directory is deleted. For deleting a file from a directory you need to give the file name to be deleted. Description of program: The following code of program deletes a file from a directory. In this program the compiler
How to store user name,city,state,image path into database and image into folder using jsp
How to store user name,city,state,image path into database and image into folder using jsp  How to store user name,city,state,image path into database and image into folder using jsp
How to get full path of the uploaded file using commons fileupload jar file
How to get full path of the uploaded file using commons fileupload jar file  I want to upload file to database with its full path. Because... type.I am in need to get the full path. Can anyone help me to get the full path
how to show image as a link which path coming from database
how to show image as a link which path coming from database   iam not getting proper answer for it. I am using netbeans .the url coming instring from database ,want to display as image on jsp . please help me
java how to get domain name from url
java how to get domain name from url  How to get the domain name from a url string? Example program in java for "how to get domain name from url" Thanks   Hi, You can use the following example code: URL linkURL
I want to know the given class name exists in which jar file?
I want to know the given class name exists in which jar file?   I want to know the given class name exists in which jar file? C:\Program Files\IBM... the name of the jar file where 'com.rational.ft.util.debug' class exists
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box   i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
how to get selected name from combo box
how to get selected name from combo box  i have fetched all records of worker i.e worker name. on a test.jsp and dispayed it into combo box ...my question is that............. i havt to get particular id of worker on selection
Advertisements
 

 

 

DMCA.com