sabeer
usb detection
3 Answer(s)      2 years and 4 months ago
Posted in : Java Beginners

i want to detect usb device using javacode

View Answers

June 9, 2012 at 4:50 PM


try this:

import java.io.*;
import javax.swing.*;
public class DetectWin extends JFrame
{
    JPanel loginPnl = new JPanel();
    JTextField Dfield = new JTextField("", 20);
    
    DetectWin()
    {
        super("AUTHORIZATION");
        setSize(350, 100);
        setLocation(400, 300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        add(loginPnl);
        setVisible(true);
        setResizable(false);
        
        loginPnl.add(Dfield);
        String[] letters = new String[]{ "A", "B", "C", "D", "E", "F", "G", "H", "I", "Z"};
        File[] drives = new File[letters.length];
        boolean[] isDrive = new boolean[letters.length];

        for ( int i = 0; i < letters.length; ++i )
            {
            drives[i] = new File(letters[i]+":/");

            isDrive[i] = drives[i].canRead();
            }

         Dfield.setText("Waiting for devices....");

         while(true)
            {
            for ( int i = 0; i < letters.length; ++i )
                {
                boolean pluggedIn = drives[i].canRead();

                if ( pluggedIn != isDrive[i] )
                    {
                    if ( pluggedIn )
                    	Dfield.setText("Drive "+letters[i]+" has been plugged in");
                    else
                    	Dfield.setText("Drive "+letters[i]+" has been unplugged");

                    isDrive[i] = pluggedIn;
                    }
                }

            try { Thread.sleep(100); }
            catch (InterruptedException e) { }
            }
    }
    public static void main(String args[])
    {
        DetectWin AUTHORIZATION = new DetectWin();
    }
}


January 30, 2013 at 7:30 AM


hiii...

i tried this program but cannot read or detect my USB device. can you explain me, why...?

tq


February 25, 2013 at 8:40 AM


Hiii, nice posting...

i tried this code and running more than 5 minutes but can not read or detect my USB device. i'm using windows 7-64 bit, netbeans 7.1.2 and my device using USB type B connected to PC using USB type A.

can you explain me, why...?

best regards

-kiper-









Related Pages:
usb detection
usb detection  i want to detect usb device using javacode
JMF WebCam detection problem - Framework
JMF WebCam detection problem  Hello friends, I am using JMF to operate my web cam.My usb webcam works perfectly with JMF, I used it in JMStudio... = CaptureDeviceManager.getDeviceList( null ); my USB "webcam" is detected however when i
Berry Linux 0.67 is released now
with automatic hardware detection and support for many graphics cards, sound cards, SCSI and USB devices and other peripherals. Berry Linux can be used as a Linux demo... is a bootable CD Linux, automatic hardware detection, and support for many graphics
unique manufacturing id of a usb flash drive.
unique manufacturing id of a usb flash drive.  I need code for java application to read the unique manufacturing id of a usb flash drive. Please help me ? thanking you
VoIP USB Phone
VoIP USB Phone          A Corinex VoIP USB Phone A USB phone which can... included in the USB phone packaging to be able to use this software
php browser detection script - PHP
php browser detection script   I need a browser detection script in PHP. I am creating my application compatible to firefor, mozila and IE too
detection of the operating system on the client machine
detection of the operating system on the client machine  How to detect the operating system on the client machine
EDT Lockup Detection,overriding EventQueue,java,newsletter,tutorial
EDT Lockup Detection 2005-02-13 The Java Specialists' Newsletter [Issue 104] - EDT Lockup Detection Author: Aleksey GureevJDK version: Sun JDK 1.3.x...: EDT Lockup Detection It was long-long ago in February
grml 0.7 has been released now
on a running system; VMware: disable USB and Firewire detection during bootprocess... administrators. grml provides automatic hardware detection. You can use grml... and system administrators. grml provides automatic hardware detection. You can
Flex event phase detection example
Flex event phase detection example       With example below an introduction of phases in flex is demonstrated. In flex there are three phases. capturing, targeting and bubbling
What is eToken?
. It looks similar to pen drive and fixes in the USB port of the computer... with USB interface that attaches in the USB Port. As it fixes in the USB port
Mini-Pentoo 2006.0 is available now
and fits on mini CD or a 256 MB USB pen drive. It features the bare minimum tools..., ExploitTree and Nessus on a USB pen drive. About Pentoo list This mailing list is aimed... and fits on mini-cd and 256 MB usb pen-drive. It features the bare minimum tools
VoIP Headsets
wireless headset for VoIP applications with remote call detection and answer... comfortable wearing options, and hands-free convenience via your USB port. A complete wireless VoIP softphone solution that quickly connects to your USB port
The development Zenwalk Linux 2.1 (Core) release
by the hotplug subsystem, as well as USB and PCI devices, - The video detection...; Pcmciautils replaces Pcmcia-cs; video detection tool 'videoconfig
jUSB api
jUSB api  How can i access the USB using jUSB api and also hw to add this api to the netbeans
Mobile phones in 2011
, USB, Geo-tagging, touch focus, face and smile detection OS: Android...: GPRS, EDGE, 3G, Bluetooth, USB Memory: Internal 90 MB, external up to 8 GB..., RSS, Geo tagging, and Face Detection features OS: Android OS, v2.1
The Distribution Release of GRML 0.6
hardware detection. You can use grml for example as a rescue system, for analyzing... * don't use /proc/bus/usb by default anymore * improved synaptics touchpad..., bcm5700, drbd0.7, cowloop, dazuko, eagle-usb, hostap, ieee80211, ipw2100
The Ubuntu Linux 6.04 Alpha 3 has been released
will once more work in the installer. * Many hardware detection.... * Installs to USB sticks should now get correct GRUB bootloader... that you can carry around a USB stick with all your documents and settings
The Ubuntu Linux 6.04 Alpha 3 has been released
will once more work in the installer. * Many hardware detection.... * Installs to USB sticks should now get correct GRUB bootloader... that you can carry around a USB stick with all your documents and settings
ajay
ajay  can anyone tell me how intrusion detection system works. and how it can be developed by using java
VoIP Adapters
number with an area code and a unique number.      USB Telebox Adapter for VoIP The telebox adapter connects to your PC via USB.... There are some features of USB telebox adapter is following here's
VoIP Modem
cancellation, high-pass filter, and voice activity detection (VAD) * Issuing redundant... * Differentiating modem signals from voice and fax signals, indicating the detection... to a computer through either a 10/100Base-T Ethernet or a USB data port.  
Finnix
, full automatic LVM detection, console mouse support, SMP support for the PowerPC... to assist with creating a bootable USB thumb drive with Finnix. Finnix can now... emulation via Firewire or USB. A clickwheel-based keyboard input mode may
We are providing Knoppix 3.6 Live Linux CD's
. It auto-detects hardware and supports many graphics cards, sound cards, USB... update - FreeNX-Server package from Fabian Franz - hardware detection updates &... or IMPS/2-compatible USB-mouse * If your computer doesn't have that much RAM
Objective C resize UIImage
Objective C resize UIImage  i just want to resize the image on the touch detection. That means if a user double clicks on the UIImage it must resize the image
can anyone help me to implement strength of the password - Security
can anyone help me to implement strength of the password  hi.. i have to implement password strength detection algorithm. How can i use dictionary in linux system
VoIP Router
and a USB printer port and support for all current ADSL technologies... standard broadband ADSL connectivity using USB, Ethernet and Wireless and now... it direct into your PC via USB. If you?re using Windows XP/2000, Mac OS X or Linux
C Language - Java Beginners
. What is USB ? 9. What is Computer Network? What is the necessary of using
What is WiFi Finder?
the direction of the signal. Some models come with built in USB ports. This way you... configured. Further, the models automatically recharge once they connect with the USB.... Another important factor to check is the USB standards of the WiFi finder
VoIP Free Software
activity detection, and noise reduction, according to the company. Talking..., these are intended to get Mac users up and running quickly. They include a USB
VoIP Phones
phones require you to be connected to your PC via a USB cable our Cordless VoIP... plugs into the USB port on a PC or Mac * Phone communicates....    VoIP USB Phone A USB phone is the easiest and quickest way
Damn Small Linux 2.3 RC1 has been released now
is changed while running X; new USB pendrive installs now support 'toram'; new faster... (LiveCD) 2. Boot from a USB pen drive 3. Boot from within a host operating system... media including a hard drive, a floppy drive, or a USB device. DSL has a nearly
System and Hardware Requirement for Windows 8
of at least 1366 x 768. BitLocker To Go requires a USB flash drive (Windows 8 Pro only) BitLocker requires either Trusted Platform Module (TPM) 1.2 or a USB
VoIP Accessories
found VoIP internet phones and accessories. Get VoIP USB Internet Phones so you... a few free samples. The customers will get a free USB phone with £25 credit...;    D-Link Skype VoIP USB phone Adapter Enhance your Skype
VoIP Cable Modem
;    External Csble Modem w/USB,Ethernet, and VoIP The Ambit... to the Internet using USB or 10/100Base-T Ethernet port (or both simultaneously... connect: * A single computer equipped with a Universal Serial Bus (USB) port
VoIP Devices
Devices USB Phones are quickly becoming the most popular VoIP device for PC... of a conventional telephone handset contributes to the USB phones' popularity. USB... and keypad which interfaces with your computer via a vacant USB port. USB VoIP
Go Wild With iPad Accessories
texts using a touch screen. It connects to your device via a USB port, but you... of photos and videos to and from your iPad. You can do so via USB or SD card... larger scale. The USB power adapter allows you to charge your device via
Bayanihan Linux 4 Beta 1 has been released
; improved support for removable devices (USB); easy to update and upgrade. Note... Editing Tools 11. Improved support for removable devices (USB) 12. Easy
INSERT 1.3.6 is released now
that cannot boot from the CD (insert-remote) 13.installation on a USB memory stick (usb-install) 14.based on Linux kernel 2.6.12.5 and Knoppix 4.0.2 To Download
VoIP Telephone Adapter
port go into category "FXS to Ethernet". Adapters with a USB connector go into category "FXS to USB". Further, in order to maintain fairness between all vendors... directly to a computer's Universal Serial Bus (USB) port. Whether or not VoIP
DSL-N 0.1 Alpha is available
CD as a live linux distribution (LiveCD) 2. Boot from a USB pen drive 3. Boot..., or a USB device. DSL has a nearly complete desktop, and many command line... distribution (LiveCD) 2. Boot from a USB pen drive 3. Boot from within a host
Mandriva Linux One 2006 Beta 2 has been released now
. rename occident Americas-Western_Europe load usb-storage and sleep a "small" bit to be able to boot from USB CD-Rom drives move ide-generic to end of loaded... services run harddrake because a crappy snd-usb-audio workaround may do something
Binding in flex
detection instead runtime data bindings defined by the bindProperty
EclipsePro Audit
development environment. Defect Detection, Repair and Reporting Benefit

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.