How to find cd rom drive in windows and unix platform using java program

Hi,
I am having the requirement of finding the cd rom drive
using java program. I do not know the label and which
one is the cd rom drive. also I want to know how many
cd rom drives are there on my system. I want the solution
for windows and unix platforms.
If have any suggestions please mail to [email protected]
Deepak

Ughhh.. I had the same problem with multi platform file-system detection
First off - Unix.
Do you know for sure you have all your drives mounted?? This could be a big problem because java will not see unmounted drives... So you can scour thru your /etc/fstab to find out which drives are available... or you can mount all and show roots... (Yuck!)... You've got timeouts and all sorts of things to worry about...
I would then shy away from the java.io.File.listRoots() on unix and rely on parsing your fs file. If a user would like to see the medium in the drive. Do a Runtime.exec and mount the drive, then you can grab the filesystem by wrapping it in the java.io.File object. ( NOTE - this will hold well for your NFS mounts as well which might be buried under other FS. So you now have detection for that as well. ) Labels are also noted in this file. Let me know if you don't know the difference between mtab and fstab....
Second - Winders.... Corney but I love saying that.
The listRoots is a good solution. As others have said CD-ROMS will not be writable. Use a combination of getName and getPath to decipher the label and mount point.
Hope this helps!

Similar Messages

  • How to Mount IBM Tape Drive on windows 2008 SAP Platform

    Hi Expert,
    What are the steps for Mount IBM Tape drive on windows 2008 SAP Platform on Sybase Database ?
    After mounting IBM Tape Drive on windows 2008 SAP Platform , can i use this for Sybase Backup purpose from DBACOKPIT ?
    Kindly reply me ASAP.

    Dear All,
    Problem Solved by below activity :-
    http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc38421.1572/doc/html/san1335472614455.html?resultof=%22%64%75%6d%70%22%20%22%64%61%74%61%62%61%73%65%22%20%22%64%61%74%61%62%61%73%22%20
    1> dump database pubs2 to "\\.\TAPE0"
    2> go
    1> load database pubs2 from \\.\TAPE0
    2> go
    Please review  any of these SAP Notes to see if you would be able to
    setup dump/load and then copy to tape as an option.
    1585981 SYB: Ensuring Recoverability for Sybase ASE  (has some
    comments about storing to tape drive)
    1588316 SYB: Configure automatic database and log backups
    1611715 SYB: How to restore a Sybase ASE database server (Windows)
    1618817 SYB: How to restore a Sybase ASE database server (UNIX)
    1887068 - SYB: Using external backup and restore with SAP Sybase ASE
    Configuration DEVDB:
    1> sp_config_dump @config_name='DEVDB' ,
    2> @stripe_dir = "\\.\Tape0" ,
    3> @compression = '101' ,
    4> @capacity = '1520000040960' ,
    5> @verify = 'header'
    6> go
    Configuration DEVLOG:
    1> sp_config_dump @config_name='DEVLOG' with init,
    2> @stripe_dir = "\\.\Tape0" ,
    3> @compression = '101' ,
    4> @capacity = '1520000040960' ,
    5> @verify = 'header'
    6> go
    1> dump database DEV using config = 'DEVDB' with capacity = 87000000, init
    2> go
    1> dump transaction DEV using config = 'DEVLOG' with capacity = 87000000, init
    2> go
    and
    1> dump database DEV to "\\.\TAPE0" with   capacity = 87000000, init
    2> go
    1> dump transaction DEV to "\\.\TAPE0" with   capacity = 87000000, init
    2> go

  • How to find out top 10 records from the R/3 using Java code (WD Program)

    Hi Experts,
    I have used Java Web Dynpro program to fetch records from the backend. Following code helps me and fetches record. As per the customer reqirement, we have to fetch only top 10 records (Actual Cost) from the backend. So I have to modify the Java code. How I can do so? Please help.
              wdContext.nodeGraphData().invalidate();
              IPublicCostcnt.IGraphDataElement categoryElement;
                   for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
                   categoryElement = wdContext.createGraphDataElement();
                   categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
                   categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
                   categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
                   wdContext.nodeGraphData().addElement(categoryElement);
    Regards,
    Gary

    Dear SDN Users,
    This is how I resolved the issue.
    1) Requested ABAPer to provide me sorted data. The data has been sorted in descending order of actual_cost.
    2) After that I used following code. This resolved the issue.
         if (wdContext.nodeItab_Final1().size()>10){
         IPublicCostcnt.IGraphDataElement categoryElement;
              for (int i = 0; i < 10; i++) {
              categoryElement = wdContext.createGraphDataElement();
              categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
              categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
              categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
              wdContext.nodeGraphData().addElement(categoryElement);
         if (wdContext.nodeItab_Final1().size()<=10){
         if (wdContext.nodeItab_Final1().size()>0){
         IPublicCostcnt.IGraphDataElement categoryElement;
              for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
              categoryElement = wdContext.createGraphDataElement();
              categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
              categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
              categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
              wdContext.nodeGraphData().addElement(categoryElement);
    Regards,
    Gary

  • How to find out all the text elements in the report using Java?

    How to trace the contents of an rpt file?
    I am able to open the rpt file in my report viewer but can not trace it using the JAVA code.
    Actually, I need to find out all the text elements of rpt (Report) file and replace them with the contents of resource bundle.
    My Java code to open a report is given below:
    import com.crystaldecisions.reports.sdk.ISubreportClientDocument;
    import com.crystaldecisions.reports.sdk.ParameterFieldController;
    import com.crystaldecisions.reports.sdk.ReportClientDocument;
    import com.crystaldecisions.sdk.occa.report.data.ConnectionInfo;
    import com.crystaldecisions.sdk.occa.report.data.ConnectionInfos;
    import com.crystaldecisions.sdk.occa.report.data.Fields;
    import com.crystaldecisions.sdk.occa.report.data.IConnectionInfo;
    import com.crystaldecisions.sdk.occa.report.data.ParameterField;
    import com.crystaldecisions.sdk.occa.report.data.ParameterFieldDiscreteValue;
    import com.crystaldecisions.sdk.occa.report.data.Values;
    import com.crystaldecisions.sdk.occa.report.lib.IStrings;
    import com.crystaldecisions.sdk.occa.report.lib.PropertyBag;
    import com.crystaldecisions.sdk.occa.report.lib.PropertyBagHelper;
    import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
    import com.crystaldecisions.sdk.occa.report.reportsource.IReportSource;
    public String viewRpt()
                   //1.) Setting Database Infos
                            IConnectionInfo iConnectionInfoObj=setDatabaseConnectionInfos();
                   //2.) Setting Report Path
                   String reportPath=u201DE:
    was60
    rptFilesLocation
    u201D;
                   reportPath=(reportPath!=null)?                                             reportPath:AppConstants.CONSTANTS.BLANK;
                   String reportName="report1.rpt";
                   String reportFullPath = reportPath +   rptName;
                 //3.) Setting Report Source
                             ReportClientDocument reportClientDoc = new ReportClientDocument();
                                              reportClientDoc.open(reportPath, 0);
                  IReportSource reportSource = reportClientDoc.getReportSource();
                  setReportSource(reportSource);
                  reportClientDoc.close();
              //4.) Setting the Fields Starts
              setFieldsCrystal(null);
              Fields fields = new Fields();
              ParameterField pfield1 = new ParameterField();
              Values vals1 = new Values();
              ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();
              pfield1.setName("@parameter1");
              pfieldDV1.setValue(u201Cvalue1u201D);
              vals1.add(pfieldDV1);
              pfield1.setCurrentValues(vals1);
              fields.add(pfield1);
              pfield1 = new ParameterField();
              vals1 = new Values();
              pfieldDV1 = new ParameterFieldDiscreteValue();
              pfield1.setName("@parameter2");
              pfieldDV1.setValue(u201Cvalue2u201D);
              vals1.add(pfieldDV1);
              pfield1.setCurrentValues(vals1);
              fields.add(pfield1);
              setFieldsCrystal(fields);
              //Setting the Fields Ends
    The sample jsp code to view the report is as follows:
    <%@taglib uri="http://www.businessobjects.com/jsf/crystalreportsviewers"
         prefix="bocrv"%>
    <bocrv:reportPageViewer viewerName="CrystalViewer"
                                                 reportSource="#{CrystalReportBeanObject.reportSource}"
                                                 displayToolbarRefreshButton="false"
                                                 allowDatabaseLogonPrompting="false"
                                                 allowParameterPrompting="false"
                                                 databaseLogonInfos="#{CrystalReportBeanObject.connectionInfosCrystal}"
                                                 parameterFields="#{CrystalReportBeanObject.fieldsCrystal}"
                                                 displayGroupTree="false" displayToolbarLogo="false"
                                                 displayToolbarToggleTreeButton="false"
                                                 enablePageToGrow="false" height="540"
                                                 zoomPercentage="100" width="750"
                                                 allowDrillDown="false"
                                                 displayToolbarPrintButton="true"
                                                 printMode="PDF"
                                                 ></bocrv:reportPageViewer>
    Edited by: JayKumarSharma on Mar 23, 2011 12:42 PM

    This is how you retrieve all the text fields in the reort:
    ReportObjects reportObjects = (ITextObject) oReportClientDocument.getReportDefController().getReportObjectController().getReportObjectsByKind(ReportObjectKind.text);
    for(int i=0; i< reportObjects.size();i++)
    ITextObject textObject = (ITextObject)reportObjects.get(i);
    // use ReportObjectController to modify the text object.
    If you want to modify the contents of the text element, you can do it as follows:
    TextObject oTextObject = new TextObject();
    Paragraphs oParagraphs = new Paragraphs();
    Paragraph oParagraph = new Paragraph();
    ParagraphElements oParagraphElements = new ParagraphElements();
    ParagraphTextElement oParagraphTextElement = new ParagraphTextElement();
    oParagraphTextElement.setText("This is the new text field");
    oParagraphTextElement.setKind(ParagraphElementKind.text);
    oReportClientDocument.getReportDefController().getReportObjectController().modify(textObject, oTextObject);
    oReportClientDocument.save();

  • How can I share DVD drive on Windows with multiple ODD?

    My Windows machine have 2 ODD -- one CD ROM drive, another DVD R/W
    (and one more virtual drive, which I think is irrelevant)
    Installed "DVD or CD sharing" and remote computer is visible from Air via remote disk.
    BUT when I connect and request for use, only first CD-ROM drive is ejected and MBA waits for that drive... and that drive only.
    I can't see any configuration option to select which drive I will share.
    How can I get DVD sharing work in this case?
    Does anybody have similar problem?
    (Or where can I request for this functionality)

    Hello roaminggnome
    Unfortunately the support is down at the moment, I will have a better look later. I did go though the Apple support previously, however I found nothing that worked.
    The first thread I came across was “Home Sharing” however no mater what I did, it did not appear in the iTunes sharing list (I did go though the “Show Sharing Networks” support as well)
    Secondly, I saw “Using A Single Library With Multiple Accounts On The Same PC” (Something like that) but all this did was let us share the same music location, if I was to rip extra music, it will not show in there library
    Matt

  • How to Update Canon MG3120 Driver in Windows 8?

    The PIXMA MG3120 Wireless Inkjet Photo All-In-One delivers fantastic quality, versatility, and ease of use. It has a lot of advantages but one disadvantage. If you do not update Canon MG3120 driver, the printer just not works. So here is the question: how to update Canon MG3120 driver in windows 8.

    Hi Tessa053,
    You can download the latest drivers for the printer from the Canon USA website to update the printer.  Please click here to go to the Drivers and Software page for the PIXMA MG3120.  Once on the initial download page for your model, please do the following:
    1. Verify that the operating system detected in the "OPERATING SYSTEM" drop-down menu is correct, and if it is not, please click the drop-down menu to select your operating system.
    2. Next, please click on the red arrow next to the "RECOMMENDED FOR YOU" section and click the MINI MASTER SETUP file. When you do, a red DOWNLOAD button will appear. Please click on the checkbox below the DOWNLOAD button, then click the red DOWNLOAD button to begin the download. The time for the download process may vary depending on the speed of your Internet connection and the size of the file being downloaded.
    Once you have downloaded the Mini Master Setup file, please double-click on it to install the drivers on your computer.  
    Hope this helps!
    This didn't answer your question or issue? Please call or email us at one of the methods on the Contact Us page for further assistance.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • On my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop

    on my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop

    Click on the Desktop. From the Finder menu select Preferences. Check the boxes for what you want on your Desktop. If they are already checked, then try unchecking and rechecking.

  • HT201269 how to download apple usb driver  for windows 7 32 bit

    how to download apple usb driver  for windows 7 32 bit

    Try this:
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    Then install this:
    http://support.apple.com/kb/dl1614
    Windows XP Service Pack 2 or later
    32-bit editions of Windows Vista or 32-bit editions of Windows 7, and Windows 8

  • How to find the listener port on windows?

    Hi Friends,
    We have a client who is still using Oracle 8.0.6 on NT 4.0
    I have a laptop with oracle client 10g.
    I want to connect to the NT database to check it.
    How do I know what port does the listener used ? what is the command to run at the c:\ command prompt?
    I tried> c:\ lsnrctl stat but the command is not recognized
    I tried to find the lsnrctl and bin but there is not.
    Please help
    Thanks a lot

    ytterp2009 wrote:
    Please help.. and please do NOT post [duplicate posts|http://forums.oracle.com/forums/thread.jspa?threadID=935282&tstart=0]
    How to find the listener port on windows?The Internet Protocol stack comes with a number of utilities - one of these, called netstat, is very useful to determine which processes are doing what to which IP ports on that platform. Unfortunately, different flavours are implemented. So the Windows one does not support the parameters and output than the Unix/Linux one.
    You can use the following on Windows (run it via a command console) to see what processes are listening on what address and port number:
    c:\> netstat -n -a -p tcp
      -n = display IP addresses and ports in numeric format
      -a = list all ports (including ones used for listening
      -p tcp = only display protocol entries for TCP An Oracle listener entry should look something as follows:
    Proto   Local Address  Foreign Address   State
    TCP     0.0.0.0:1521   0.0.0.0:0         LISTENINGSeeing IP +0.0.0.0+ means that the Listener is accepting connections on all your network interfaces - which is standard. The port number is typically 1521. The foreign address is meaningless for a port in listening state.
    PS. Why not simply check the listener.ora configuration file? Because what is actually happening may not be what you thought you configured to happen..

  • How can detect that cdrom drive were opened and closed?

    How can detect that cdrom drive were opened and closed?

    I'm sure there are more elegant and complicated ways to accomplish this using Windows SDK function calls to kernel32.dll or something extravagant like that, but if you want the bare-bones easy way to check if the CD-ROM tray is currently opened, then simply use System Exec to query the CD-ROM drive from the command line. One example of this is shown below.
    Use the command line function cmd /c d:, where d: is your CD-ROM drive. If the Standard Error output from System Exec.vi is "The device is not ready." followed by a carraige return and line feed, then voila, your CD-ROM drive is open. If not, it's closed. Anyone have a better idea? I'm sure one exists...
    Message Edited by Jarrod S. on 02-16-2006 12:23 PM
    Jarrod S.
    National Instruments
    Attachments:
    CDROM_Check.JPG ‏22 KB

  • How to find the list of existing tables in a schema using DB link?

    Hi
    I know how to find the list of existing tables in a schema using the following query
    SQL> select * from tab;
    but, how to list the tables using a DB link?
    For Example
    SQL> select * from tab@dblink_name;
    why this doesn't work?
    Pl advice me
    Thanks
    Reddy.

    ORA-02019: connection description for remote database not foundHave you used this database link successfully for some other queries?
    The error posted seems to indicate that the DB Link is not functional at all. Has it worked for any other type of DML operation or is this the first time you ever tried to use the link?

  • Use external drive for windows and mac

    Hello,
    I just bought a external 320Gb Western Digital Drive. I would like to use
    the drive for windows and mac.I will not like to make partation on the drive
    to use it on both operating systems. Is there any formating system with which i can use in both operating systems? I would like to use time machine feature on that drive also.
    Thanx.

    If you want to use a disk for both PC/Mac file storage and Time Machine, you will have to create two partitions. Partitioning is sort of like creating multiple virtual disks on the same physical disk. One partition should be formatted for PC (which the Mac can also use) and the other should be formatted for HFS+ (Mac only) which is what Time Machine requires. The Disk Utility application makes partitioning and formatting very easy.

  • How to find output type givenSapscript form name and print program name

    Hi  Experts,
           Can anyone tell me how to find the output type of  a sapscript form if the print program name and sapscript form name is 
    known.

    Hi,
    There are two ways:
    1. Use table TNAPR .. Here is table give PGNAM as your print program name and FONAM as form name.. Now the field KSCHL will be the output type assigned to your script.
    2. You can also check the NACE t-code.. In that select a application(Corresponds to your area) -> click on Output types tab -> Here you get list of output type.. You need click on Processing Routine folder to get all other info..

  • How to find out what version of iTune and iPhoto I have?

    How to find out what version of iTune and iPhoto I have?

    For each application, launch it and choose About from that application's menu, or control-click its Dock icon, choose Show in Finder, control-click that, and choose Get Info.
    (76257)

  • How to find what are all the rules and events are monitoring for specific server in SCOM 2007

    how to find what are all the rules and events are monitoring for specific server in SCOM 2007.
    I need to know what are all the events, services, and rules are monitored for the specific server.
    Kindly help me friends.

    how to find what are all the rules and events are monitoring for specific server in SCOM 2007.
    I need to know what are all the events, services, and rules are monitored for the specific server.
    Kindly help me friends.
    Thanks for the question Sandoss. This is something that we all come across at sometime.
    Thanks & regards, Sumit Agrawal
    The lack of this feature is an inexcusable oversight for an enterprise management product.  They have some serious lightweights making design decisions on the SCOM team. 5 thumbs down. 
    BTW the answer is probably LOTS of stuff. Literally 100's of workflows are running on any server. 
    The following OpsMgr DB query will list all running monitors on a server. Change the name of @srv. I think this works pretty well.  I'd like some feedback if something is missing.
    DECLARE @srv varchar(30)
    SET @srv = 'your name here'
    SELECT mon.displayName as monitor, bme.FullName,bme.DisplayName as object,
    case
        when s.HealthState = 1 then 'healthy'
        when s.HealthState = 2 then 'Warning'
        when s.HealthState = 3 then 'Critical'
        else 'N/A'
    end as Health
    FROM state AS s WITH (NOLOCK)
    left join BaseManagedEntity as bme WITH (NOLOCK) on s.basemanagedentityid = bme.basemanagedentityid
    left join dbo.MonitorView Mon WITH (NOLOCK) on Mon.ID = s.monitorid
    where
    bme.FullName like '%' + @srv + '%'
    and s.HealthState <> 0
    and mon.IsInternalRollupMonitor = 0
    and mon.IsExternalRollupMonitor = 0
    order by bme.DisplayName, mon.displayName

Maybe you are looking for