Is there a way to detect in Java if headphones have been plugged into the headphone jack? This solution must be specific to Java.
            Asked
            
        
        
            Active
            
        
            Viewed 579 times
        
    0
            
            
        - 
                    Possible duplicate of [Detecting when head phones are plugged in](http://stackoverflow.com/questions/861601/detecting-when-head-phones-are-plugged-in) – byxor Dec 08 '16 at 22:17
 - 
                    1@BrandonIbbotson - Not a duplicate. The other question is facially more general. And the answers are all Windows specific, and not a good answer for Java. (The OP does not ask for a Java "solution" that only works on Windows ...) – Stephen C Dec 08 '16 at 22:30
 - 
                    Afaik there are no decent cross platform solutions. I see your point though. – byxor Dec 08 '16 at 23:31
 - 
                    I suspect this isn’t possible. For me, `AudioSystem.getSourceLineInfo(Port.Info.HEADPHONE)` returns an empty array. – VGR Dec 09 '16 at 15:14
 
1 Answers
0
            
            
        Before Vista there was no way of determining that information but there is a way to detect it in windows vista and beyond, use of mmdevapi.dll via executing rundll32.exe for running exe files, use RunTime class. in java. for further information about that take a look https://msdn.microsoft.com/en-us/library/windows/desktop/dd371403%28v=vs.85%29.aspx
        Shadyar
        
- 709
 - 8
 - 16