How to make a java program that will give you the list of files in the dir

How can you make a program in java that will list all the files in a directory with out useing the File,FileWriter,FileReader,InputStreamReader,FileInputStream,RandomAccessFile etc. classes

What is with these instructors? So far today I have
seen
Do something 100 times, but don't use a loop
Format numbers, but don't use NumberFormat
and now this.
What are these people trying to teach?
Java??? I don't think so.Perhaps it is because these instructors are learning Java at the same time as their students. They are only one chapter ahead of the students. :(

Similar Messages

  • How to make a Java program that recognises a function of two variables...

    How to make a Java program that recognises a function of two variables to assign values to that?
    First I will give an example and then do the question.
    Ex1.
    We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
    To build the graph of this function attach values to 'x' to find the values of 'y'
    And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
    Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
    We can use any numbers, but arfer interval [-3.3]
    X | y = x ^ 2 + 1
    -3 | Y = (-3) ^ 2 +1 = 10
    -2 | Y = (-2) ^ 2 +1 = 5
    -1 | Y = (-1) ^ 2 +1 = 2
    0 | y = (0) ^ 2 +1 = 1
    1 | y = (1) ^ 2 +1 = 2
    2 | y = (2) ^ 2 +1 = 5
    3 | y = (3) ^ 2 +1 = 10
    We then ordered the pairs:
    (-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
    Tabem that can be represented by a table:
    X | y
    -3 | Y = 10
    -2 | Y = 5
    -1 | Y = 2
    0 | y = 1
    1 | y = 2
    2 | y = 5
    3 | y = 10
    Now I begin to explain my doubts.
    See this program:
    Ex2
    * To change this template, choose Tools | Templates
    * And open the template in the editor.
    Encontrando_o_valor_de_y package;
    * @ Author des Soldat Gottes
    Import javax.swing.JOptionPane;
    Public class (Main
    * @ Param args the command line arguments
    Public static void main (String [] args) (
    Int x, y;
    String x1;
    X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',"); / / receives a value for the function y = x + 1
    X = Integer.parseInt (x1); / / tranforma String in int
    Y = x + 1; / / receives the value of 'x' and calculates' y '
    JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
    / / Displays the value of 'y'
    System.exit (0);
    We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
    In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',");
    The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
    The question is: would it be possible to come to a function?
    Ex: the program ask: DIGITE THE FUNCTION?
    The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
    The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
    And then to find the values of the x and y launch a table.
    It would be possible that?
    By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
    I hope it has been easier to understand my doubts now.
    Thank you for your attention!
    God bless!

    rafaelmenezes wrote:
    Thanks for the explanation, could understand what fly said.
    But as it applied to a program?
    How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
    Strip out the spaces
    Split the String on "x^"
    That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
    Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
    That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
    You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you.

  • How to make a Java application that will change the client box's IP address

    HI how to make a Java application( that application would be run on the client ) that will change the client box's IP address ( IP address of itself )

    If you can do that through the command line, then use Runtime.getRuntime().exec(...) to execute your command.

  • How to make a java program, that can be used by c++ application

    I'm developing a Java web application (WEBapp), but I have also a c++ program.
    C++ program must use WEBapp method to communicate on the web.
    How to make a Java public function that accept value, elaborate, then return the resul to c++ application?

    jschell wrote:
    You have C code.
    You have Java code.
    The two must communicate.I have a c++ program, and a Java program.
    C++ program wants to communicate on the web (send text), and I'm trying to add this functionality to it creating a Java program.
    NOW THE PROBLEM? How c++ program can use java-program (in local) to send data on the web?
    You can just JNI to communicate either from java to C++ or from C++ to java. That is direct communication in that there is a single process involved. Thus you will no longer have a java application and a C++ application but rather a single application.I don't know JNI, i found http://java.sun.com/docs/books/jni/ and I think is too difficult to implement?
    You can use files or sockets to communicate. Using sockets allows for any number of additional protocols including the previously mentioned web services. Those methodologies would allow more than one application to exist.I developed yesterday a java-side-interface using socket (in local host 127.0.0.1). So the c++ program must write or read to/from the socket to comunicate to java (then the java program send data on the web).
    Finally it might be the case that you have a C++ application which you cannot modify. In that case then you MUST use whatever input/output mechanism that it supports. There is no choice. And until you have fully determined what those mechanisms are it is pointless to discuss a solution.I can modify the application, but I don't have developed it. The c++ application use a third-part dll (taken from SKYPE) to comunicate on the web: I have to remove the dipendence from this dll, and add the java program: java program must substitute the dll. It must be non-invasive to the c++ program. DLL calls can be "send(data)" or "receive(data)" or similar.
    For this do you think that JNI is a must, or I can use soket on local host?

  • Is there a code checker that will give you the correct code?

    I have a website that I started using a bought template, I deleted all of the content except the navigation buttons.  The problem now is that there are ALOT of broken links and coding errors.  Is there a site that will show me what the correct code should be?
    www.cfaai.com
    Heidi

    Hello Heidi,
    I prefer an external FTP program. The difficulties with which you have to fight encourage me in this opinion, not least because we always search for experts, we don't charge a "jack of all trades".
    For this reason, to manage, for example, several websites or to upload my files and sometimes for the opposite way, for a necessary download from my server or to use a "a site-wide synch", I'm using FileZilla. It simply looks easier for me to keep track of all operations precisely and generate or reflect easily the desired tree structure.
    Above all, FileZilla has a feature (translation from my German FileZilla) called "compare file list". Here it's possible to use file size or modification time as a criterion. There is also the possibility to "hide identical files", so that only these files which you want to redact remain visible.
    And even if it means you have to install a new program, I am convinced that there is an advantage. Here is the link to get it and where you can read informations about how it works:
    http://filezilla-project.org/ and
    http://wiki.filezilla-project.org/Tutorial#Using_the_site_manager
    Mac: Mac OS X
    http://filezilla-project.org/download.php
    Of course, you also need all the access data to reach your server.
    Good luck
    Hans-Günter

  • I'm I'm using a video editing program that will only accept music in MP3 file form, so it won't let me use any of my itunes music.  Is there a way to convert itunes music files to MP3 files?

    I'm using a video editing program that will only accept music in MP3 file form, so it won't let me use any of my itunes music.
    Is there a way to convert itunes music files to MP3 files?

    There is HangTimes' never fail method:
    http://www.bulletsandbones.com/GB/FAQPages/NeverFail.html

  • There is am add-on that lets you stop over a word and it will give you the opitions of looking uo futher info but I can't find it.

    I have an account but it's not accepting my pass word so I had to re-register. That's not my problem though. I don't have a real problem I love Fire Fox but my system crashed and I'm starting all over again. There is an add-on that let's you stop over a word on any page and it will give you the option of looking up more info on that subject ( I think from Wikipedia, but not sure?). It will give you a little box like a comic strip person talking and then you can go to the box. You can then click on the box to get more info. I can't find this anywhere, can anyone help? Thank you.

    What you want is APTURE HIGHLIGHTS but unfortunately it is buggy as I found out: [[https://support.mozilla.com/en-US/questions/786091|see thread here ]]

  • Is there a command i can run that will give me the serial number

    is there a command i can run that will give me the serial number on solaris-9

    Imtiaz77 wrote:i got it thankx
    root@sunfire2# sneepThat only works if ...
    1) you know about SNEEP
    2) you hardware is compatible
    3) you install it and configure it properly
    The answer to your original quetion is:
    No, there is nothing already in Solaris 9 that lets you type a command and get a serial number.

  • HT5493 how about giving us a URL that will result in the the "missing plug-in" region appearing so that we can proactively download new java version?

    just accepted OSX update for Oracle SE Java - want to make sure the new plug-in is installed before giving access to wife - need a URL that will ask for the plug-in to be downloaded as the OSX update only removed the apple version.

    How do I test whether Java is working on my computer?

  • How to make a java-program to a exe file runing on windows?

    i kown that there were many topics on this problem.
    i want to kown how many kinds method to do this i can use now!
    i met a java-program can run on windows,but i don't find ant *.class
    files and *.jar files.it's extended file type is ".ese".
    thanks very much

    There are commercial products that allow you to do this (e.g. InstallAnywhere from http://www.zerog.com).
    One issue is that you have to decide whether you want to bundle a JRE with your program or not. If you do (and you should, in these days of XP shipping without any VM of its own), your program will be a minimum of about 9MB + whatever you actually add as part of your program :-).
    In any case, this is not a trivial undertaking.

  • How to make a java program run as a background process.

    </pre>
    writing a client server application.
    a program is supposed to run on a the client right from the time the client turns on the computer till the computer is turned off.
    the catch is the client should all the time be unaware of the program running in his computer, no dos prompt window, no icon on the taskbar,etc. can i convert it the class file into an exe file through software and put the exe filename in autoexec.bat. But then i think that the dosprompt window will open up on starting, but the client should see nothing.
    please help
    </pre>

    </pre>
    Thanks Daniel and jesper,
    could not really fully understand what you mean.
    creating a batch file is okay, but do you configure it
    to run in a an hidden mode.
    Also I have no idea of how to make a window
    service.can you please elaborate a bit
    </pre>

  • How to make a slide show that will play on a TV?

    I have a
    collection of pics that I have used the slideshow module t
    o create a slide show and it works great on my PC. How do
    I create one that I can burn to a disk and play on a TV?
    Do I need to purchase
    something else or will Lightroom3 do what I need? The slideshow that I created will play on other computers but, when I put it in a dvd player for the TV it says there is no disk in it. I have tried 4 different players. Am I missing something?
    I would be very gratefull for help with this!

    Alternatively, you can export a H264 mp4 from the slideshow module, dump it on a memory stick (or plain DVD) and stick it in the TV or your BluRay player
    Not all Blu-ray palyers can play MP4 container video files. So this may, or may not work depending on your Blu-ray player's capabilities. ALL Blu-ray players will play H.264 AVC HD video with .MTS file format, but Lightroom 3  does not offer this as a slideshow export option.
    See the 'Overview' section here for more information on the file system and folder organization:
    http://en.wikipedia.org/wiki/AVCHD
    The folder structure when using USB and SD media is different than DVD media! More information here:
    http://multiavchd.deanbg.com/tutorial.php

  • How to resolve a Lenovo PC that will not pass the Lenovo Splash screen with no access to Windows

    Here is my problem and here is the solution!!!
    My B540 Ideacentre would not pass the Lenovo splash screen. The only operational keys I had was F1 (BIOS) and F12 (BIOS options). F2 went to a light blue screen so no chance of even a one key recovery. Warrenty had expired four and a half months ago. I contacted Lenovo and after the guy told me to try F2 twice he said it was a HDD or other hardware failure and would cost around £200 maybe and also would take about two weeks. 
    AT THIS POINT YOU SHOULD NOT BE ANGRY FRUSTRATED OR PANIC. REMAIN CALM AND STOP AND THINK WHAT ACTUALLY WAS HAPPENING WHEN YOU LAST USED YOUR PC.
    For me I remembered Windows had auto downloaded 8.1 and was asking me to install. Also my keyboard had lost shift W T Y keys. This told me that it was not a hardware issue but a software issue and perhaps from this update. My HDD was not clicking or beeping and this PC has a 2TB Seagate Barracuda which has a good reputation. Luckly for me I also have a Seagate external expansion 2TB and a 500MB expansion which was the HDD from my old HP Touchsmart which I converted into an external hard drive by buying a HDD enclosure with cooling fan and all leads from eBay for £25 and this is where the solution is.
    If you can create an expansion drive so easily and access the HDD then why cant I do it with the HDD from my Ideacentre and of course you can. So first unplug your PC or laptop. Next remove the cover and unclip the HDD (which is easy with the B540. See user instructions). Next I removed my HP HDD from the enclosure and fitted my Ideacentre HDD in its place. Next you need a laptop or another PC. Switch it on and then connect your HDD to the laptop or PC via highspeed USB cable. My laptop is running Windows 7 Ultimate and of course has all the repair tools required. When the software has loaded you may get a box that will have two options. The first will ask you if you want to repair your files and the second to scan for bad sectors and to attempt repair recovery of sectors. Tick both boxes and click start. This is a long slow process but worth the wait. Nine hours later my HDD was ready. I connected my Seagate expansion to my laptop and moved all new files that I had not backed up. So at this point you should create a folder and move all your photos music videos documents etc to it. This can take upto three hours if you have never backed up before and are moving everything. Once completed I shut everything down and replaced the HDD into my Ideacentre. Make sure do not have any external devices connected such as expansions external drives headphones etc. Connect the power and switch on. The Ideacentre booted up and there was a pause at the splash screen then it went to a black screen and then by the miracle of logical thinking I was at my lock screen. I was never so glad to see the map of my home land "Ukraine". After jumping up and down with joy I then went in and all was as normal but to be sure I went into safemode and started a complete restore. This is the option where you completely format your HDD and restore as new. It takes a long time but it is the best option because you do not want this to happen again. When this has completed and you are in Windows do not wait a moment longer by playing with your photos or creating your desktop picture. Go to create a recovery drive (use a 32GB stick) and after that also make a copy to disc. Next go to command prompt (cmd) Admin and change a setting by typing bcdedit /set {default} bootmenupolicy legacy. This will now enable your F8 key to boot straight into safemode just incase you need to in the future. It will slow boot time a little but better to be able to get in to Windows than not at all for the sake of a few seconds. 
    Well I hope this helps someone out there and I know you may think its a lot to do but it is not. Ask a friend to borrow a laptop or PC and perhaps a HDD encloser. The rest is just time but when you see your lock screen you will not care trust me. 
    Cлава Україні!!! Героям слава!!!

    I thought this was the method I used before but I followed through it and it was a horrific fail.  "Operating system not found".  Can anyone help?
    http://superuser.com/questions/421402/how-to-create-a-bootable-usb-windows-os-us ing-mac-os-x
    Steps To Achieve Victory
    Download the ISO you want to use
    Open Terminal (in /Applications/Utilities)
    Convert .iso to .img using hdiutil:
    hdiutil convert -format UDRW -o /path/to/target.img /path/to/source.iso
    Rename if OS X gave it a .dmg ending:
    mv /path/to/target.img.dmg path/to/target.img
    Type diskutil to get a list of currently connected devices
    Insert USB drive you want to use
    Run diskutil again to see what your USB stick gets assigned eg - /dev/disk3
    Run diskutil unmountDisk /dev/diskN (where N is the number assigned to your USB stick, in previous example it would be 3)
    Run sudo dd if=/path/to/target.img of=/dev/diskN bs=1m (if you get an error, replace bs=1m with bs=1M
    Run diskutil eject /dev/diskN and remove your USB stick
    The USB stick will now be ready to use
    Also similarly described here: http://www.tomshardware.co.uk/answers/id-1733410/creating-microsoft-bootable-usb -mountain-lion.html#.

  • How to make layers transparant so that they shine through the layers above it?

    Well, the topic question kind of nails it; i'm wondering if it is possible to get layers which are 'lower' situated to shine through 'higher' situated layers. I'm no good at photoshop and i find fireworks a much easier program to use to edit my images. Im trying to place different drawings of mine over each other but i would really like it if they shine through one-another. Can anybody help me this? I did find an option in the top of the layer screen with which i can get this shine-through effect but it alters the colour a lot. Is there way to get this shine-through without the colour alternation?
    P.s i'm usin cs 4.
    Thanks in advance!

    I often have to prototype a dialog pop-up over the page making the rest of the page low-contrast & blury.  To do this I place a layer above what I want to blur out.  In that "blur" layer I put a light gray rectangle that covers the entire page.  To the rectangle I added a Filter > Blur > Guassian Blur set at  4.1.  In the layer I set the opacity at 70%.  See if that does what you want.

  • Make a background photo that will resize to the users browser size

    I'm trying to create an effect like this in Iweb:
    http://neistatbrothers.com/
    You'll notice that the background image resizes to the browser size.
    I have read threads like that say to edit the HTML from "Scroll" to "Fixed"... that doesn't seem work.
    THIS website is NOT what I am looking for.
    THIS website is NOT what I am looking for.
    Thanks!

    Thanks Wydor,
    I'm trying to decode this very elegent and cryiptic answer. I am an iweb user after all so I need a few more baby steps. I'm going to try and over-communicate to clarify. This response is long, but I appreciate your help.
    The link that you sent me (the way that page looks) is exactly what I am looking for.
    So I'm assuming that this is the code I will need :
    <script language="JavaScript" type="text/javascript">
    <!--
    parent.document.body.style.backgroundImage='url(../images/beach.jpg)';
    parent.document.body.style.backgroundRepeat='no-repeat';
    parent.document.body.style.backgroundPosition='50% 0%';
    parent.document.body.style.backgroundAttachment='fixed';
    parent.document.body.style.MozBackgroundSize = 'cover';
    parent.document.body.style.backgroundSize = 'cover';
    // -->
    </script>
    And of course changing the image title and folder.
    From iweb I have downloaded my "site" to a local folder where I can edit the HTML files from Dashcode 3.0.1.
    The code looks like this for that page which I have titled "Blank", the Image I want to use is titled "SNV33631.jpg"  :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="Generator" content="iWeb 3.0.4" />
        <meta name="iWeb-Build" content="local-build-20110920" />
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <meta name="viewport" content="width=700" />
        <title>Blank</title>
        <link rel="stylesheet" type="text/css" media="screen,print" href="Blank_files/Blank.css" />
        <!--[if lt IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Blank_files/BlankIE.css'/><![endif]-->
        <!--[if gte IE 8]><link rel='stylesheet' type='text/css' media='screen,print' href='Media/IE8.css'/><![endif]-->
        <script type="text/javascript" src="Scripts/iWebSite.js"></script>
        <script type="text/javascript" src="Scripts/Widgets/SharedResources/WidgetCommon.js"></script>
        <script type="text/javascript" src="Scripts/Widgets/Navbar/navbar.js"></script>
        <script type="text/javascript" src="Blank_files/Blank.js"></script>
      </head>
      <body style="background: rgb(255, 255, 255) url(Blank_files/SNV33631.jpg) repeat scroll top left; margin: 0pt; " onload="onPageLoad();" onunload="onPageUnload();">
        <div style="text-align: center; ">
          <div style="margin-bottom: 0px; margin-left: auto; margin-right: auto; margin-top: 0px; overflow: hidden; position: relative; word-wrap: break-word;  background: transparent; text-align: left; width: 700px; " id="body_content">
            <div style="margin-left: 0px; position: relative; width: 700px; z-index: 0; " id="nav_layer">
              <div style="height: 0px; line-height: 0px; " class="bumper"> </div>
              <div class="com-apple-iweb-widget-navbar flowDefining" id="widget0" style="margin-left: 35px; margin-top: 0px; opacity: 1.00; position: relative; width: 630px; z-index: 1; ">
                <div id="widget0-navbar" class="navbar">
                  <div id="widget0-bg" class="navbar-bg">
                    <ul id="widget0-navbar-list" class="navbar-list">
    <li></li>
    </ul>
    </div>
    </div>
              </div>
              <script type="text/javascript"><!--//--><![CDATA[//><!--
    new NavBar('widget0', 'Scripts/Widgets/Navbar', 'Scripts/Widgets/SharedResources', '.', {"path-to-root": "", "navbar-css": ".navbar {\n\tfont-family: Arial, sans-serif;\n\tfont-size: 1em;\n\tcolor: #666;\n\tmargin: 9px 0px 6px 0px;\n\tline-height: 30px;\n}\n\n.navbar-bg {\n\ttext-align: center;\n}\n\n.navbar-bg ul {\n\tlist-style: none;\n\tmargin: 0px;\n\tpadding: 0px;\n}\n\n\nli {\n\tlist-style-type: none;\n\tdisplay: inline;\n\tpadding: 0px 10px 0px 10px;\n}\n\n\nli a {\n\ttext-decoration: none;\n\tcolor: #666;\n}\n\nli a:visited {\n\ttext-decoration: none;\n\tcolor: #666;\n}\n\nli a:hover\r{\r\n \tcolor: #463C3C;\n\ttext-decoration: none;\r}\n\n\nli.current-page a\r{\r\t color: #463C3C;\n\ttext-decoration: none;\n\tfont-weight: bold;\r\r}\n", "current-page-GUID": "68D4EEAC-3DE6-4685-B7F9-9DBD522AB485", "isCollectionPage": "NO"});
    //--><!]]></script>
              <div style="clear: both; height: 0px; line-height: 0px; " class="spacer"> </div>
            </div>
            <div style="float: left; height: 0px; line-height: 0px; margin-left: 0px; position: relative; width: 700px; z-index: 10; " id="header_layer">
              <div style="height: 0px; line-height: 0px; " class="bumper"> </div>
              <div style="height: 1px; width: 630px;  height: 1px; left: 35px; position: absolute; top: 3px; width: 630px; z-index: 1; " class="tinyText">
                <div style="position: relative; width: 630px; ">
                  <img src="Blank_files/shapeimage_1.jpg" alt="" style="height: 1px; left: 0px; position: absolute; top: 0px; width: 630px; " />
                </div>
              </div>
            </div>
            <div style="margin-left: 0px; position: relative; width: 700px; z-index: 5; " id="body_layer">
              <div style="height: 0px; line-height: 0px; " class="bumper"> </div>
              <div style="height: 480px; line-height: 480px; " class="spacer"> </div>
            </div>
            <div style="height: 150px; margin-left: 0px; position: relative; width: 700px; z-index: 15; " id="footer_layer">
              <div style="height: 0px; line-height: 0px; " class="bumper"> </div>
            </div>
          </div>
        </div>
      </body>
    </html>
    My question are as follows
    1: Where do I paste the code you gave me.
    2: do I need to reformat or add modifiers like, "<" or ">" to it because it is Javascript not HTML code.
    3: do I paste it in the "Index" file or the "Blank" file.
    Thanks

Maybe you are looking for