Also at
stackoverflow
Please if you are going to start a discussion in multiple places, post a link at each to all of the others. This will allow anyone participating in the discussion to know what else is being said. See, for instance,
this post on the topic.
---
Your program is reasonably challenging for someone starting out with programming, but not impossibly so and I only point that out so there is no misconception.
Right from the start you should adopt standard Java programming conventions. The idea is that these conventions (which enhance readability) become a habit and, hence, effortless. Classes begin with a capital letter, and variables and methods with a lowercase one. So
Barcode,
upc etc.
The code you posted is missing a couple of closing braces.
But even once added it isn't exactly clear to me what the problem is. Does the code you posted compile? If not and there are compiler messages you can't understand, post them. Does it do what you expect? (and what is that?) If not, what *does* it do?
(As a network administrator you must be tediously aware of "it doesn't wrok!" substituting for a problem description. The same applies with programming.)
Or is the problem one of deciding on the overall approach? If so I think what you posted *is* a quite workable way to go: get the bar code, form the url, download the content from the server, parse it and spit out the product description. Either JSON or XML is parseable in Java I assume (If I were writing this I would probably opt for XML as being less tied to JavaScript which is a different language.) So it's a matter of implementing each step in Java: reading input from the barcode reader, reading from a url and parsing the resulting xml.
Break it down and tackle each part separately addressing specific problems as they arise.