• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

jar file issue

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Using cygwin, I have a jar file : javase.jar (which I have chmod 777 on)


It contains:

$ jar tf javase.jar
META-INF/INDEX.LIST
META-INF/
META-INF/MANIFEST.MF
com/
com/google/
com/google/zxing/
com/google/zxing/client/
com/google/zxing/client/j2se/
com/google/zxing/client/j2se/BufferedImageLuminanceSource.class
com/google/zxing/client/j2se/CommandLineRunner.class
com/google/zxing/client/j2se/GUIRunner.class
com/google/zxing/client/j2se/ImageConverter.class
com/google/zxing/client/j2se/MatrixToImageWriter.class


However, when I try to run (in the same subdirectory the jar file is in)CommandLineRunner.class
which I have confirmed has a main statement in it

I get:

$ java -cp javase.jar com.google.zxing.client.j2se.CommandLineRunner
java.lang.NoClassDefFoundError: com/google/zxing/NotFoundException
Caused by: java.lang.ClassNotFoundException: com.google.zxing.NotFoundException
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: com.google.zxing.client.j2se.CommandLineRunner. Program will exit.
Exception in thread "main"

Thanks
Brian

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently the NotFoundException is not in the jar?

The getting started docs mention a core jar; are you following their directions?
 
Brian R Wolf
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

well... this seems to indicate it is in the jar file:

$ jar tf javase.jar

......

com/google/zxing/client/j2se/CommandLineRunner.class

.....



Actually I also posted the problem to the authors here:

https://groups.google.com/group/zxing/browse_thread/thread/c00e060794ce8218

they don't see why either

I rebuilt everything

(
ant -f core/build.xml
ant -f javase/build.xml
)

and....

$ java -cp javase/javase.jar:core/core.jar com.google.zxing.client.j2se.CommandLineRunner http://www.google.com/m
java.lang.NoClassDefFoundError: com/google/zxing/client/j2se/CommandLineRunner
Caused by: java.lang.ClassNotFoundException: com.google.zxing.client.j2se.CommandLineRunner
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: com.google.zxing.client.j2se.CommandLineRunner. Program will exit.
Exception in thread "main"

(I'm beginning to think gremlins :-)

Brian

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe you misread my response, and the error message you're getting in your second message is *not* the same as the first, nor is it likely the command you've used in your second message the same as in the first: see the difference? In your first message you weren't including the core library.

If you're using the Windows Java executable, your classpath separator needs to be ";" (a semi-colon), and in Cygwin, you'll need to preface the semi-colon with a "\" (backslash) to escape it. The response to your thread on Google groups says much the same thing--did you actually try it?
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic