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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:23:35+00:00 2026-06-09T09:23:35+00:00

I am wanting to make a simple java applicaiton to play video. I want

  • 0

I am wanting to make a simple java applicaiton to play video. I want it to play mpeg4 and mov formats in particular. JMF is what I started with and I have a lovely working example. However, there is no support for mov or mpeg4 formats. I’ve looked at Xuggler but can’t see a SIMPLE way to get it working. VLCJ seemed easy – I downloaded the jar files and attached them to my project (vlcj-2.1.0.jar, jna-3.4.0.jar, platform-3.4.0.jar, vlcj-2.1.0.jar)). I got the sample code and adapted it (below). But when I run the code, I get a java.lang.NullPointerException exception. I’ve tried adjusting the number and direciton of the slashes (forward and backward) in the filename. Nothing seems to work. Please could you help???

import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.JFileChooser;

import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import java.lang.Object;
import uk.co.caprica.vlcj.mrl.FileMrl;

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

import com.sun.jna.Native;
import com.sun.jna.NativeLibrary;


public class TestPlayer {

  private final JFrame frame;
  private EmbeddedMediaPlayerComponent mediaPlayer;

  public static void loadLibs(){
      NativeLibrary.addSearchPath(
        RuntimeUtil.getLibVlcLibraryName(), "C:/Program Files/VideoLAN/VLC/"
     );
        Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);
  }

  public static void main(final String[] args){
    loadLibs();   
      final String mrl = "file://C:/Test.mov";
        SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            new TestPlayer().run(mrl);
        }
    });
  }
  public TestPlayer(){
      frame = new JFrame("test VLCJ");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setLocation(100,100);
      frame.setSize(600,400);
      frame.setVisible(true);
  }
  private void run(String mrl){
    System.out.println(mrl);
    try{
        mediaPlayer.getMediaPlayer().playMedia(mrl);
    }catch(Exception e){
        System.err.println(e.toString());
    }

  }
}

I’m using VLC version 2.0.2 and VLCJ 2.1.0 sources and JDK 1.7 on windows 32 bit. I hope it’s something simple…

  • 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-09T09:23:36+00:00Added an answer on June 9, 2026 at 9:23 am

    It looks like you are using mediaPlayerwithout ever initializing it, thus causing a NullPointerException in run().

    Try initializing it in your constructor.

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

Sidebar

Related Questions

I have been wanting to make a circular preloader in my iPhone app, but
I have to integrate a Java applet into a simple asp.net 2.0 control. This
I'm wanting to make an API quickly, following REST principles - for a simple
I'm trying to make a simple http client server using java. It will show
I want to make a simple GAE app in Go that will let users
I am a .Net developer, wanting to make my first Android app. I have
I'm looking to make a gallery of images and am wanting to know how
I'm wanting to incorporate HTML5 database storage into my web application to make it
I have built a variety of little scripts using Ruby's very simple Queue class,
I was wanting a simple string table that will store a bunch of constants

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.