Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Command Line:</strong></p> <p>If you are trying to build it without an IDE and are using the Main.java file included on the <a href="https://www.dropbox.com/developers/core/start/java" rel="nofollow noreferrer">Dropbox Site</a>...</p> <pre><code>// Include the Dropbox SDK. import com.dropbox.core.*; import java.io.*; import java.util.Locale; public class Main { public static void main(String[] args) throws IOException, DbxException { // Get your app key and secret from the Dropbox developers website. final String APP_KEY = "INSERT_APP_KEY"; final String APP_SECRET = "INSERT_APP_SECRET"; DbxAppInfo appInfo = new DbxAppInfo(APP_KEY, APP_SECRET); DbxRequestConfig config = new DbxRequestConfig("JavaTutorial/1.0", Locale.getDefault().toString()); DbxWebAuthNoRedirect webAuth = new DbxWebAuthNoRedirect(config, appInfo); // Have the user sign in and authorize your app. 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(); // This will fail if the user enters an invalid authorization code. DbxAuthFinish authFinish = webAuth.finish(code); DbxClient client = new DbxClient(config, authFinish.accessToken); System.out.println("Linked account: " + client.getAccountInfo().displayName); File inputFile = new File("working-draft.txt"); FileInputStream inputStream = new FileInputStream(inputFile); try { DbxEntry.File uploadedFile = client.uploadFile("/magnum-opus.txt", DbxWriteMode.add(), inputFile.length(), inputStream); System.out.println("Uploaded: " + uploadedFile.toString()); } finally { inputStream.close(); } DbxEntry.WithChildren listing = client.getMetadataWithChildren("/"); System.out.println("Files in the root path:"); for (DbxEntry child : listing.children) { System.out.println(" " + child.name + ": " + child.toString()); } FileOutputStream outputStream = new FileOutputStream("magnum-opus.txt"); try { DbxEntry.File downloadedFile = client.getFile("/magnum-opus.txt", null, outputStream); System.out.println("Metadata: " + downloadedFile.toString()); } finally { outputStream.close(); } } } </code></pre> <p>Use these command lines in a terminal from the appropriate directory:</p> <p>To Compile: <code>javac -cp dropbox-core-sdk-1.7.5.jar Main.java</code><br> To Run: <code>java -cp .;dropbox-core-sdk-1.7.5.jar;jackson-core-2.2.3.jar Main</code> (use <code>:</code> instead of <code>;</code> for Unix-like operating systems)</p> <p><strong>Eclipse IDE:</strong></p> <p>If you are using the <code>Eclipse</code> IDE, you can simply copy the <code>dropbox-core-sdk-1.7.5.jar</code> file into your project, right click on it, and select the menu option <code>Build Path -&gt; Add to Build Path</code>. It should then appear in your <code>Referenced Libraries</code> folder in the <code>Package Explorer</code> window, and then you should be able to import and use it.</p> <p>Repeat the process for <code>jackson-core-2.2.3.jar</code>.</p> <p>This link has multiple step by step images of the general process of adding a <code>.jar</code> file to your project if you prefer: <a href="http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)" rel="nofollow noreferrer">http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)</a></p> <p><img src="https://i.stack.imgur.com/5nCJe.png" alt="enter image description here"></p> <pre><code>// Import whatever you want from the Dropbox SDK... import com.dropbox.*; // everything import com.dropbox.core.*; import com.dropbox.core.http.*; import com.dropbox.core.json.*; import com.dropbox.core.util.*; public class Test { public static void main(String[] args) { // Do stuff } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload