Is there a best practice for where configuration files should be stored in a Java project. The file type is a Java properties file in this case, but I do use ... |
How can I get the location of the hosts file when using my application on different platforms?
|
I'm not sure if this is even possible as I can't find anything about it after quite a few Google searches.
What I would like to do is on event open up ... |
private static void saveCallers(String fName, RadioShow r) throws IOException {
//TODO write the code to save the callers to a file
...
|
In Java, what is the default location for newly created files?
|
In my jar application I do some calculations in exe program. When files and program.exe was in the same dir I used this command:
String[] str={"program.exe", "file1.txt", "file2.txt"};
pr = rt.exec(str);
and it worked ... |
I need to give a default location for the user to store the file. like "/Users/username/Desktop". How to give the location for a file? Below code will generate the file in ... |
|
hi all in my application program , i need to get a date by column & row values from file , is this possible , is there an api supports (java 1.4.2)if please help me in this i am giving you the sample file and i underline date value by dash's(-),column and row values changes file by file (row value is ... |
|
Hi, I am using a Tomcat4.1...This is the problem that I am facing: I have a exe which is to be run by the servlet.The exe uses the files in the current directory and generates files in the current directory. But I have no idea which is the current directory from which the servlet is executed. I tried placing them in ... |
// open file junk for reading and writing RandomAccessFile f = new RandomAccessFile("junk", "rw"); // open crud for reading only RandomAccessFile ff = new RandomAccessFile("crud", "r"); //To append information to a RandomAccessFile, seek to the end of the file: f.seek(f.length()); //The beginning of a file is considered position 0. Therefore, to seek to the beginning of a file, use: f.seek(0); |
|
Hi everyone. I'm reading a little bit about resource bundles and i would like to ask where is the correct location of the .properties files? I tried to put them in the WEB-INF path, but i receive and exception. It works only when i put .properties file somewhere in my class packages. Is it possible to put them in other places ... |
|
Web apps have no concept of a "default directory", so you can't use relative paths for files. You either need to use absolute paths, or -for directories inside your web app directory- use ServletContext.getRealPath(...). Oh, now I see it's about the compiler error - "new File(...)" throws that exception, so you need to handle it properly (using a try/catch block). |
I'm having to do a class project, and the idea of a file location baffles me. I think i'll be able to finish the project myself (got a friend that knows what he is doing) - but i'm curious if someone could explain what it all means in easy to understand words :D The result is supposed to look like this: ... |
|
|
Create a Properties object and add that entry to it. Then use Properties.save() to produce your properties file. If you don't do that then you have to modify your output to follow the escaping rules required for properties files. You could read about them in the API documentation for Properties, but you really don't want to be writing code that does ... |
Thanks DrClap , If I put quotes around the location then I wont be utilizing String location. May be I think the other way to figure out which is the preselected location where I just need to drop the my file and it is read would be to write a new file and see where it gets generated. Thanks |
|
hello this is only a newbie question. I have organized my java file into a folder and sub folder e.g. c:\proj\main.java c:\proj\frame\frmMain.java when i compile main.java it doesn't detect frmMain.java how to specify the location of frmMain.java because in c\c++ you just put #include c:\proj\frame\sample.c but i can't use import c:\proj\frame\frmMain.java. Thanks guys. |
I have a program in a package that I know works properly. I had to add a functionality to it that involves reading in a file. That works as well, but only if I do not package the classes and instead put everything in the same directory. I need it to be able to find the file when using the package. ... |
I would like to try that too.... but I dont know how to do it.... I am simply selecting the file and passing the location as String.... Is it ok to change the backslash character using 'replace' function? If yes.. do I have to again escape the backslash character when I pass it as argument to the replace method? |
I see flaming others must be a part of Oracle's environment... weird, I though it was a very respectable organization, perhaps it is. Edited by: kybbles on May 10, 2010 1:11 PM Edited by: kybbles on May 10, 2010 1:13 PM Edited by: kybbles on May 10, 2010 1:21 PM Edited by: kybbles on May 10, 2010 1:22 PM |
Hi all, i am developing an i/o application. And I need some advice. When i make my application .exe file my source files is not placing in src. There are two files (.txt and . xml) that i am reading and writing. And i want these files placed in src folder so i can hide them in .exe. But when i ... |
if you have a network drive mapped to the location it's no different from creating a file on a local disk. If not, you're not going to do it, which is a good thing. Would you like anyone to create files on your computer from anywhere in the world just because your computer is connected to the internet? |
I designed some reports with iReport / Jasper report. It all works fine while running it under the netbeans IDE, but once I generate a dist and start the application from the .jar file, the reports don't print. I guess it can't find the jrxml and the jasper files. I tried copying the files to various locarions - on the root, ... |
Hi I have a web application running on tomcat. Application structure in IDE is like: Basedir/src Basedir/myFiles Basedir/Webcontent . Some of my java files need access files in Basedir/myFiles f.i : File f = new File("myFiles/xyx.txt"); This work too! Preparing for deploying to the tomcat I forced to move myFiles directory to a "package" in Basedir/src/myFiles and changing the way to ... |
|
Hi All, I am developing an application that is running on Tomcat server. As a part of project, we are using document management system based on web service. Now, when I get a file from document management system, I need to store it on the client machine which has actually asked for the file. User require to save that file without ... |