Skip to content
\n

And my exact file I'm running looks like this:

\n
package com.example;\n\nimport se.michaelthelin.spotify.SpotifyApi;\nimport se.michaelthelin.spotify.model_objects.credentials.ClientCredentials;\nimport se.michaelthelin.spotify.requests.authorization.client_credentials.ClientCredentialsRequest;\n\nimport org.apache.hc.core5.http.ParseException;\nimport se.michaelthelin.spotify.exceptions.SpotifyWebApiException;\n\n\nimport java.io.IOException;\n\n\npublic class App \n{\n    private static final String client_secret = \"clientsecret\";\n    private static final String client_id = \"clientid\";\n   \n    private static final SpotifyApi spotifyApi = new SpotifyApi.Builder()\n        .setClientId(client_id)\n        .setClientSecret(client_secret)\n        .build();\n\n    private static final ClientCredentialsRequest clientCredentialsRequest = spotifyApi.clientCredentials()\n        .build();\n\n    public static void clientCredentials_Sync() {\n        try {\n        final ClientCredentials clientCredentials = clientCredentialsRequest.execute();\n\n        // Set access token for further \"spotifyApi\" object usage\n        spotifyApi.setAccessToken(clientCredentials.getAccessToken());\n\n        System.out.println(\"Expires in: \" + clientCredentials.getExpiresIn());\n        } catch (IOException | SpotifyWebApiException | ParseException e) {\n        System.out.println(\"Error: \" + e.getMessage());\n        }\n  }\n    public static void main( String[] args ){\n        System.out.println( \"Hello World!\" );\n        clientCredentials_Sync();\n    }\n}\n
\n

For reference, I also checked in my .m2 directory and did find the files/dependencies there. The project installs and compiles fine with no warnings but as soon as I run my jar file it gives me the error mentioned above. I'm pretty sure it's something on my part but would like to make sure I'm following along correctly. Any help is appreciated!

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

I'd recommend asking general maven usage questions on StackOverflow instead. Your question will have higher visibility over there to people who'd like to debug that issue together with you.

","upvoteCount":1,"url":"https://github.com/spotify-web-api-java/spotify-web-api-java/discussions/323#discussioncomment-4390351"}}}
Discussion options

You must be logged in to vote

I'd recommend asking general maven usage questions on StackOverflow instead. Your question will have higher visibility over there to people who'd like to debug that issue together with you.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lwl67
Comment options

Answer selected by lwl67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants