Search code examples
javajarmp4executable-jarmp4parser

Import library is not resolved


I have tried to compile a java program, shorten.java from mp4parser site. But my jar file is unable to resolve the required import shown below. This program needs to import library from iso mp4parser as mentioned below. In short I need jar file for shorten.java file to resolve these import.

import com.coremedia.iso.IsoFile;
import com.coremedia.iso.boxes.TimeToSampleBox;
import com.googlecode.mp4parser.authoring.Movie;
import com.googlecode.mp4parser.authoring.Track;
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
import com.googlecode.mp4parser.authoring.tracks.CroppedTrack;

I have downloaded the source code from the mp4parser site to create the jar file for these library.

In below image java->com->coremedia->iso and java->com->coremedia->iso->boxes having required java program

and java->com->googlecode->mp4parser->authoring etc. having other needed java program for these import

I have created the jar by following command-

cd  java           // moved in java folder

jar cfv mp4parser.jar   *

now add these jar to my shorten.java program. But I am getting error that import is not resolved.

****Do anybody can tell me where I am doing mistake ???****

Here is the directory where java codes for these imports are available.

directory structure for included java code


Solution

  • I suggest you to this:

    • Create a quickstart java project with maven;
    • Add the dependencies that you want;
    • Put the java class in src/main/java
    • mvn clean install

    If it don't work, try some IDE, like eclipse. Open the project and try to fix the imports... It's always possible that some lib has changed, and maybe they change the name of the package.