1. Check out our companion app, Forums for Android! Download from Google Play

Help!: How do you use zxing in eclipse and java

Discussion in 'Application Development' started by muay_tb, Jun 30, 2010.

  1. muay_tb

    muay_tb New Member
    Thread Starter

    Jun 30, 2010
    Hi all,

    I have an idea of developing an application which requires a bar code to be scanned and the information of the item scanned to be gathered (i.e the meta data).

    I know there is a library which lets you scan barcodes, 'zxing' provided by Google.

    I have looked everywhere and can't seem to find an example of someone who has used the 'zxing' library (which I want to use) within Java in order to scan a barcode using an emulator.

    What I am looking for is a simple example to use the barcode scanner application or webcam to scan a bar code and be able to see what it gives you. Im not too fussed about getting the meta data but if this is possible (using some free service/server) then that would be great!! ;)

    Is there anyone who has managed to use such software? If someone has used some other software then please share the ideas.

    I am using Eclipse as my IDE and aim to create my application in Java.

    Many thanks!!


  2. palani.mt

    palani.mt New Member

    Jan 21, 2011
    Software Development
    Bangalore, India
    Hello, I too have the same problem....

    I got some steps from the below link to use webcam for scanning the images from emulator, but it does not seem to work

    Obtaining a Live Camera Preview in Android

    How to use the above site is explained here:

    How to use web camera in android emulator to capture a live image? - Stack Overflow

    I did all the steps mentioned here...but when I try to compile the WebcamBroadcaster.java file as mentioned there, I am getting these errors:

    C:\Documents and Settings\administrator>"C:\Program Files\Java\jdk1.6.0_21\bin\j
    avac.exe" -classpath "C:\Program Files\JMF2.1.1e\lib" c:\WebcamBroadcaster.java
    Note: c:\WebcamBroadcaster.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    C:\Documents and Settings\administrator>java "-Djava.library.path=C:\Program Fil
    es (x86)\JMF2.1.1d\lib" c:\WebcamBroadcaster
    Exception in thread "main" java.lang.NoClassDefFoundError: c:\WebcamBroadcaster
    Caused by: java.lang.ClassNotFoundException: c:\WebcamBroadcaster
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Could not find the main class: c:\WebcamBroadcaster. Program will exit.

    So, I am stuck here...and was unable to find any other solution for this....

    If u already got some solution, please help me out.

    Thanks in advance...
  3. alostpacket

    alostpacket Over Macho Grande?

    Nov 29, 2009
    Android App Developer
    I dont use the reader in my app but do use the writer. Honestly I just grabbed an svn checkout and compiled in the classes i needed rather than using jars.

    One thing to be aware of is that you'll need some of the classes not just under the android source tree but also under the core source folder.

    Hope that helps.

Share This Page