サンプル Java コードを実行して、 https: //developers.google.com/drive/quickstartで提供されている Google ドライブにファイルをアップロードしようとしています。jar ファイルをダウンロードしてクラスパスに配置し、クライアント ID とクライアントも取得しました。 secret.I は次のエラーを取得しています。
E:\>javac -classpath /path/to/google/lib/*:/path/to/google/lib/libs/* DriveCommandLine.java
DriveCommandLine.java:1: パッケージ com.google.api.client.googleapis.auth.oauth2 が存在しません import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; ^ DriveCommandLine.java:2: パッケージ com.google.api.client.googleapis.auth.oauth2 が存在しません import com.google.api.client.googleapis.auth.oauth2.GoogleCredential; ^ DriveCommandLine.java:3: パッケージ com.google.api.client.googleapis.auth.oauth2 が存在しません import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse; ^ DriveCommandLine.java:4: パッケージ com.google.api.client.http が存在しません import com.google.api.client.http.FileContent; ^ DriveCommandLine.java:5: パッケージ com. google.api.client.http は存在しません import com.google.api.client.http.HttpTransport; ^ DriveCommandLine.java:6: パッケージ com.google.api.client.http.javanet が存在しません import com.google.api.client.http.javanet.NetHttpTransport; ^ DriveCommandLine.java:7: パッケージ com.google.api.client.json が存在しません import com.google.api.client.json.JsonFactory; ^ DriveCommandLine.java:8: パッケージ com.google.api.client.json.jackson が存在しません import com.google.api.client.json.jackson.JacksonFactory; ^ DriveCommandLine.java:9: パッケージ com.google.api.services.drive が存在しません import com.google.api.services.drive.Drive; ^ DriveCommandLine.java:10: パッケージ com.google.api. services.drive が存在しません import com.google.api.services.drive.DriveScopes; ^ DriveCommandLine.java:11: パッケージ com.google.api.services.drive.model が存在しません import com.google.api.services.drive.model.File; ^ DriveCommandLine.java:27: シンボル symbol が見つかりません: class HttpTransport 場所: class DriveCommandLine HttpTransport httpTransport = new NetHttpTransport(); ^ DriveCommandLine.java:27: シンボル symbol が見つかりません: クラス NetHttpTransport 場所: クラス DriveCommandLine HttpTransport httpTransport = new NetHttpTransport(); ^ DriveCommandLine.java:28: シンボル symbol が見つかりません: クラス JsonFactory の場所: クラス DriveCommandLine JsonFactory jsonFactory = new JacksonFactory(); ^ DriveCommandLine. java:28: シンボル symbol が見つかりません: クラス JacksonFactory の場所: クラス DriveCommandLine JsonFactory jsonFactory = new JacksonFactory(); ^ DriveCommandLine.java:30: シンボルが見つかりません symbol: クラス GoogleAuthorizationCodeFlow 場所: クラス DriveCommandLine GoogleAuthorizationCodeFlow フロー = 新しい GoogleAuthorizationCodeFlow.Builder( ^ DriveCommandLine.java:30: パッケージ GoogleAuthorizationCodeFlow は存在しません GoogleAuthorizationCodeFlow フロー = 新しい GoogleAuthorizationCodeFlow.Builder( ^ DriveCommandLine.java :31: シンボル symbol が見つかりません: 変数 DriveScopes 場所: クラス DriveCommandLine httpTransport, jsonFactory, CLIENT_ID, CLIENT_SECRET, Arrays.asList(DriveScopes. DRIVE)) ^ DriveCommandLine.java:41: シンボル symbol が見つかりません: クラス GoogleTokenResponse 場所: クラス DriveCommandLine GoogleTokenResponse 応答 = flow.newTokenRequest(code).setRedirectUri(REDIRECT_URI).execute(); ^ DriveCommandLine.java:42: シンボル symbol が見つかりません: class GoogleCredential 場所: class DriveCommandLine GoogleCredential credential = new GoogleCredential().setFromTokenResponse(response); ^ DriveCommandLine.java:42: シンボル symbol が見つかりません: class GoogleCredential 場所: class DriveCommandLine GoogleCredential credential = new GoogleCredential().setFromTokenResponse(response); ^ DriveCommandLine.java:45: シンボル symbol が見つかりません: クラス ドライブの場所: class DriveCommandLine Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).build(); ^ DriveCommandLine.java:45: パッケージ Drive が存在しません Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).build(); ^ DriveCommandLine.java:48: シンボル symbol が見つかりません: class ファイルの場所: class DriveCommandLine ファイル本体 = new File(); ^ DriveCommandLine.java:48: シンボル symbol が見つかりません: class ファイルの場所: class DriveCommandLine ファイル本体 = new File(); ^ DriveCommandLine.java:54: シンボル symbol が見つかりません: class FileContent 場所: class DriveCommandLine FileContent mediaContent = new FileContent("text/plain", fileContent); ^ DriveCommandLine.java:54: シンボル symbol が見つかりません: クラス FileContent の場所: class DriveCommandLine FileContent mediaContent = new FileContent("text/plain", fileContent); ^ DriveCommandLine.java:56: シンボル symbol が見つかりません: class ファイルの場所: class DriveCommandLine ファイル file = service.files().insert(body, mediaContent).execute(); ^ 28 エラー
ありがとう。