java - Processing 2.0 Movie cannot open movie file when running from jar -


I am trying to run a film using the processing 2.0 movie class.

If I run my code everything works well with my code editor (in my case) and runs the code without any delay: It searches for the movie and starts.

However, when I export my program in a jar and start it from my terminal, it detects the file, but it crashes when trying to open it.

I am currently using this code to find my movie path string.

  Instead of public string, Movie (String Moviepath) {string movie = movie player. Class. Tag Classloader (). getResource (moviepath) .getPath (); If (movie == faucet) {System.out.println ("wrong error --- movie file not found: '" + moviepath + "' ');} return movie;}   

As you can see that I'm using Classloader to locate the file for me because when I want to export it in a .jar file and do not want to change the path itself .getPath () File: / path / to / my / file in 'file:' as it removes unnecessary faults in the above manner There is a gesture.

A. A little further in my code and I have already added an additional test, to see if the classloader is coming back, there is nothing wrong in that path, Do the following lines.

  file temp = new file (moviePath); System.out.println ("If I have something after this, the file exists: '" + Temporarily + "'');   

This always gives the correct path, even though it is running with my eclipse (/Users/Path/To/My/Folder/2/java/Game/movies/introMovie.mp4) Or executable. From George File (introMovie.mp4).

I first thought that it was strange that in the .jar file it was giving me a file directly without a path because it has some structure in my project but in my command < After using the command> jar tf myProject.jar

the path that gives the same file / path name to the file should be correct and all are still well here Are there.

But now, when I try to load processing through the movie class with the following code:

  currentMovie = new movie (parent, moviepath);   

This is a java.lang.StringIndexOutOfBoundsException exception and crashes. I do not know what I'm doing because this code runs entirely from inside of my code editor. I'm using the same way to find files for my audio files and running those aswell, here Until that executable. Also from the file

As far as I can read it, I need a place to show it only in that place and the path of the file that I am giving both.

I was hoping that some experienced people can see here that I am doing wrong and help me solve this problem, which I am struggling for a few days. It's probably some stupid that I'm just ignoring now.

I do not know what's actually wrong but here are some things that I do:

Check permissions on the video file, make sure that the program has access to it.

I have read that this is a better idea than GetContextClassLoader ()

compared to class Classloader, but I do not know that it will help < Pre> threads P>

The processing libraries are open sources that this exception should be thrown and look at the source. This can help you solve the problem.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -