I am a (very) amateur programmer. I am using Groovy to edit MP3 file tags. Previously (about two years ago), I added the
JAudiotagger class library to my Java installation using the detailed instructions given in the
JAudiotagger readme file, and then called the required classes from my Groovy script. However, there is no readme file (that I can find) in the latest version of
JAudiotagger, and I have so far failed to work out what to do.
Please can someone give me simple instructions on how to add
JAudiotagger to Java, e.g. what files do I need to download, from where and what do I do with them.
I am running Windows 7.
All help gratefully appreciated.
The easiest way is to simply download the jar of jAutioTagger and put it in your classpath, so when the program launch, the classes in the jar should be accessible: java classpath
Now if you want a more generic way of handling dependencies altogether, i suggest you start reading about maven (which a build tool with dependecny managment).
You can also use gradle which looks more for groovy but I do not know about it.
As for starting a new project with maven it requires some steps. Here is a lightweight tutorial:
- Create a maven project
- Add the desired dependencies in your pom.xml
- Build the project with libraries embedded
- Run the program
Create a maven project
Type in the following command in your command line:
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=5-SNAPSHOT
It will ask you some questions like the group id and the artifact id as well as the project name.
Add the desired dependencies in your pom.xml
The pom.xml is where you configure your project, like build things and dependencies, to have audiotagger as a dependency add the following:
<dependency> <groupId>org.jaudiotagger</groupId> <artifactId>jaudiotagger</artifactId> <version>2.0.1</version> </dependency>
This will add jaudiotagger to the dependencies of your project, you can add groovy as well. You’ll also need dependencies too groovy and the groovy compiler.
Hint: I use sonatype to find dependencies
Build the project with libraries embedded
Now to build your project with maven. Just type the following command:
mvn clean install
but this will not add the dependencies to your jar, so you need to embedd them by adding a plugin to your pom.xml configuration:
<artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>be.phury.audiotagger.Audiotagger</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration>
You can now generate a jar with dependencies by typing in the command line:
mvn clean install assembly:single
Run the program
Just run the jar
Hope this helps