package, import help

I’m trying to use an AdvancedTimer in my game, so I downloaded the zipped folder from the GAGETimer home and extracted it, then at the top of my class with my other imports I write:

import com.dnsalias.java.timer.*;

This seems very simple but I keep getting a “package com.dnsalias.java.timer does not exist” error. I feel like I just forgot to do somthing with the downloaded files. Please help me.

Library JARs need to be in your classpath both at compile time and runtime. From the command line you’d compile and run like this:

javac -classpath timer.jar MyClass.java
java -cp timer.jar;. MyClass.java

(Change the ‘;’ to a ‘:’ if you’re not on Windows.)

If you’re using an IDE, then you need to check the documentation. For Netbeans, you just mount the JAR to the filesystem. For Eclipse, it’s somewhere in the project properties, but I don’t remember off the top of my head.

Ah. Thanks very much for the speedy and concise answer.