directory 3 « directory « Java I/O Q&A





1. Serving from temp or other directory?    coderanch.com

Howdy folks. I have some HTML and image files which I want to serve from a web application's temp directory. Which of course changes with each session. Is there a sane way to do this, or is there another facility where I can set up a static file directory on each session creation? Here's the long story: Server is Tomcat. I ...

2. Deleteing the directory.    coderanch.com

Hi All, I am using another process in detail say C# code to generate/write files into the file system. Then I am trying to delete the folder but it is not deleting the folder. Not Deleting : When you call Delete logic from main program where I am using C# code to generate the files. But i am able to delete ...

3. Virtual Directory Translation    coderanch.com

4. make the method in one java file available for a java program in another directory    coderanch.com

Albert, You will need to import the class & import statement shoud include the class name or .* after the package name. You need to learn how to create instances of a class & execute the method.(using the "new operator") I believe you are jumping from a procedural language to object oriented one so it would help if you start reading ...

5. create a file without directory    coderanch.com

6. Cannot run program from another directory then the bin directory    coderanch.com

Hello, If I try to compile a programm in the bin directory I have no problem. But when I try to compile a programm in another directory I got an error. I read a lot on this form and I think I need to set the CLASSPATH. I foud only PATH but not CLASSPATH among Windows Alta Vista. I wordk on ...

7. What is the concept of endorsed directory??    coderanch.com

Dear All, Can anyone let me know what is the concept of endorsed directory in java? Suppose I have a class called Some.class which is present in two jar files named file1.jar and file2.jar. Suppose I have this directory structure: lib\ lib\endorsed And suppose I have kept file1.jar in the 'lib' folder and file2.jar in lib\endorsed, which version of Some.class will ...

8. Advice on file directory needed.    coderanch.com

Hey. I've got a programme that processes the files in a given directory. However, it can only run those files if the programme itself is saved in the same directory. The error i am experiencing now is that once my programme runs the directory, it also generates a class file which also is processed by the programme (because it's saved in ...





10. Not able to create directory    coderanch.com

11. Java directory    coderanch.com

12. Where to Create an "output" Directory    coderanch.com

1. Yes, you should create an "output" directory. 2. If you want to use that code, you should create it under the current working directory which was and will be in effect when that code is run. 3. No, you don't need to create an empty file before writing. The FileWriter or FileOutputStream will take care of that. And for the ...

13. creation of new directory inside an exisiting directory    coderanch.com

Hi, I need to write a file I/O code in which I need to create a subdirectory inside existing directories and then write a text file inside that new subdirectory created. This path is already created : D:/opt/jboss-4.0.3SP1/server/mercerhr/static_content I need to create a directory : ChatTranscripts inside that a file transcripts.txt so the whole path is : D:/opt/jboss-4.0.3SP1/server/mercerhr/static_content/ChatTranscripts/Mercer_Chat_1047835.txt This is the ...

14. Files from a directory is not being recognized    coderanch.com

expected output =========== .txt .txt .txt : : : k,v k,v k,v : : : result we got:: .txt .txt .txt : : : k,v of only first class ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// package one; import java.io.*; import java.util.*; public class MainClass2 { public static void main(String[] args) throws Exception { int flag=0,cindex=0; double d3=1.4445315E-4; String fname=null,first=null,second=null; TreeMap ...

15. Can we refresh the directory from middle of java code    coderanch.com

Hi, can we refresh the directory in middle of executing the java code? If excel sheet is not exists the below code creates and need to read same doc and modifies the data. My problem is i am unable to read the doc immediatly which was created at the instant(means fresh doc). So is there any alternate to read the existing ...

16. Checking if file exists in a directory    java-forums.org

Hey everyone! I am new to Java. I'm trying to write a program, which creates a new file on each run. If a file with the same name exists in the current directory, it should change the name of the new file to avoid replacing the old files. Here's the code I've written to do this: PHP Code: Random rand = ...





17. How to import file from same directory?    java-forums.org

I had to compile them both on the same command line for it to work. That is javac myproject/Test1.java myproject/Test2.java and then it would compile without errors. Then I had to be careful to run it from a directory level above like this: java myproject/Test1 for it to work. Bit of a trap for players without an IDE. Anywayz thanks for ...

18. How to. Files and Directory    java-forums.org

