This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

extending Google SOAP's API class "GoogleSearch"  RSS feed

 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got the following class to compile.

package com.google.soap.search;
import java.io.*;



It takes three args 0=google client ID, 1 = "search", 2 = "search terms"

it's in the directory ~/googleapi.jar_FILES$ where the "com.google..." folders start. But when I run it I get this error

java.lang.NoClassDefFoundError: MySearch (wrong name: com/google/soap/search/MySearch)


What am I doing wrong?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because of the "package" statement, the class's full name is, as the error message says, com.google.soap.search.MySearch. Java expects to find it in the directory com/google/soap/search, and you need to launch it using the full class name com.google.soap.search.MySearch, not just MySearch.
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, I will try that momentarily...
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now it won't compile in the com...search directory, i get six "cannot find symbol" errors. All the other API classes are in that directory.. here is how my file looks now:



GoogleSearch api doesn't say it requires three args..
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does args[0] only take one token? if args = "Hello World" is args[0] = "Hello"?
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jess@linux:~/GoogleAPI/googleapi/googleapijarcontents/googleapi.jar_FILES$ cp MySearch.class com/google/soap/search/MySearch.class

jess@linux:~/GoogleAPI/googleapi/googleapijarcontents/googleapi.jar_FILES$ java com.google.soap.search.MySearch "Hello World"

Parameters:
Client key = O000000000000000000000000
Directive = search
Args = Hello World
============

Why does it only work this way? Why will it not let me compile in the com...seach directory?
[ June 27, 2006: Message edited by: Jesse Crockett ]
 
Jesse Crockett
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I think I understand. Without the package label, I can compile in that directory.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!