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




Have Programming Question? Ask it here!
 
 
 


harikrishna
runtime error
2 Answer(s)      4 years and 11 months ago
Posted in : Java Beginners



Advertisement
View Answers

August 31, 2009 at 10:40 AM


Hi Friend,

Try the following code:

import java.io.*;
public class RecentDocumentsDelete
{
public static void main(String[] args)
{
String currentUser = System.getProperty("user.name");
System.out.println(currentUser);
String path="C://Documents and Settings//"+currentUser+"//Recent";
File folder = new File(path);
File[] contents = folder.listFiles();
for (File f : contents)
{
if (f.isFile())
{
f.delete();
System.out.println("Deleted file: " + f);
}
else
System.out.println("Cannot delete: " + f);
}
}
}

Thanks


August 31, 2009 at 10:40 AM


Hi Friend,

Try the following code:

import java.io.*;
public class RecentDocumentsDelete
{
public static void main(String[] args)
{
String currentUser = System.getProperty("user.name");
System.out.println(currentUser);
String path="C://Documents and Settings//"+currentUser+"//Recent";
File folder = new File(path);
File[] contents = folder.listFiles();
for (File f : contents)
{
if (f.isFile())
{
f.delete();
System.out.println("Deleted file: " + f);
}
else
System.out.println("Cannot delete: " + f);
}
}
}

Thanks