Evening. As I now begin to be finished with my program, I have a few questions. 1 How can my program know what OS it is installing on? 2 Do i use some if statement when i create files that the program use. ex. if windows ( file c:// ) else if Linux (file/home) ? Think thats all i have left ...

19. java run correctly in the upper directory    java-forums.org

I compile By javac some java sources with this sintax: javac -cp .;c:\com MenuExample.java this source code are in the directory C:\com\a1\ the compiler makes 2 classes: MenuExample.class and MenuExample$1.class now if I run it, in the same directory, with java -cp .;c:\com MenuExample there is a error messagge: java.lang.NoClassDefFoundError: MenuExample (wrong name) if I go to the upper directory (C:\com) ...

20. Openening a File in Any Directory    java-forums.org

Hey, so I have a program that when a button is clicked on the GUI, it will open an executable program. The problem is, if I'm going to share it, people may have this executable in a different directory from me. So for example, I have this in "C:\\Personal\Games" and someone else may have it in "Public\Games". How would I make ...

21. Get application directory    java-forums.org

22. Managing directories with java    java-forums.org

I want to create a file explorer window for the "open" option for the file menu in java. Well I know most of it but I don't know how to actually manage a directory programmatically through java. What I need to know to finish it is: What is the directory object for java(Like the File object for files)? If it doesnt ...

23. Directory Issue    java-forums.org

when I open a workspace and try to compile a project, i get the error message: javac: file not found: C:\Program Files\Xinox Software\JCreatorV3 LE\.... but within JCreator's default options, all of my directories are set to: C:\Program Files (x86)\Xinox Software\JCreatorV4LE\ (my jdk home directory) why is JCreator looking in the wrong directory??

24. Importing classes in upper directory.    java-forums.org

25. Help with Directories    java-forums.org

I need some help with the coding that I have, please. I have to tell the console which directory I want to search in, I have to search the directory for .txt files, then I have to search the .txt for the words "I am a lawyer in * who has to find a lawyer overseas." I am so lost. This ...

26. Why doesn't this code make the directory hidden?    java-forums.org

Nope, no errors - program runs as normal. Directory is created and files saved to it. If directory is already there, no problems either, files saved to it. Only problem is the directory needs to be hidden but it isn't hiding. I learnt that this is the correct code for Windows but i don't know if it is compatible with windows ...

27. JDK API Directory problem    java-forums.org

hi to all i started college on computer science, so im new in the java world my problem is that i cant compile anything , and i dont know what to do . everytime i try to compile a window appears saying "The JDK path has not been set", so i click on "setup JDK" then he asks me the JDk ...

28. Need to re-write directory    java-forums.org

Something is wrong with my minecraft, and I believe it can be fixed by using a different directory. I want it to access the neccessary files from a different location. It is currently located in /User/Jcarroll/Library/Application Support/minecraft and I want to relocate it to /User/Jcarroll/minecraft please just give me instructions and I can do the rest myself. I am using the ...

29. Upload all the files from the directory    java-forums.org

30. directory location of persistence.xml fiel    java-forums.org

HI i m new user of hibernate and i m trying out with JPA.I hv read abt the JPA and persistence.xml fiel but i can not get idea where to put the persistence.xml fiel and in which directory. I am using Eclipse IDE.Where i try to run the code the errror shows: No Persistence provider for EntityManager named firstexample Thanks and ...

31. How to make a object of Directory Class    forums.oracle.com

You can't instantiate abstract objects. When you need an object of an abstract class, you actually end up with an object of a (non-abstract, a.k.a. "concrete") class. You get those in one of these ways: 1) the abstract class might have a static method that gives you an object of a subclass 2) there might be a different class that has ...

32. i need to upload my files from one directory into other directory.    forums.oracle.com

i need to upload my files from one directory into other directory.( all its contents,folders,sub folders, files etc) for this task suppose my source folder is C:/test/test1/test2/test3 and my destination is D:/ first i have to check whether my dest dirctory already contains source directory..and its files if it contains the same structure then i have to replace the destination dir ...

33. Directories and Filters    forums.oracle.com

Hi there.. I would like to pass 2 strings as a parameter in a constructor.. 1. Directory name 2. A filter The filter will be of the form "E.*\.htm".. So, I want to look in the folder which I know how to do but I would like to filter the files in the directory to the form I specified above.

34. Directory    forums.oracle.com

35. load all files in a directory    forums.oracle.com

C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv416_11136.txt is 60.65% positive, but does contain 39.35% negative words, it is therefore probably not a happy text. C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv417_13115.txt is 60.66% positive, but does contain 39.34% negative words, it is therefore probably not a happy text. C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv418_14774.txt is 60.68% positive, but does contain 39.32% negative words, it is therefore probably not a happy text. C:\Users\Torre\Desktop\panglee\txt_sentoken\pos\cv419_13394.txt is 60.69% positive, but does contain ...

36. newbie question about directories    forums.oracle.com

Hi, I've written an applet that will be built into a website. It will be used by multiple users that require different fuctionalities in this applet. However, many utilities are generic. The generic utilities (classes) are located in a separate directory (I never want to change those) and the specicfic classes are located in specific directories. Now the applet (JApplet) itself ...

37. URGENT: How to run a Java program from a different directory?    forums.oracle.com

Hi. How do I run a Java program from a directory that the file is not located in? So lets say im in c:\Java. But the file is in c:\Java\abc\efg\. What would be the command to run the Java file from c:\Java. I can't remember it and I need it asap. Cheers.

38. Looping through HUGE directory - How to do so most efficiently?    forums.oracle.com

I'm not sure I understand what you mean - I have to compare a file in the file system vs an entry in the db. For example: I have 2000 rows I have 1990 files The file name and the entry in the db are the same. So for each file in the directory, I: get the fileName query (using preparedStatement) ...

39. What is compilers default directory?    forums.oracle.com

40. failed to create new directory    forums.oracle.com

41. Obtaining total size of a directory    forums.oracle.com

42. File Directory    forums.oracle.com

Hi Encapchalopathic, Its all linked together man.What i am trying to do is trying to use a progress monitor to monitor the encryption and at the same time stop the encryption with a cancel button and also delete the file that is encrypted halfway.I managed to resolve the initialisation problem..now it is the file deletion man.This deletion is driving me nuts.Please ...

43. Counting number of files in a Directory    forums.oracle.com

Hi All, I am new to java and file handling.i need urgent help in this regard.i have to develop a programme which have to find the number of files with certain extension (say with extension .java) and den write dere name in another folder. i will be give the path up to the director and i have to search it also ...

44. Where is the command line in the directory?    forums.oracle.com

I am relearning Java programming and doing an online tutorial. I went ahead and dowloaded the JDK program (jdk-6u3-windows-i586-p-iftw.exe) from Java's website and put it in a folder on my computer. I also have a BigDebt.java program on my computer....but the tutorial is telling me to put this command "javac BigDebt.java" in the directory where my program is saved to compile ...

45. setting directory    forums.oracle.com

47. Get Directory and Subdirectory    forums.oracle.com

I have a unix file system, and I would like to retrieve the listing of a directory and subdirectory of the file system, so that I can remove them when I get and update. I would like to be able to specify, the file system in java (/brianbrain/fs01), and get a list of the directories and subdirectories. For example, I would ...

48. Directory Question    forums.oracle.com

49. Directories    forums.oracle.com

50. Directories....    forums.oracle.com

51. Pointing to the application directory    forums.oracle.com

You know you can deploy more than just the ROOT webapp, right (assuming you're talking about the ROOT webapp that comes with Tomcat)? The proper way to create a redistributable webapp is to create the complete folder structure as it would appear in ROOT, with just the files from your app, and then zip them up in a war file (you ...

52. Want to create temp directory    forums.oracle.com

53. Help with getting the sum of files in a directory    forums.oracle.com

That is what i am trying to do. Get the size of a directory. I don't know what is up with the slashes. It was the only way i was able to get it to read the directory. If 'length' not how you find the size of the directory then what is? why would it work for files but not directories? ...

55. getCurrentDirectory() cuts off last directory    forums.oracle.com

56. creating directory in java    forums.oracle.com

sorry if that ws late.. /* The following code checks for the presence of the directory ".temp" at C:\home and if it is not present,creates the same */ import java.io.*; class mkdir { public static void main(String arg[]) //throws Exception { String a = "C:" + File.separator + "home"; String b = ".temp"; String c = a + File.separator + b; ...

58. First Real Project... How to I query filesystem for directory / file info    forums.oracle.com

Total beginner here Been on a course which is all well and good but now I have to actually do something more worthwhile The app I am working on will be based on the abilty to take a folder or drive, and query it and all subdirectories for information. It is a cleanup process to get rid of all directories and ...

59. get all files in a Directory    forums.oracle.com

60. How do I go up a directory when using a DOS prompt?    forums.oracle.com

Because then everyone will come here seeking answers to anything and everything. For example we get plenty of JavaScript questions. Even though someone may know the answer they are told to go to a JavaScript forum. Otherwise they will continue returning here to get JavaScript answers and soon the fora will be overrun by them. Similarly Swing related questions are expected ...

61. obfuscator for classes and directories?    forums.oracle.com

To make it harder for curious people (competition) to copy the code. I have read the arguments pro and con on obfuscation / encryption...Still, given the fast paced internet market every hour I can get with being the only one having the product people want is of high value to me, and I will go the extra mile of obfuscating the ...

63. java program will only run in its development directory    forums.oracle.com

I have a 12-year-old program/applet which has been on the web for 12 years. It is an interactive color wheel: * http://r0k.us/graphics/SIHwheel.html My development tools are a nice text editor and the JDK. No IDE is involved. I'm making a major upgrade, which shows the closest color names from a database of 1,567 names. I wrote it so it can run ...

64. execute java file at different directory    forums.oracle.com

i'm new in java and learning from beginning which using the console to compile and execute the java file. but i have question on execute(run) the java file. first of all i was compiled a java file to a class file, after that i have to change the directory to the location that i need to execute the java file, let ...

65. Program fails while running when executed from a different directory!    forums.oracle.com

Most java apps I know use the user home directory as the central repository for configuration data. For example Netbeans will create a .netbeans directory in the home directory. The user home dir won't change no matter where you run your application from. The good thing about the user home is that every popular OS that runs Java will have it. ...

66. Watch directory for added files    forums.oracle.com

Here is the solution I came up with. Let me know if you see any problems with it. I just check the size of the tempFileList and if it is less than the size of fileList, I know something has been removed and I ignore the action. If it is greater only then do I find out what the name of ...

67. Refreshing directory    forums.oracle.com

I'm writing a program inside Eclipse IDE and during the program, I write a file inside eclipse directory and then I use the file in order to manipulate its contents but I get java.lang.ClassNotFoundException because the directory hasn't been refresh yet, in order to find the specified file. Is there a way to refresh the eclipse directory from inside my java ...

68. Picking out files from a Directory    forums.oracle.com

Hi guys. I've got a directory that contains a lot of files, among them documents named in accordance with the following convention: "X-YYYY-MM-DD-NoNN.suffix", where X = String of length > 0, YYYY-MM-DD = valid Date, NoNN = number of the document, where "No" is a String and "NN" and integer > 0. I'm trying to determine an efficient way to pick ...

69. Directory not writable    forums.oracle.com

70. Allowing user to specify directory    forums.oracle.com

71. Using files other than in the same directory as the code...    forums.oracle.com

ImageIcon icon = createImageIcon( "images/menu.gif", "Gordon's Alive!"); protected ImageIcon createImageIcon(String path, String description) { java.net.URL imgURL = getClass().getResource(path); if (imgURL != null) { return new ImageIcon(imgURL, description); } else { System.err.println("Couldn't find file: " + path); return null; } } public void loadImage() throws IOException { JFileChooser chooser = new JFileChooser("."); int optionSelected = chooser.showOpenDialog(this); if (optionSelected == JFileChooser.APPROVE_OPTION) { String ...

72. FTPing a directory    forums.oracle.com

From my reading of the API, there is no method that would do what you want. You will need to iterate (and recurse if you want subdirectories as well) by yourself, use makeDirectory() and storeFile() individual files. For an example on how to do this, I like [http://vafer.org/blog/20071112204524], but there are plenty if you google for "Java recursive directory transversal". Edited ...

73. how to run java from another directory    forums.oracle.com

hi, i have a Sample.java file in F drive(f:/Sample.java). I opened command prompt in windows and went to c: drive and try to compile as C:\>javac f:/Sample.java above command works well. it generated Sample.class file in F:/Sample. But, when i try to Run that file, i got the error as follow. C:\>java f:/Sample Exception in thread "main" java.lang.NoClassDefFoundError: f:/Sample Caused by: ...

74. new File renames old directory    forums.oracle.com

76. mkdirs() creates read-only directories    forums.oracle.com

77. Installation directory of Operating System    forums.oracle.com

Hi all, I am trying to know installation directory of operating system. I tried to get it with System.getProperty(key). But no key returns installation directory of OS. Currently i am working with windows XP. I need to save one dll dynamically in its /Windos/System32 directory. Plz help me how to do this.

78. Directory Creation in Unix/Linux using sysop group.    forums.oracle.com

Hi All, Directory Creation in Linux using sysop group. I want to create a directory using sysop group but it default create using root:root I have other user called test:test using test:test sysop group i want create directory In java using test:test sysop group how to create directory. Is it possible i have checked the File API. I did't find any ...

79. file directory chooser    forums.oracle.com

paulaeunice wrote: yes. it's a webapp. and i've managed to do this by putting the code in the actionperformed method to the controller class. now my only problem is that th file was saved in the server computer. does anyone know how to save the file in the client side? If all of that means that the code you posted was ...

80. class that manage directory    forums.oracle.com

hello, I'm looking for a class that manage a directory. the class should "know" the names of the files it owns, and has to be able to create a new files in it. i looked for suck, but didn't find, and i believe it is exist. (as a student, i should write a small compiler. the compiler should get a directory ...

81. Compare directories on separate workstations    forums.oracle.com

I am having a terrible time trying to come up with a way to compare two directories stored on separate computers. Any tips would be greatly appreciated. A little background: I am writing an rmi application that provides file sharing an backups of music, videos pictures, etc. The problem is I want to compare a directory on the client machine against ...

83. java.io.File fails to recognize a directory! help needed!1    forums.oracle.com

I'm writing a small code to recursively go through a directory to create list of files, But my program is failing because java.io.File is failing to recognize a directory. When I call file.listFiles() I get null and I checked printed out result from isDirectory() and it printed false even though I'm 100% sure that it is a directory. Here's the snippet ...

84. startup directory    forums.oracle.com

85. Viewing a web directory    forums.oracle.com

86. Referring to low level directory    forums.oracle.com

87. Get directory size    forums.oracle.com

88. Create Temp directory    forums.oracle.com

89. file directory help    forums.oracle.com

90. get application directory please help...    forums.oracle.com

I read the java.io.File API, but I didnt find how to get the application directory. if I do : String app_path = ClassLoader.getSystemClassLoader().getResource("").getPath().replaceAll("%20", " "); And launch my application in eclipse, I get the application directory, but when I export that to a .jar, launching this .jar will give me an error. Fortunately I find this link : http://illegalargumentexception.blogspot.com/2008/04/java-finding-application-directory.html And when ...

91. File is not moved to directory due to some strange/weired problems !!!!    forums.oracle.com

Hi All, I've deployed my application in the tomcat server. I'm trying to move files through java every 10 minutes (Job scheduling via quartz) from one folder to another folder after successfully sending the file to FTP server. 1. Sending a file to FTP server - worked fine. 2. Moving the file from one folder to other folder - failed I've ...

92. Getting the running directory...    forums.oracle.com

hi fellow java developers! Im trying to figure out how to get the current running directory of a jar file. For instance, Ive set up a file in windows to "open" another file after a double click. The other file does open, however if I am creating a new file in the current directory (i.e. new FIle("hi.txt"), then it creates the ...

93. Help How to count files in directory?    forums.oracle.com

94. Checking for files in a directory    forums.oracle.com

For my application I am having an input directory where every second many file comes, I have to pool this folder and check the status of the files in database if it needs processing or not) my code, does a dirlist and checks that the file size doesnt change to ensure the file transfer is complete/closed. File[] contents = dir.listFiles(); // ...

95. Counting the subdirectories in a directory??    forums.oracle.com

96. Is there possible using commands with directory to run a java app?    forums.oracle.com

Hi, I wanna use a command to run a JAVA application like C/C++, for instance, under the windows comand line I write instructions as below: c:\>F:\MyVcApplications\test.exe how can I run a java app like that? c:\>java F:\MyJavaApplications\Test I know the implementing as above is impossible. There may be a package can resolve this problem, write a line in JAVA code at ...

97. Sort directories according to months    forums.oracle.com

98. Check for Directory Existence.    forums.oracle.com

Hello Friends, I am currently working on a project to check prerequites during operation of a task. The program need to check the path in the central server for e.g : say \\kino\java\code or /mnt/kino/java/code based on windows or linux. The interesting part is i have a xml file which has : label = kino1 location=\\kino\java\code1 version=windows location=/mnt/kino/java/code1 version=unix label = ...

99. JAD decompiler directories    forums.oracle.com

Hi, I have these two directories , C:\Test , which contains TestClass1.class and TestClass2.class, and C:\Test\src , which contains TestClass1.class and TestClass3.class. Which ONE command would I use so that when I decompile all these classes, the output files should be in the correct directories, meaning TestClass1.java, TestClass2.java in C:\Test, and then TestClass1.java and TestClass3.java in C:\Test\src. Thank you

100. About Directory Poller    forums.oracle.com