Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6018931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:20:46+00:00 2026-05-23T03:20:46+00:00

I was wondering if I can develop a Desktop App for LinkedIn using Java.

  • 0

I was wondering if I can develop a Desktop App for LinkedIn using Java. I know it can be done as a web application easily, but a completely desktop application, is it possible?
I had a look at the linkedin api’s and Java Wrapper for LinkedIn.
The code was explained for a web application. How do I manage that in a java desktop app, specifically the authorization part?
oAuth using Swing?

Please direct me in the right way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:20:47+00:00Added an answer on May 23, 2026 at 3:20 am

    After a very long time of testing with oAuth (with my own wrappers), I settled for Scribe which is a Java Wrapper for almost all oAuth mechanisms. To include Linkedin in a Desktop client, as Adam Trachtenberg (Thank you again) suggested, oob option was used, i.e., after logging in, a code generated by linkedin has to be entered in our Client so that it can be validated against the requested url. Hope this is useful for someone.

    public class LinkedInExample
        {
      private static final String PROTECTED_RESOURCE_URL = "http://api.linkedin.com/v1/people/~/connections:(id,last-name)";
    
      public static void main(String[] args) throws IOException
      {
        OAuthService service = new ServiceBuilder()
                                    .provider(LinkedInApi.class)
                                    .apiKey("YourApiKey")
                                    .apiSecret("YourApiSecret")
                                    .build();
        Scanner in = new Scanner(System.in);
        //BareBonesBrowserLaunch.openURL("www.google.com");
        System.out.println("=== LinkedIn's OAuth Workflow ===");
        System.out.println();
    
        // Obtain the Request Token
        System.out.println("Fetching the Request Token...");
        Token requestToken = service.getRequestToken();
        System.out.println("Got the Request Token!");
        System.out.println();
    
        System.out.println("Now go and authorize Scribe here:");
        String authURL = service.getAuthorizationUrl(requestToken);
        System.out.println(authURL);
        BareBonesBrowserLaunch.openURL("www.google.com");
        System.out.println("And paste the verifier here");
        System.out.print(">>");
        Verifier verifier = new Verifier(in.nextLine());
        System.out.println();
    
        // Trade the Request Token and Verfier for the Access Token
        System.out.println("Trading the Request Token for an Access Token...");
        Token accessToken = service.getAccessToken(requestToken, verifier);
        System.out.println("Got the Access Token!");
        System.out.println("(if your curious it looks like this: " + accessToken + " )");
        System.out.println();
    
        // Now let's go and ask for a protected resource!
        System.out.println("Now we're going to access a protected resource...");
        OAuthRequest request = new OAuthRequest(Verb.GET, PROTECTED_RESOURCE_URL);
        service.signRequest(accessToken, request);
        Response response = request.send();
        System.out.println("Got it! Lets see what we found...");
        System.out.println();
        System.out.println(response.getBody());
    
        System.out.println();
        System.out.println("Thats it man! Go and build something awesome with Scribe! :)");
      }
    
    }
    

    The BareBonesBrowserLaunch is used to launch the default browser with the Linkedin URL for the token request in most OS’s. Since the Desktop part is not available in Java 1.5, the BareBonesBrowserLaunch solves the problem.

    public class BareBonesBrowserLaunch {
    
       static final String[] browsers = { "google-chrome", "firefox", "opera",
          "epiphany", "konqueror", "conkeror", "midori", "kazehakase", "mozilla" };
       static final String errMsg = "Error attempting to launch web browser";
    
       public static void openURL(String url) {
          try {  //attempt to use Desktop library from JDK 1.6+
             Class<?> d = Class.forName("java.awt.Desktop");
             d.getDeclaredMethod("browse", new Class[] {java.net.URI.class}).invoke(
                d.getDeclaredMethod("getDesktop").invoke(null),
                new Object[] {java.net.URI.create(url)});
             //above code mimicks:  java.awt.Desktop.getDesktop().browse()
             }
          catch (Exception ignore) {  //library not available or failed
             String osName = System.getProperty("os.name");
             try {
                if (osName.startsWith("Mac OS")) {
                   Class.forName("com.apple.eio.FileManager").getDeclaredMethod(
                      "openURL", new Class[] {String.class}).invoke(null,
                      new Object[] {url});
                   }
                else if (osName.startsWith("Windows"))
                   Runtime.getRuntime().exec(
                      "rundll32 url.dll,FileProtocolHandler " + url);
                else { //assume Unix or Linux
                   String browser = null;
                   for (String b : browsers)
                      if (browser == null && Runtime.getRuntime().exec(new String[]
                            {"which", b}).getInputStream().read() != -1)
                         Runtime.getRuntime().exec(new String[] {browser = b, url});
                   if (browser == null)
                      throw new Exception(Arrays.toString(browsers));
                   }
                }
             catch (Exception e) {
                JOptionPane.showMessageDialog(null, errMsg + "\n" + e.toString());
                }
             }
          }
    
       }
    

    The LinkedInExample is taken mostly from this library – https://github.com/fernandezpablo85/scribe-java/downloads
    Don’t forget to include the Scribe jar and apache commons-codec (for Base64)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if I can still develop 32-bit apps using a 64-bit machine (64-bit
I'm wondering how can I submit a form via Ajax (using prototype framework) and
Wondering if anyone can help me with this annoying but trivial (in terms of
I'm planning to develop a remote desktop system consisting of: The desktop application that
I am very new to cloud computing. I was wondering can i develop a
I was wondering how can I set a timeout on a socket_read call? The
I'm wondering how you can implement a program similar to tail -f in C/C++,
I was wondering how i can force a user who has requested a page
I'm wondering if people can suggest the best tutorial that will walk me through
I am wondering if someone can put a bit of an authoritative reference summary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.