We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Maheswari S.
11 years agoNew member | Level 1
how to install dropbox java sdk. steps to connect java to dropbox. i got secret key. but the example given for java api for dropbox throws exception.
public static void main(String[] args) throws IOException, DbxException {
// Get your app key and secret from the Dropbox developers website.
final String APP_KEY = "my key";
final String APP_SECRET = "my appsecret";
DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET);
DbxRequestConfig config = new DbxRequestConfig("x",Locale.getDefault().toString());
DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo);
String authorizeUrl = webAuth.start();
System.out.println("1. Go to: " + authorizeUrl);
System.out.println("2. Click \"Allow\" (you might have to log in first)");
System.out.println("3. Copy the authorization code.");
String code = new BufferedReader(new InputStreamReader(System.in)).readLine().trim();
DbxAuthFinish authFinish = webAuth.finish(code);
DbxClient client = new DbxClient(config, authFinish.accessToken);
System.out.println("Linked account: " + client.getAccountInfo().displayName);
}
}
output:
Exception in thread "main" com.dropbox.core.DbxException$NetworkIO: java.net.UnknownHostException: api.dropbox.com
how to solve this exception
1 Reply
Replies have been turned off for this discussion
- Steve M.11 years ago
Dropbox Staff
That sounds like a networking issue. Are you able to reach dropbox.com in a browser?
Is there anything unusual about your network/proxy setup?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!