Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 20-11-2009
Member
 
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?
Reply With Quote
  #2  
Old 20-11-2009
Member
 
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.
Reply With Quote
  #3  
Old 20-11-2009
Member
 
Join Date: May 2008
Posts: 2,008
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.
Reply With Quote
  #4  
Old 20-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
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>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 11:32 AM.