How to deal with time in Java program?

It is very common that when you install a program, there is a bar showing the progress of the installation. My question is how to build such a bar in my Java GUI?
Also, I would like to insert an underlying clock, recording the time spent in running the program, and return the value to the user.
Could anyone tell me how to achieve those? Thanks in advance!

It is very common that when you install a program,
there is a bar showing the progress of the
installation. My question is how to build such a bar
in my Java GUI? JProgressBar. There's a tutorial.
Also, I would like to insert an underlying clock,
recording the time spent in running the program, and
return the value to the user. System.currentTimeMillis()

Similar Messages

  • How to deal with Blob in java program

    Hello
    i want to store blob object using java. my problem is i get the blob object and use it generate an OutputStream object, but when i try to write blob data to db, which getnerate errors message are you don't lock the blob object row?
    would anyone help me, thanks in advance?
    my source gets from http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/oralob.htm#1000888.

    Refer this thread :
    Saving a text file as CLOB into oracle database
    Chandar

  • How to change system time through java program

    Hi
    I want to know, how to change system time through java program.
    give me a idia with example.
    Thanks

    There isn't any core Java API for this. Use JNI or call an external process with Runtime.exec().
    ~

  • How to deal with  time zone while upgrading the database?

    Hi,
    How to deal with time zone while upgrading the database?
    Thanks
    Edited by: user12135020 on Jul 4, 2011 3:06 AM

    Hello,
    I answered to a Wrong post.
    Best regards,
    Jean-Valentin
    Edited by: Lubiez Jean-Valentin on Jul 4, 2011 12:15 PM

  • How to deal with #ifdef in .java files with javadoc tool?

    My .java file included some '#ifdef' & '#endif' sentence. So when I used javadoc tool to generate the .html files, error happened. Can anyone give me some indication how to resolve the problem, provided that the source code can not be changed because it was written by others. Waiting for your reply and thanks in advance!

    Hi, got the same problem, have stuck for all day on this and yield no progress.
    my source code contain
    #ifdef
    and
    #endif
    it is source code (not comment), the only compile with a special preprocessing tool call
    "sjpp.jar".
    I need to generate Javadoc there.
    the error is
    [javadoc] C:\TEMP\cellml_visual_checkout\cellml_api\java\src\org\cellml\CNode.
    java:101: illegal character: \35
    [javadoc] #ifdef JENA
    if I pass in encoding parameter when I do javadoc,
    say, -encoding "PROPROC",
    then there is different error
    [javadoc] Constructing Javadoc information...
    [javadoc] Standard Doclet version 1.5.0
    [javadoc] Building tree for all the packages and classes...
    [javadoc] java.lang.Error
    [javadoc] at sun.nio.cs.StreamEncoder$CharsetSE.flushLeftoverChar(StreamEn
    coder.java:361)
    [javadoc] at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.ja
    va:381)
    [javadoc] at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
    [javadoc] at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:146)
    [javadoc] at java.io.OutputStreamWriter.write(OutputStreamWriter.java:204)
    [javadoc] at java.io.PrintWriter.write(PrintWriter.java:384)
    [javadoc] at java.io.PrintWriter.write(PrintWriter.java:401)
    [javadoc] at java.io.PrintWriter.print(PrintWriter.java:532)
    [javadoc] at com.sun.tools.doclets.formats.html.HtmlDocletWriter.printLink
    (HtmlDocletWriter.java:1045)
    [javadoc] at com.sun.tools.doclets.formats.html.MethodWriterImpl.printRetu
    rnType(MethodWriterImpl.java:361)
    [javadoc] at com.sun.tools.doclets.formats.html.MethodWriterImpl.writeSign
    ature(MethodWriterImpl.java:148)
    [javadoc] at com.sun.tools.doclets.internal.toolkit.builders.MethodBuilder
    .buildSignature(MethodBuilder.java:176)
    [javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
    sorImpl.java:39)
    any help will be appreciated.
    thanks
    Bill

  • How to deal with generated programs in eCATT SAPGUI recording?

    Hi experts and professionals,
    I am trying to automate testing of our solutions by eCATTs and so far i have not been able to find solution for following problem.
    Whole test scenario is very simple:
    Check InfoProvider data (query, lookup, listcube,...)
    Create DAP on InfoProvider
    Archive InfoProvider
    Check InfoProvider data (query, lookup, listcube,...)  again
    Compare results from step 1. and 4. (must match)
    Reload archived data
    Check InfoProvider data (query, lookup, listcube,...)  again
    Compare results from step 1. and 7. (must match)
    As you can see, one of the required test steps is to check InfoProvider's data in transaction LISTCUBE.
    But transaction LISTCUBE generates its program "name" every time it is executed and
    I am struggling to find a way how to deal with these generated programs in eCATT SAPGUI recording.
    Key is that solution must be generic and work for all SAP BW releases from 7.0 upwards
    (having in mind that LISTCUBE can read NLS data from SAP BW 7.3 release).
    Error description from eCATT log:
    Screen Check Error: Expected Transaction: LISTCUBE, Actual Transaction: LISTCUBE.
    Expected Program: GP0KOZE7EFIUBN10MZUFWX90W80, Actual Program: GPBP24INA6VV77SL0XKU5NA642O.
    Expected Screen Number: 1000, Actual Screen Number: 1000.
    There Is Probably an Error in SAPGUI recording.
    ExceptionClass:CX_ECATT_APL_CAPTURE  ExceptionId:SCREEN_CHECK_ERROR
    RaisingClass:CL_APL_ECATT_LINE_INTERPRETER  Include:CL_APL_ECATT_LINE_INTERPRETER=CM00J  Line:443
    Is there any way how to avoid program check in eCATT script?
    Anything that would help me to find solution will be greatly appreciated.
    Best Regards,
    Igor

    Dear Igor,
    Your issue is caused by the "screen check" which eCATT processes here.
    In General this screen check is a very usefull activity, since is ensures that only those screens are processed by automation, which initially where recorded. This should ensure as much as possible to invoke only intended activities.
    Remember, that the driver of the screen flow is still the automated transaction program ( but not the test tool). So application logic decides which screen is send next.
    Using screen check the test tool tries to ensure that menu items and buttons and other activities are only automated when the tool "believes" to work on the intended screen.
    For generic test scripts and often in context of generated programs the screen check might hurt a bit.
    To overcome this, one might try to make the check dynamic (as Sheetal suggests correctly).
    If here the name of program cannot be determined for any reason, one can use another method and do following:
    - Change the value of ProcessedScreen-Active to 'R'
    This will disable/skip the screen-check for this ProcessedScreen.
    Sure the solution includes a certain risk, since not checking the correct screen to appear might lead to automation of actions with not desired impact.
    Maybe this can improve your solution.
    Kind Regards
    Jens

  • How to deal with java integrity??

    Hi everyone,
    it's just few months that I have started to use Java and since, I've been really confused how to use it. As I've been using C++ before, it's really easy for me to handle a few libraries and keywords and write every thing all by my own. But in Java, TOOOO many libraries and keywords all with different procedures and different cases that really bothers me and I can't understand how to deal with all these. As an example, When I just want to start and write a program, I start searching the net and wow. too many different classes and different Keywords that I get too confused and I prefer not to continue. Would someone please help me and tell me how to find a solution for this essential problem???

    asker wrote:
    I've been using C++ before
    But in Java, TOOOO many keywords Really? C++ has 63 keywords:
    asm    
    auto   
    bool   
    break  
    case   
    catch  
    char   
    class  
    const  
    const_cast 
    continue   
    default    
    delete 
    do 
    double 
    dynamic_cast   
    else   
    enum   
    explicit   
    export 
    extern 
    false 
    float  
    for    
    friend 
    goto   
    if 
    inline 
    int    
    long   
    mutable    
    namespace  
    new    
    operator   
    private    
    protected  
    public 
    register   
    reinterpret_cast   
    return 
    short  
    signed 
    sizeof 
    static
    static_cast    
    struct 
    switch 
    template   
    this   
    throw  
    true   
    try    
    typedef    
    typeid 
    typename   
    union  
    unsigned   
    using  
    virtual    
    void   
    volatile   
    wchar_t    
    while   while Java has 52, 2 of which (goto and const) are not used:
    abstract  
    assert
    boolean    
    break  
    byte   
    case  
    catch  
    char   
    class  
    const
    continue   
    continue  
    default   
    do 
    double 
    else  
    enum
    extends    
    final  
    finally    
    float  
    for   
    for    
    goto 
    if
    implements 
    import 
    instanceof 
    int   
    interface 
    long  
    native 
    new   
    package  
    private  
    protected 
    public 
    return 
    short 
    static 
    strictfp
    super 
    switch
    synchronized
    this
    throw
    throws
    transient
    try
    void
    volatile
    while

  • How to deal with deadlock on wwv_flow_data table when http server times out

    There are some threads about a deadlock on the wwv_flow_data table. None of them contain a real explanation for this behaviour. In my case I will try to explain what I think is happening. Maybe it helps somebody who is hitting the same matter.
    In my case with APEX 3.2.1 I am navigating from one page to another. Doing this APEX will lock the table wwv_flow_data. As soon as the other page is shown the lock will be released. But now this other page contains a bad performing query (standaard report region). After 5 minutes the http server (modplsql) will time out and present the message "No response from the application server" on the screen. In the meanwhile the query is still running on the database server and the lock stays on the wwv_flow_data table.
    Normal user behaviour will be that the user will use the back button to return to the previous page and tries it again to navigate to the other page or
    the user will try to refresh the page with the bad performing query.
    And voila now you will have a deadlock on the wwv_flow_data table since a second session is trying to do the same thing while the first hasn't finished yet.
    How to deal with it?
    First of all. Have a good look at the bad performing query. Maybe you can improve it that it will succeed before the http server will timeout.
    In my case the 11gr1 optimizer couldn't handle a subquery factoring clause in the best way. After changing it back to a classical inline query the problem was solved.
    Secondly you could increase the timeout parameter of the http server. Although this not the best way.
    Maybe it would better if APEX in a next version would release the lock on the table wwv_flow_date earlier or do a rollback just before the moment that the http server is timing out.
    regards,
    Mathieu Meeuwissen

    Hello Shmoove,
    I saw your reply here and you probably understand the problems the HTTP 100 response may cause.
    I am trying to send image that was taken by getSnapshot. The problem is that the server respond with this HTTP 100 message.
    I suspect that the reason that my server doesn't recognize the file that I'm sending from J2me is that the "server to client" response to the 100 message comes after the second message of (see what the TCPIP viewer shows down here):
    POST /up01/up02.aspx HTTP/1.1
    Content-Type: multipart/form-data; boundary=xxxxyyyyzzz
    Connection: Keep-Alive
    Content-length: 6294
    User-Agent: UNTRUSTED/1.0
    Host: szekely.dnsalias.com:80
    Transfer-Encoding: chunked
    400: Client to Server (126 bytes)
    78
    --xxxxyyyyzzz
    Content-Disposition: form-data; name="pic"; filename="david.jpg"
    Content-Type: application/octet-stream
    400: Connected to Server
    400: Server to Client (112 bytes)
    HTTP/1.1 100 Continue
    Server: Microsoft-IIS/5.1
    Date: Wed, 23 Mar 2005 00:47:02 GMT
    X-Powered-By: ASP.NET
    Any help will be appreciated,
    David

  • How to deal with credentials for external applications using a Java Client/

    Hi Guys,
    This is the case. I am integrating an external application with an ADF Application. I have implemented some programmatic ViewObjects that are being filled up by a REST Java Client Wrapper. Everything is working fine but the issue is that the credentials the wrapper is using are hard coded inside the java class. I am thinking to ask for the credentials at the beginning of my taskflow and then store them somewhere and use them then to create my client wrapper (passing them in the constructor).
    However, I don't know if my approach is good and I would like you to share your experiences or how to deal with this.
    Regards

    You can use Credential Store Framework to store the credentials securely in the weblogic server instead of hardcoding in the java class.
    The Credential Store Framework:
    - enables you to manage credentials securely
    - provides an API for storage, retrieval, and maintenance of credentials in different back-end repositories
    Check the documentation on CSF API -
    http://docs.oracle.com/cd/E29505_01/core.1111/e10043/devcsf.htm
    Major Steps -
    1. Create a credential map and key in em console to store the password (http://docs.oracle.com/cd/E25054_01/core.1111/e10043/csfadmin.htm)
    2. Use CSF API to retrieve the stored password
    3. In jazn-data.xml give permissions to access CSF key and map

  • Help--How can I open only one java program at one time?

    How can I open only one java program(same program) in Windows at one time?

    In Java 1.5, you can use the JVM's own monitoring APIs to examine what other JVMs are running on the system, and what applications they're running.
    It's general and powerful, but complex. The socket/file/whatever approach is cleaner, and probably more suited to your usage.
    Don't bother trying to use the Windows task manager for this sort of thing. You have to write messy native code, and it isn't reliable after all that anyway.

  • How to deal with visession in IVI-C driver program ?

    a ViSession is an identifier that corresponds to a session.
    My instrument is a remote internet device . i can call VISA library to implement
    communication between labwindows and my remote internet device.In this case , what is meaning of Visession
    ? It looks as if Visession does not have a relation to my IVI-C driver program.
    if it has a relation to my driver, how to deal with the ViSession in IVI-C driver program?thank you

    ViSession is necessary as part of a larger picture and fills an important role in good architecture.  Intrument handles (stored as the ViSession type) are necessary for large projects, which may require commanding multiple instruments.
    There is no function to call which can get or set a ViSession value, similar to the way other attributes are set with driver functions.  The ViSession intrument handle is created and returned to the application when an instrument is initialized; it represents a connection with one particular instrument.
    This allows users to have multiple instruments connected, which can be controlled programmatically with one application.  Then, the application can quickly specify which instrument it would like to send a command, just by sending one instrument handle or another.
    Yes, you could remove the ViSession as parameter in your functions, but it would cripple the big picture effectiveness of the driver.  In place of the ViSession, you would have to send each function the Resource Name or Resource ID for the particular instrument as well as the Option String.  So really, it is just more practical and better practice to use an instrument handle (stored as the ViSession type).
    That being said, for certain functionality (adding two numbers), you absolutely do not need a ViSession instrument handle parameter.  You will have to use your best judgement to determine where to include or exclude this parameter.  I suggest using the ViSession instrument handle parameter with any function that communicates with an instrument.
    Also, Ebalci is correct regarding the difference between ViSessions and channels.  ViSessions are used to communicate with different instruments.  To reference or read a specific channel from an instrument you will have to refer to the guidance in the manual for the instrument in question.  There will likely be a command to select a specific channel when reading from the instrument.  And for general guidance, I suggest reviewing another IVI driver, possibly for an instrument of the same class or type or maybe from the same family, if such a driver already exists.
    Regards,
    Shawn S. | NIC
    Instrument Driver/IVI PSE
    National Instruments

  • How to deal with OpenCL grey out issue.

    First off, I'm not native english speaker.
    I have Nvidia GeForce 550 Ti video card, and its support OpenCL v1.1.
    I'm also face a "random" OpenCL grey out issue like other people here, but I found the "issue" and how to deal with.
    open a command windows (using WinKey + R, and type cmd <enter>)
    type "cd C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)" <enter>
    type "sniffer_gpu" <enter>  -->> to check your GPU has OpenCL in Photoshop?
    When GPU is in power-saving mode (core running in 51Mhz, using MSI Afterburner monitor), I running sniffer_gpu, got this report
    C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)>sniffer_gpu
    Device: 0000000000328D68 has video RAM(MB): 1023
    Vendor string:    NVIDIA Corporation
    Renderer string:  GeForce GTX 550 Ti/PCIe/SSE2
    Version string:   3.0.0
    OpenGL version as determined by Extensionator...
    OpenGL Version 3.0
    Has NPOT support: TRUE
    Has Framebuffer Object Extension support: TRUE
    OpenGL ok
    Return code: 1
    C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)>
    No OpenCL support
    Then, I switch GPU back to normal status (core running at 900Mhz)
    C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)>sniffer_gpu
    Device: 00000000001F8D68 has video RAM(MB): 1023
    Vendor string:    NVIDIA Corporation
    Renderer string:  GeForce GTX 550 Ti/PCIe/SSE2
    Version string:   3.0.0
    OpenGL version as determined by Extensionator...
    OpenGL Version 3.0
    Has NPOT support: TRUE
    Has Framebuffer Object Extension support: TRUE
    OpenGL ok
    OpenCL ok, version=1.1 CUDA 4.2.1
    Return code: 3
    C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)>
    OpenCL support !!
    Nowadays, most of new GPUs were support power-saving, but when sniffer_gpu running at GPU power-saving state, the OpenCL computing report maybe "time-out", cause the detector "guess" the GPU does not support OpenCL. This is why many people says "OpenCL" sometimes work, sometimes grey-out.
    I hope this bug can be fixed, or at least people can understand how to "enable OpenCL everytime when you launch photoshop".
    Bye.

    Do check the following link
    http://blogs.oracle.com/soabpm/2010/01/soa_suite_11g_weblogictransact.html

  • How to deal with "Error 1001. The specified service already exists" when install a service using installer package?

    Hi everybody,
    I wrote a "Class Library" project which is a service using Visual Stodio 2008 recently, then tried to use a Visual Studio 2008
    Setup Project to install it.
    Here is what I did for the "Class Library":
    1. Finish the program.cs, Service.cs
    2. Add Installer
    3. Change the serviceInstaller so that "StartType" to be Aotumatic
    4. Change the ServiceProcessInstaller2 so that "Account" to be LocalSystem
    5.
    6. Click in F5 (Start Debugging)
    Here is what I did for the Setup Project:
    1. Add the exe file built from the "Class Library" project to the Application Folder
    2. On the Custom Action Editor, add the exe file from 1 to Install and Commit
    3. Change the property of the project so that "RemovePreviousVersion" to be true
    4. Click on F6(Build Solution)
    Then I tried to run the msi file from the built of the Setup Project. Because I modified the two projects serveral times, I uninstalled the Class Library using "Control Panel->Add or Remove Programs" before I reinstall. Two things I notived:
    1. After unstall, the registry was not cleaned up about the installed program
    2. After several rounds install/uninstall, I got "Error 1001. The specified service already exists"
    My questions are:
    1. How to cleanup the registry when uninstall a program?
    2. How to deal with the "Error 1001. The specified service already exists"?
    3. Did I do anytbing wrong with the "Class Library" or the "Setup Project"?
    Thanks a lot!
    Helen

    Hi Simon, not a problem!
    I spent some more time on this and here are few more notes:
    it is called Major Upgrade, when you are installing new version of the product upon a previous one and
    MSI supports 2 strategies:
    Strategy 1. Install a new version and uninstall previous one. (Install a new version right upon previously installed version (file merging is performed based on dll version number) and the delete previously
    installed files)
    Strategy 2. Uninstall previous version and install a new one (Delete all previous files and install from scratch new files.)
    From the first look it seems that 1st strategy is weird and buggy. But, remember, MSI is great because it's transactional!!! That means that if once some of the phases (Installation, Uninstallation, Rollback, Comit) fails, your machine
    will be reverted to the previous state and it'll be still functional. 
    Let's consider both strategies:
    Consider you have installed product_v1.msi and you want to install product_v2.msi.
    Strategy 1
    1. MSI engine copies files from Product_v1 directory to TEMP directory
    2. MSI engine merges files based on the assembly version (between v1 and v2)
    3. Once merging is completed successfully it removes files in TEMP (RemoveExistingProducts  action triggers it) and you got product_v2 installed, otherwise if it fails MSI engine revert machine to V1 and copies previous files from TEMP.
    Strategy 2
    1. MSI engine tottaly removes all files from v1.
    2. MSI engine installs v2 files and if something goes wrong you cannot revert back, because RemoveExistingProducts  allready worked out and MSI doesn't have files to revert machine back
    I recommend to everybody to use Strategy 1 and leverage MSI transaction functionality. And you can set this strategies by defining sequence of RemoveExistingProducts action. See more info
    here.  So, I think it's not even a bug in VS as I said in the upper post it is default recommened behaviour.
    AND, you got "Error 1001. The specified service already exists"
    because if we follow Strategy 1 MSI engine tries to install Windows Service on top of the existing service and OF COURSE it fails MSI engine (StopServices, DeleteServices actions are executed before actual
    installation and  they look at ServiceControl table). In order to stop service first and delete them you have to fill ServiceContol table of the MSI (and then StopServices, DeleteServices actions will recognize what to they have to stop
    and delete), like this:
    *clip*clip*clip*
    ' see http://msdn.microsoft.com/en-us/library/windows/desktop/aa371634(v=vs.85).aspx for more info
    ' Update the Service Entry to stop and delete service while uninstalling
    query = "INSERT INTO ServiceControl (ServiceControl, Name, Event, Arguments, Wait, Component_) VALUES ('MAD_Service', 'Service name', '160', '', '1', '"
    + componentName + "')"
    Set view = database.OpenView(query)
    : CheckError
    view.Execute : CheckError
    ' Update the Service Entry to stop and delete service while installing
    query = "INSERT INTO ServiceControl (ServiceControl, Name, Event, Arguments, Wait, Component_) VALUES ('MAD2_Service', 'Service name', '10', '', '1', '"
    + componentName + "')"
    Set view = database.OpenView(query)
    : CheckError
    view.Execute : CheckError
    *clip*clip*clip*
    We can uninstall service first by following Strategy 2, but then we lose transactional support.
    So, Simon did I encourage you to change your code a bit?:)
    And, btw, if you don't want to change the strategy, please don't rely on SequenceID in MSI table, it can be change, you have to get the at the runtime.
    Hope it will help to everybody!
    See also more advanced explanation of how MSI works
    here.
    Truly yours, Marat

  • How to deal with 0...n or 1...n mappings?

    Hi all,
    I'm relatively new to BPM. I've already made several processes that are working fine. However, I'm now stuck because, for the life of me, I'm not able to understand how to deal with data mappings of nodes of a cardinality greater than 1...1.
    I'm used to dealing with 0...n inputs of Web Services in Webdynpro Java and CAF Application services, using java code... but I just don't get how to deal with these in a BPM data mapping scenario.
    Let's say you have a Web Service whose input is a node called "Employee", where you can add n Employee objects, like this:
       Employee (0...n)
          FirstName: String
          LastName: String
    How do you:
    1- map a 0...n context node from a Web Dynpro or Web Service output, already containing several employees, into this Employee 0...n WS input node?
    2- map a 0...n context node from a Web Dynpro or Web Service output, containing NO employees, into this Employee 0...n WS input node, without getting an error and the BPM crashing because it says the employee element is not found?
    Hopefully someone can help me with this, because I'm about to go the way of calling the web service n times, one employee at a time, instead of one time with a Employee object with n registries in it.
    Thanks!

    Hi Abhijeet,
    i think i should have mentioned this earlier. My Employee node is inside another node.  So, the actual input structure of the WS is this:
    InputValues (1...1)
       Employees (0..n)
          FirstName: String
          LastName: String
    This scenario works OK in BPM when mapping a 0..n node using deep copy as Jocelyn explained, but I still doesn't work if I want to pass an empty (not null) Employees array.
    If I go to the WS Navigator and run this WS with the following parameters, it runs ok (I get an output message saying no employee was selected, which is how it should work):
    InputValues -  "Is null" checkbox not activated.
       Employees - "Skip" checkbox not activated
          FirstName - "Skip" checkbox activated
          LastName - "Skip" checkbox activated
    However, if instead of activating the checkbox of, say, "FirstName", I enter a "" value, I get an error from the WS saying that's not a vaild first name, which is also how it should work.
    In java code, I would just pass an empty InputValues object to the WS, but I'm not sure how to do this in a BPM without it being considered null, and without having to set on of its String-child values to "".
    Do you know how to achieve this?

  • How to deal with the barcode?

    i'm developing a file storage system in java, there're two barcode on each file(one is pdf417, the other one is code128) , but now ,there's a problem confused me :
    i use the barcode scanner to scan the file and get images of these files from the scanner , but i have no idea how to deal with these images,
    i need the barcode information on the images, and i know there're some java components can help me to read the barcode from images , for example : BarcodeReader from Barcode Library, but these components were too expensive for me , is there any other way can solve this problem?

    yes, look for a cheaper component...
    Or write your own...
    Or save up until you can afford the more expensive ones...

Maybe you are looking for