Related Tutorials/Questions & Answers:
runtime error
runtime error  still i am getting runtime error as:the specified dsn contains an architecture mismatch between the driver and application   Hi, This error is related to some OS related problem. "dsn contains
java runtime error - JDBC
java runtime error  when i m running my program using type1 driver it is showing a runtime error of SQLException of unable to create the connection object.please give the solution
Advertisements
runtime error in java
runtime error in java  What is Run time error in Java?   Run time error is a syntax error that during the execution of a program.It hash different types of a program like as Logic error,Fatal Errors,source code,wrong
java runtime error - JDBC
java runtime error  when i m running my program by using jdk1.6.0 then it is giving the error of classunsupported major.minor version 50.0.to remove... version error 49.0.so, please suggest how will i compensate this problem
runtime error - Java Beginners
runtime error  I created a sample java source ,compiled it succesfully using command prompt but when i tried to run i got the folowing error " Exception in thread "main" java.lang.UnsupportedClassVersionError" I have set
java runtime error - JDBC
java runtime error  when i am running my jdbc program using thin driver this error is coming at runtime: Exception in thread "main..., give me the suggesion yo solve this problem  This kind of error due
runtime error - Java Beginners
runtime error  sir run time error is coming again in this code also null pointer Exception at for( File f:contents) import java.io.*; public class RecentDocumentsDelete { public static void main(String[] args) { String
java runtime error - JDBC
java runtime error  sir when i m running the jsp connectivity program it is giving the error as follows:' java.lang.NullPointerException at jsp_servlet.__resplogin._jspService(__resplogin.java:237
java runtime error - JDBC
java runtime error  when i m running my jdbc program it is giving the problem as class not found exception.so, please suggest me what may be the solution regarding this.  Hi friend, The problem is of Jar
java runtime error
java runtime error  hi friends i am trying to run the fallowing program but i am getting the error Exception in thread "main" java.lang.UnsupportedClassVersionError: JDBCCreateTab le (Unsupported major.minor version 50.0
runtime error - Java Beginners
runtime error  import java.io.*; public class RecentDocumentsDelete { public static void main(String[] args) { String currentUser = System.getProperty("user.name"); System.out.println(currentUser
Unknown runtime error in Ajax - Ajax
Unknown runtime error in Ajax  Getting Unknown runtime error in Ajax... error in Internet Explorer.Any once please give me the solution. Div tag: calling the Ajax: Add State Script
jsp runtime error - JSP-Servlet
jsp runtime error  sir, when i am running ur prog... from this website.... http://www.roseindia.net/jsp/poi/readingWriting.shtml i did the same as per guidelines...but i got error..!!!! org.apache.jasper.JasperException
java runtime error - Java Beginners
java runtime error  import java.io.*; class Test { public static... bin of jdk1.6.0_17(as mentioned above in error path & path mentioned is also correct), then too it's displaying the error while running it through command prompt
Java Runtime error - Java Beginners
Java Runtime error  I have designed a simple chat application where the client and the server is the same computer itself. I have used the ipaddress.... I get this error: java.net.ConnectException: Connection refused: connect
runtime error:Invalid column name
runtime error:Invalid column name  Hello, Can anyone please help me on this query? Programatically it is showing run time error. But in sql query the query is working fine. import java.sql.Connection; import
JDBC:Runtime error - Java Beginners
JDBC:Runtime error  Dear sir/madam i am facing a problem with jdbc... to run the program from command prompt it is giving error. The follwing... to run the batch file it is showing following error
Java runtime error - JSP-Servlet
Java runtime error  Following Error is showing when i way scanner.acquire() can any body help me please uk.co.mmscomputing.device.sane.SaneIOException: uk.co.mmscomputing.device.sane.SaneDeviceManager.getDevice
java runtime error - Development process
java runtime error  I Migrated jdk1.3 to jdk1.4. after that my ftp clint not working.iam getting class not found exception fileinputstreem. i am using sun package. can any one send pure java code for FTP process i think jdk
java runtime error - Java Beginners
java runtime error  sir, i have installed jdk in my system.i had also set path.But i am unable to run the compiled class file.it shows run time error.i had tried solving the problem in all ways.what to do now?   Hi
Error during runtime NoClassDefFound in java
Error during runtime NoClassDefFound in java  code: package Jama...; } } this gives NoClassDefFound error during runtime. i have done...[n-1][n-1] - H[n][n]) / 2.0; q = p * p + w; z
Error during runtime NoClassDefFound in java
Error during runtime NoClassDefFound in java  code: package Jama...; } } this gives NoClassDefFound error during runtime. i have done...[n-1][n-1] - H[n][n]) / 2.0; q = p * p + w; z
JDBC:Runtime error - Java Beginners
JDBC:Runtime error  Dear sir/madam, thanks to respond for my request. I tried as you said but still i facing the same problem no suitable drivers found for mysql. I copied the mysql-connector-jave-5.0.8-bin.jar, mysql-connector
java runtime error: JDBC code - Java Beginners
java runtime error: JDBC code  Hi i want to insert data into mysql database in my local system. I installed mysql5.0 and using mm.mysql-2.0.4-bin.jar and also set in the class path. the code is compilled and giving runtime error
jsp runtime error - Java Server Faces Questions
jsp runtime error  how to lock and unlock the folder by using jsp programming
i cant find any compile time error but there is runtime error.
i cant find any compile time error but there is runtime error.  ...){ System.out.println("Error:connection not created"); }   Hi...("Error is:" + s.getMessage()); } } catch (Exception e
Runtime Errors
to divide the number by zero which results in runtime error. The code of the program...; <TITLE>Runtime Error in Jsp page</TITLE> </HEAD>...; border="1"> <H1>Runtime Error in Jsp page</H1>
Runtime Class
Runtime Class  How can we halt d execution withd help of exit(arg) method?? ...pls tag a code
runtime exception hibernate
runtime exception hibernate  runtime exception hibernate
thread runtime process
thread runtime process  Java thread runtime process
JSP handle runtime exceptions
JSP handle runtime exceptions  How does JSP handle runtime exceptions?   Using errorPage attribute of page directive and also we need to specify isErrorPage=true if the current page is intended to URL redirecting
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
Java Runtime
Java Runtime       In this section, you will learn about Java Runtime Environment (JRE), it also known as Java Runtime. This is a part of Java Development Kit (JDK). It is a set
Runtime shared library
Runtime shared library  Hi....... Please just tell me about What are runtime shared libraries in flex? Thanks  Ans: Run time shared library is One way to reduce the size of your applications' SWF files
Not able to display jtable at runtime
from database. But it is not creating the table at runtime. It retrieves data from...(); JOptionPane.showMessageDialog(null,e.getMessage(),"Error!!",1
fill combobox at runtime jsp
fill combobox at runtime jsp  i have 1 combobox in jsp which is filled with value from sql db on load of form <% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection cn
runtime polymorphism - Development process
runtime polymorphism  how run time polymorphism is achieved  Hi Friend, The run-time polymorphism is basically the Method Overriding.Here super class reference is referring to subclass object and compiler does
java runtime exception - JDBC
java runtime exception  while i executing this source code:- import java.sql.*; public class MysqlConnect { public static void main(String args[]) { System.out.println("MySQL Connect Example
how to add fields at runtime in j2me
how to add fields at runtime in j2me  How can I add fields at runtime in my form? How can I switch screens and can add fields at runtime? Thanks Dhruv
Remove Top-Level Container on Runtime
Remove Top-Level Container on Runtime  Remove Top-Level Container on Runtime
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Java runtime example - JSP-Servlet
Java runtime example  in eclipse after submiting the data throgh jsp page i got the following error com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 1. the code is: Bean
error
error
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version. This type error also comes when java file
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
Advertisements
 

 

 

DMCA.com