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 8916389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:13:53+00:00 2026-06-15T05:13:53+00:00

I am writing a code in Java to upload videos to youtube from mu

  • 0

I am writing a code in Java to upload videos to youtube from mu application.

My code is :

package com.youtube.video;

import java.io.IOException;
import java.net.URL;
import com.google.gdata.client.youtube.YouTubeService;
import com.google.gdata.data.media.mediarss.MediaCategory;
import com.google.gdata.data.media.mediarss.MediaDescription;
import com.google.gdata.data.media.mediarss.MediaKeywords;
import com.google.gdata.data.media.mediarss.MediaTitle;
import com.google.gdata.data.youtube.FormUploadToken;
import com.google.gdata.data.youtube.VideoEntry;
import com.google.gdata.data.youtube.YouTubeMediaGroup;
import com.google.gdata.data.youtube.YouTubeNamespace;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ServiceException;

public class YouTubeController {

    public static YouTubeService service;

    public void init() {
      if (service == null) {
        service = new YouTubeService("mail@gmail.com", "A...A");
        String username = "mail@gmail.com";
        String password = "xxxxxxxxx";

        try {
          service.setUserCredentials(username, password);
        } catch (AuthenticationException ae) {
          ae.printStackTrace();
        }
      }
    }

    static String token;
    static String formUrl;
    public static void setFormDetails() throws IOException {
      VideoEntry newEntry = new VideoEntry();
      YouTubeMediaGroup mg = newEntry.getOrCreateMediaGroup();

      String videoTitle = "this is a title";

      mg.addCategory(new MediaCategory(YouTubeNamespace.CATEGORY_SCHEME, "Autos"));
      mg.setTitle(new MediaTitle());
      mg.setPrivate(false);
      mg.setKeywords(new MediaKeywords());
      mg.getKeywords().addKeyword("");
      mg.getTitle().setPlainTextContent(videoTitle);
      mg.setDescription(new MediaDescription());
      mg.getDescription().setPlainTextContent(videoTitle);

      URL uploadUrl = new URL("http://gdata.youtube.com/action/GetUploadToken");

      try {
        FormUploadToken fut = service.getFormUploadToken(uploadUrl, newEntry);
        token = fut.getToken();
        System.out.println(">>>>>"+token);
        formUrl = fut.getUrl();
      } catch (ServiceException se) {
        se.printStackTrace();
      }
    }

    public static void main(String s[]) throws IOException {
        YouTubeController yc = new YouTubeController();
        yc.init();
        yc.setFormDetails();
    }
}

I have the following jars in lib folder :

gdata-client-1.0.jar
gdata-youtube-2.0.jar
gdata-core-1.0.jar
gdata-media-1.0.jar
google-collect-1.0.jar
guava-13.0.1.jar
mail.jar
activation.jar

But while running this piece of code, it is giving me the following error :

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;
    at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399)
    at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387)
    at com.google.gdata.wireformats.AltFormat.<clinit>(AltFormat.java:49)
    at com.google.gdata.client.Service.<clinit>(Service.java:558)
    at com.zeta.video.YouTubeController.init(YouTubeController.java:23)
    at com.zeta.video.YouTubeController.main(YouTubeController.java:66)

I tried all solutions over net, and all of them points out that this error is because i am missing some JAR files. But i am having all the JARs. Can someone help me with this issue?

  • 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-06-15T05:13:54+00:00Added an answer on June 15, 2026 at 5:13 am

    It looks as though you are referencing both google-collections and guava. Since guava is a superset of google-collections you actually only need to reference guava. Remove the reference to google-collections and you should find the problem is resolved.

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

Sidebar

Related Questions

I'm writing an application in Java that will upload a file up to AWS
I am writing a Google App Engine (Java) application that reads data from a
Im trying to access the org.testng.reporters.XMLReporter from my Java code. I am writing code
I am writing java code for EC2 that will consume messages from SQS. My
I am writing code in Java where I branch off based on whether a
I am writing java code. which will work on windows and linux. some code
I am writing some Java code that authenticates to Active Directory using SASL GSSAPI.
I'm writing some Java code that deals with Chinese characters, and I got some
I'm writing some java code that's supposed to parse csv files with different column
I'm writing HTML code for a Java servlet. I first write the code in

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.