Can I include a text file to read from within java?

I have a config file I need to read within a java program called config.xml.
I want to reference this document, but don't now how to without using '..new(File("config.xml"))' and this forces me to put it in a directory somewhere.
I just want to reference it from a jar file. For example, if I put it in a jar called config.jar, and added that to my CP - how do I reference it?
THanks

Great - thanks.
One more question - Is configs in this case a java package that I would inlclude with my other packages?
For example, my main package is: main - it contains several packages with all my code. - I created a new folder in my Jbuilder environment in the same directory as the main package - called in configs - then put the config.xml file in there. If I add the package configs - it doesn't show the conifg.xml within the tree viewer of Jbuilder...do I need to put a package identification at the top of the XML file like in Java - somehting like package main.configs?
THanks, again

Similar Messages

  • How can I save a text file to disk from Illustrator ?

    Hi,
    I was looking through the Javascript reference and couldn't find anything related to writing strings to a text file on disk.
    Is this possible ? If so where should I look ?
    Otherwise, can I run a bit of code in Terminal/CommandPrompt from Illustrator (.e.g. echo 'Hello!' >> file.txt) ?

    Here's something that I think Muppet Mark or Carlos Canto posted earlier
    #target illustrator
    var textFile = File('~/Desktop/AI.txt');
    var doc = app.activeDocument;
    var docText = '';
    for (var i = 0; i < doc.textFrames.length; i++)
              docText += doc.textFrames[i].contents + '\r';
    textFile.open('e');
    textFile.write(docText);
    textFile.close();

  • Can connect but not retrieve file list (VSFTPD) from within network

    Hi!
    I've got a D-Link DIR-100 wired router to which an Airport Express and an MSI Wind (Arch Linux server) is connected. I can connect to the Wind from outside the LAN, which includes SSH, HTTP and FTP. However, FTP won't work if I'm inside the LAN. The Wind has the IP 192.168.0.101 in the network, and I forwarded the port 22 for SSH, 80 and 443 for HTTP and 20-21 for FTP. I'm using OpenSSH, Apache, and VSFTPD.
    When trying to connect with Transmit (OS X) I get this error message:
    [b]Could not retrieve file listing.[/b]
    Server said:
    Illegal PORT command.
    Error -162: PORT failed
    The Transmit log looks like this:
    Transmit 3.6.7 Session Transcript
    LibNcFTP 3.2.1 (August 13, 2007) compiled for UNIX
    Uname: Darwin|asynja.local|8.11.1|Darwin Kernel Version 8.11.1: Wed Oct 10 18:23:28 PDT 2007; root:xnu-792.25.20~1/RELEASE_I386|i386
    220: (vsFTPd 2.1.0)
    Connected to www.mydomain.se.
    Cmd: USER myusername
    331: Please specify the password.
    Cmd: PASS xxxxxxxxxx
    230: Login successful.
    Cmd: TYPE A
    200: Switching to ASCII mode.
    Logged in to www.mydomain.se as myusername
    Cmd: SYST
    215: UNIX Type: L8
    Cmd: PWD
    257: "/home/myusername"
    Cmd: PASV
    227: Entering Passive Mode (192,168,0,101,227,13).
    Fixing bogus PASV data address from 192.168.0.101:58125 to XX.XXX.XX.XX:58125.
    Data connection timed out.
    Falling back to PORT instead of PASV mode.
    Cmd: PORT 192,168,0,102,204,170
    500: Illegal PORT command.
    Cmd: NOOP
    200: NOOP ok.
    Cmd: PORT 192,168,0,102,204,171
    500: Illegal PORT command.
    (I edited out the IP and login credentials.)
    If I try to connect to 192.168.0.101 though it works like a charm. How come I can't use the same adress? I can visit the external IP/HTTP in a browser, I can connect to it through FTP, but I can't view the files?

    Interestingly, the errors above seem to be a little bit of a
    red herring. If I turn off "enable file check in and check out" in
    Dreamweaver then files can be downloaded, edited and uploaded
    perfectly. I can also create new files. As soon as I turn checkouts
    back on, it stops working. The errors above show up in the Apache
    server log even when this box is unchecked and yet everything works
    correctly. Because Contribute offers no option for editing without
    writing extra info files to the server it still won't work.
    The Dreamweaver log shows the following when I attempt to
    check out a file:
    Started: 12/19/08 6:25 PM
    Operation timed out. Cancelling...
    Operation timed out. Cancelling...
    /webdav/robots.txt - error occurred - An HTTP error occurred
    - cannot get robots.txt. Dreamweaver could not connect because the
    server is down or not accepting connections.
    File activity incomplete. 1 file(s) or folder(s) were not
    completed.
    Files with errors: 1
    /webdav/robots.txt
    Finished: 12/19/08 6:27 PM
    As I mentioned, when I turn off checkouts this whole process
    works correctly, and I can edit and create new files.

  • How can we locate the property file and read from it in .js page?

    HI
    I am having an static html page where in the url is hardcoded,so i wanted to read it from a property file and which can be done by using .js files
    i wanted to know how to deal with property files in .js?
    Thankx

    I assume you know that Java and JavaScript only share a name and they are both programming languages but little else.
    You can load JavaScript in Java 6. However for questions on what the JavaScript should do I suggest you try a javascript forum.

  • How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap?

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class? These are the keys,values: TreeMap The data I'd like to Cache is (date from the file, time of the file, current time).
    import java.io.*;
    public class CacheData {
      public static void main(String[] args) throws IOException {
      String target_dir = "C:\\Files";
      String output = "C:\\Files\output.txt";
      File dir = new File(target_dir);
      File[] files = dir.listFiles();
      // open the Printwriter before your loop
      PrintWriter outputStream = new PrintWriter(output);
      for (File textfiles : files) {
      if (textfiles.isFile() && textfiles.getName().endsWith(".txt")) {
      BufferedReader inputStream = null;
      // close the outputstream after the loop
      outputStream.close();
      try {
      inputStream = new BufferedReader(new FileReader(textfiles));
      String line;
      while ((line = inputStream.readLine()) != null) {
      System.out.println(line);
      // Write Content
      outputStream.println(line);
      } finally {
      if (inputStream != null) {
      inputStream.close();

    How can I Cache the data I'm reading from a collection of text files in a directory using a TreeMap? Currently my program reads the data from several text files in a directory and the saves that information in a text file called output.txt. I would like to cache this data in order to use it later. How can I do this using the TreeMap Class?
    I don't understand your question.
    If you don't know how to use TreeMap why do you think a TreeMap is the correct solution for what you want to do?
    If you are just asking how to use TreeMap then there are PLENTY of tutorials on the internet and the Java API provides the methods that area available.
    TreeMap (Java Platform SE 7 )
    Are you sure you want a map and not a tree instead?
    https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html

  • Browser can't find a text file opened via the save as dialogue box

    Hi there,
    I have a servlet which outputs a file using the servlet output stream, with the following lines set:
    response.setContentType("application/msword");
    response.setHeader("Content-Disposition", "attachement; filename="+ fileName);
    servletOutStream.write(myBytes);
    servletOutStream.flush();
    It works fine for .doc files and it seems the mechanism is that it is saved to the Temporary Internet Folder and delivered from there when the user clicks on the 'open' or 'save' option in the browser popup dialogue box. However... when I try this with text files, (setting the content type to "text/plain") I get the open/save dialogue box up correctly but if I try to open the file it says it cannot find the file, and gives the path under the Temporary Interenet Folder. If I look in there the text file isn't present - though the .doc files are.
    So... it looks as if the problem is that for some reason it doesn't save the text files correctly to the Temporary Internet Folder.
    I can't deliver the text files inline as a solution as the filename is lost and it thinks it's an html file (which the client doesn't want).
    Any ideas?
    Alison

    At least also set the content length. Your browser may be configured be the default application to open textfiles. If the contentlength is not set, then most applications would refuse to open the file without choosing for 'Save' first and manually open it.

  • I'm creating an epk and I need to add a bio to the menu.  Can I import the text file or do I need to retype the bio somewhere?  What is the best way to proceed?

    I'm creating an epk and I need to add a bio to the menu.  Can I import the text file or do I need to retype the bio somewhere?  What is the best way to proceed?

    Electronic Press Kit.
    Usually in the form of video outtakes, movie trailers, cast and crew interviews. Basically, the stuff that gets bunged onto commercial DVDs as extras or ends up on late night TV "Making Of..." shows.
    To answer the OP, you want a button on the menu that leads to a still image, or series of them, set up as a slide show. You can copy/paste the text in DVD Studio and then add formatting via the Text menu. (Highlight the text and right click to access formatting controls). Or do it in a graphics application using the appropriate video image preset.

  • Can Muse open existing text files authored in GoLive?

    Can Muse open existing text files authored in GoLive and or Dreamweaver?

    Unfortunately not, for now, Muse can only open .muse extension files, created within Muse.

  • I can´t edit the text files with SAP BODS 3.2

    Hello
    I can not edit some text files 9-20 megabytes to replace two words in each file, the source is a text file and the same destination but with different name, because with the same name have been unable . My idea is to remove the original and stay with the new performing edition but that if he does , let me file this way:
    SALES_ORDERS_FULL_20140223_150051_006.xml ( ORIGINAL )
    should leave it with me so : SALES_ORDERS_FULL_20140223_150051_006.xml _OLD (AMENDED )
    but strangely leaves me so :
    MICROSOFT_SQL_SERVER_KCC-BI_REPO_KHSA_XI_REPO_KHSA_XI_1543_5434_2_3_Long_INVOICES_INCREMENTAL_20140225_034004_001_xml_dat.txt  (not deseased)
    The type of data you use is long since varchar not allow me because it cuts my data file , use varchar (50000000) but takes the information and short .
    I am using long data type , modify the file and I pass the name of the text files of sap bods for global variables. They are a series of files that are called by a while loop
    Thanks for your answers
    regards

    HIr
    Yes, first I convert long_to_varchar for edit, and convert varchar_to_long.
    I edit before before and later
    Thanks

  • Is there a way to download text files and ebooks from Mac to iPad

    How do I transfer text files and ebooks from my Mac or PC to Ipad

    Read here.
    http://support.apple.com/kb/ht4094
    you can transfer the files to the Apps that support them. pdfs and ebooks can be loaded onto iBooks for instance.
    For regular text files you may need a notes or Text App from the App store.

  • Hi, I have a version of CS4 on my Mac.  I can not longer open Raw files with it from my Canon 5D.   I never had problems with it in the past.  What can I do?

    Hi, I have a version of CS4 on my Mac.  I can not longer open Raw files with it from my Canon 5D.   I never had problems with it in the past.  What can I do?

    is that the eos 5d?
    if so, you only need cr 3.3 or greater.  what version do you have in your cs4? (help>about plugins>camera raw)
    if you need to update it, http://www.adobe.com/downloads/updates/

  • Read an avi file using "Read from binary file" vi

    My question is how to read an avi file using "Read from binary file" vi .
    My objective is to create a series of small avi files by using IMAQ AVI write frame with mpeg-4 codec of 2 second long (so 40 frames in each file with 20 fps ) and then send them one by one so as to create a stream of video. The image are grabbed from USB camera. If I read those frames using IMAQ AVI read frame then compression advantage would be lost so I want to read the whole file itself.
    I read the avi file using "Read from binary file" with unsigned 8 bit data format and then sent to remote end and save it and then display it, however it didnt work. I later found that if I read an image file using "Read from binary file" with unsigned 8 bit data format and save it in local computer itself , the format would be changed and it would be unrecognizable. Am I doing wrong by reading the file in unsined 8 bit integer format or should I have used any other data types.
    I am using Labview 8.5 and Labview vision development module and vision acquisition module 8.5
    Your help would be highly appreciated.
    Thank you.
    Solved!
    Go to Solution.
    Attachments:
    read avi file in other data format.JPG ‏26 KB

    Hello,
    Check out the (full) help message for "write to binary file"
    The "prepend array or string size" input defaults to true, so in your example the data written to the file will have array size information added at the beginning and your output file will be (four bytes) longer than your input file. Wire a False constant to "prepend array or string size" to prevent this happening.
    Rod.
    Message Edited by Rod on 10-14-2008 02:43 PM

  • 求助: 如何使用write to spreadsheet file.vi 和 read from spreadsheet file.vi, 并且如何定义它们的路径???

    请问如何使用write to spreadsheet file.vi 和 read from spreadsheet file.vi,我知道spreadsheet file.vi只支持.txt文件,但我应该在哪里设置它们的路径呢,请各位帮忙指点,能不能具体说明下,谢谢...

    write to spreadsheet file.vi 和 read from spreadsheet file.vi,支持.xls文件.
    可以在path处设置它们的路径.

  • I am having issues with Sidebar files not appearing from within InDesign CS5.5. They show up fine from other Adobe applications. Using OS10.6.8.

    I am having issues with Sidebar files not appearing from within InDesign CS5.5. They show up fine from other Adobe applications. Using OS10.6.8.

    I would first of all trash the preference file for InDesign, make sure the application is closed then find the prefs in
    /Users/USER NAME/Library/Preferences/Adobe InDesign and just throw the entire folder away, it will generate a new one after you launch InDesign again.
    Now launch InDesign and see if the problems are resolved.
    If not I would repair your permissions on your hard drive wih disk utility, and if that fails then di-install InDesign and re-install that single application.
    Let me know if any of these suggestions work for you
    I will be checking my email although you might have to wait for a response as I will be taking a microlight flight over the Victoria Falls tomorrow. Yay can hardly wait.

  • How do I integrate adobe reader from within a wxwidgets project?

    Obviously I'm new to the world of adobe pdf reader.  I would like to integrate pdf reader from within a wxwidgets application I am writing.   I am trying to accomplish the following.
    1.  Control the size, positioning and what options are available of a pdf viewer and have it part of a frame that we control the general look and feel.
    2.  Highlight search words found within the article (from a previously executed search that brought me to the article)
    This project will be used to display millions of technical and scientific papers.  There will be no cost to access the papers or to even publish new ones.  The is being done by a non-profit society.  They will be peer-reviewed and Authors will have total control of their content without feer of unauthorized modification.
    We currently display the pdf by calling a webbrowser and that works, but so far I haven't found a way to communicate through the browser to the pdf plug-in so I can accomplish #2 above.
    I see two possibilities on going forward.
    A.  Find a way to communicate with the plug-in via the xulrunner browser.
    B.  Integrate an adobe object directly from within our program and then communicate with it.  (this options seems like a more likely candidate to establish comminication, but then there is an issue of getting it within the project and distributed to the end user - So far we have managed to avoid any installation procedure).
    Could someone give me a good starting point on what I might have to do to go forward to access the reader so that I can highlight the search words?
    I would really appreciate any help or direction that I can get.
    Jay Potter

    This will not technically a cross-platform project.   For now I'm doing all my development in windows, Although in the future I might have a parallel development in mac.
    I did some testing on the open parameters as you suggested and was quite disappointed.  When I "searched" for a word, it did not highlight all the matches, but just one at a time.  I also found that if I searched for two words that the order of the words changed the results.  In one case by reversing the order I not only didn't get any highlights but the article would not even display.  So far I am not impressed.
    At this point I'm more inclined to integrate the reader directly in the project.  Assuming that is possible, I would like to manually highlight all the occurances of a set of words without relying upon the search mechanism.  Can I do this in the API?

Maybe you are looking for

  • How can I remove my ebooks from iTunes Connect???

    I'm tring to use iBooks Author and iTunes Producer/connect without success... I've 2 books with tickets and I would like to delete that and try again (maybe I need to read the iBooks Author user manual).. can anyone halps me?? tnks Luca

  • Windows 8.1 Blue Screen of Death

    Hi Again! I'm getting the BSOD once again, here are my files: https://www.dropbox.com/s/zsyrae2s3fq8x2c/Minidump3.rar?dl=0 Some are DRIVER_POWER_STATE_FAILURE's and others aren't.

  • Wifi is not working properly once i updated to the new operating system.

    My I pphone 4s wifi is not working properly once the softwere is updated to the new IOS. It shows the wifi but when selected its says "unable to connect". I tried connecting to many wifi networks but gives the same error message. Kindly advice how to

  • Files in Storage Spaces taking WAY too much space

    If you look at the following two Images: You'll notice that while I have only 629 GB of files on the Storage Space, it is taking up an astounding 2.45 TB in my Storage Space. With the two-way mirror I have set up it should only be about 1.26 TB. I'm

  • Unable to access queries in Universe created over infocubes

    Hello Gurus Im having a weird situation over here with my queries created over BI content info cubes.Ive gone through all the threads related to my issue and ive tried more or less all the solutions specified. I hope i would get a different solution