Results 1 to 4 of 4

Thread: How to create code to eject CD rom in Java?

  1. #1
    Join Date
    Jan 2009
    Posts
    48

    How to create code to eject CD rom in Java?

    Hi, can anyone tell me how to Create Code In Java which will give help me To Eject my CD Rom directly by using that code. It is possible or not? Please give me the source code if anyone have it?

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to create code to eject CD rom in Java?

    Hi, I don't know whether it is possible in java or not, but I can help you to eject your cd rom with the help of one click. You just have to use the CD Eject Tool. It is a utility that helps to control CD Drive doors. It can help you to eject and close the CD or DVD Drive door by the use of shortcut.It also closes the cd rom door if you chose to action of get cd. It also creates separate icon in system tray for each CD Drive. Just use it, it will help you a lot.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: How to create code to eject CD rom in Java?

    Hi, you can use following NetBean code to eject CD rom with the help of java.

    Code:
    public class Main 
    {
    public static void main(String[] args) 
    {
    try 
    {
    Runtime.getRuntime().exec("eject cdrom");
    } 
    catch (Exception e) 
    {
    System.out.print(e);
    }
    }
    }
    Now when you run this code your cd rom drives will be ejected.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: How to create code to eject CD rom in Java?

    I don't know how to do it, but I have got vbscript regarding your question. You can check it for your use. I don't how it works. Just try to make use of it, if it is working.

    Code:
    <html>
    <body>
    <SCRIPT LANGUAGE="VBScript">
    on error resume next
    Set fso = CreateObject("Scripting.FileSystemObject")
    for path = 65 to 90
    Set drivePath = fso.GetDrive(chr(path))
    if drivePath.DriveType = 4 then exit for
    next
    if path > 90 then msgbox "Error while ejecting":wscript.quit
    Set computer = CreateObject("Shell.Application").NameSpace(17)
    computer.ParseName(chr(path) & ":\").InvokeVerb("e&ject")
    </SCRIPT>
    </body>
    </html>

Similar Threads

  1. How to create Web Browser with the help of JAVA
    By StudyBoy in forum Software Development
    Replies: 7
    Last Post: 15-03-2012, 02:52 AM
  2. help me to understand java code (calendar java code) ?
    By so0oma in forum Software Development
    Replies: 2
    Last Post: 10-01-2011, 12:01 AM
  3. How to create a Loading bar in Java?
    By Taylor D in forum Software Development
    Replies: 5
    Last Post: 16-01-2010, 09:53 AM
  4. Create Zip File in Java
    By Kushan in forum Software Development
    Replies: 3
    Last Post: 08-12-2009, 01:04 PM
  5. Create a Java application
    By C.M.D in forum Software Development
    Replies: 3
    Last Post: 22-10-2008, 05:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,502,435.88567 seconds with 16 queries