Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: problem in java

  1. #1

    problem in java

    hii to all

    actually i am 2nd year enginnering student and working on the project in java.
    i wannna know that how compact disk drive can be open or closed through java. ie just by clicking one button cd drive should open and a required cd may be put inside and then on clicking the other button it should go inside.
    can u give me the source code or any link to it.

    thnxx in advance.

  2. #2
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  3. #3
    hi sirdice
    i had gon through that link but there was writen that it is not possible through java api . but there was written this:---------

    "As you suggest, you will need to call an ioctl in the device driver using JNI.
    Or, if your OS has a "cdeject" command, you could call that instead. That
    is the approach I would use. "

    i duuno know about JNI so if practically is there any way to tackle it,,any sort of coding in java is possible regarding this.

    thnxxxxxxxx in advance.

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Posts
    106
    So you are trying to get a program to recognize if there is any medium in the CD drive?

    The only way you could do that, that I could think of, is by interacting with the CD driver; I'm not too sure about how to do that with java. I'm pretty sure that there is some way to do that in C (then you could use JNI to put it into Java, or c2java).

    There are several links of interest though:
    Hardware interaction with Java
    Part of the JINI Archives
    Having UI with Hardware

    Good luck, this is a hard problem.
    "The Texan turned out to be good-natured, generous and likeable. In three days no one could stand him." Catch 22 by Joseph Heller.

    Buddies? I have no buddies...


    Give the BSD daemon some love (proud FreeBSD user)

  5. #5
    Just Another Geek
    Join Date
    Jul 2002
    Location
    Rotterdam, Netherlands
    Posts
    3,401
    If I read those google posts correctly the solution is highly platform dependant which kind of defeats the reason for using java (being platform independant et al)..
    Oliver's Law:
    Experience is something you don't get until just after you need it.

  6. #6
    hey sir dice

    iam in the of this project and i am still trying to figure it out how to get it done. is it really not possible to do that through java.plzzz try if you find one such link or any other information about it.

    thnx in advance

  7. #7
    rebmeM roineS enilnOitnA steve.milner's Avatar
    Join Date
    Jul 2003
    Posts
    1,021
    Originally posted here by shals
    hey sir dice

    iam in the of this project and i am still trying to figure it out how to get it done. is it really not possible to do that through java.plzzz try if you find one such link or any other information about it.

    thnx in advance
    For goodness sake, this is _your_ project...

    Why don't you do the legwork to find the answer!

    Steve
    IT, e-commerce, Retail, Programme & Project Management, EPoS, Supply Chain and Logistic Services. Yorkshire. http://www.bigi.uk.com

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Posts
    106
    Well, what you are asking to do is very hardware oriented, and is thus platform dependent.

    The only feasible way to do this, as an alternative, is to use native methods. I wouldn't know where to begin with that; alternatively, you could load C libraries that contain the methods, and just use them in java.

    Again, it is platform dependent to manipulate the hardware in a way that you need. There's no way around that.
    "The Texan turned out to be good-natured, generous and likeable. In three days no one could stand him." Catch 22 by Joseph Heller.

    Buddies? I have no buddies...


    Give the BSD daemon some love (proud FreeBSD user)

  9. #9
    hey arki

    yes this is hardware dependent then also is there a code whuch can be applied to one computer only.

  10. #10
    Senior Member
    Join Date
    Oct 2005
    Posts
    106
    I assume you mean by "applied to one computer only" as applying your code to some test computer?

    Well, I am no engineer (first of all), so I would be assuming that for your project you would want to try to mimic the "open/cose cd drive" command that is given when you push the button. I have no clue how you would do this.

    I think, honestly, the best bet would be to use servlets; though I should confess I have no experience with servlets so I don't know their limitations. But it seems feasible that with a servlet you could program one such that if you click a button on some gui, it should send a signal to open the cd rom.

    I did find detecting CDs with Java, an article in the Linux Gazette, though I would recommend that you look into the JNI.

    [edit] A thought, why don't you make a program in java that: uses JNI, and then writes a C++ program that implements the Java method. It would theoretically, as far as I know, be platform "independent" -- provided that the C++ compiler 1. exists on the computer, and 2. is known.
    "The Texan turned out to be good-natured, generous and likeable. In three days no one could stand him." Catch 22 by Joseph Heller.

    Buddies? I have no buddies...


    Give the BSD daemon some love (proud FreeBSD user)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •