• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java -cp question

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working with google apis.
I created a java file called mygoogle with no package and placed it directly in the root directory of my google folder. Also in the root directory of my google folder is the googleapi.jar file that is needed to compile and run mygoogle. I can compile mygoogle just fine but I cannot run it. From the google directory I do:
java -cp googleapi.jar mygoogle 1234PVQFHIpUjaP10MscjPLxgJQy1U5 search Foo
and I get:
Exception in thread "main" java.lang.NoClassDefFoundError: mygoogle
How do I get around that?
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to including the jar, you need to also include your base directory in your classpath. For example,

java -cp C:\google\googleapi.jar;C:\google mygoogle 1234PVQFHIpUjaP10MscjPLxgJQy1U5 search Foo
 
Praful Thakare
Ranch Hand
Posts: 642
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
If u can also try this
java -cp C:\google\googleapi.jar;. mygoogle 1234PVQFHIpUjaP10MscjPLxgJQy1U5 search Foo
 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys both worked!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic