0

My project requires the gif4j suite. So I set the classpath to "C:...\gif4j_pro_trial_2.3.jar" in the Environmental Variables window from my Control Panel. I know that when we have multiple values for classpath, you seperate them with a semi-colon. I did that too. But I'm still getting this error when I run the file.

Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
    The import com.gif4j.TextPainter cannot be resolved
    The import com.gif4j.Watermark cannot be resolved

I don't really understand what's going on here since I'm not the one who wrote the code. What am I missing?

3
  • have u tried compiling ur code again after setting the class path? Commented Mar 15, 2012 at 11:42
  • I meant the Windows control panel @Andreas_D Commented Mar 15, 2012 at 13:21
  • @AshwiniRaman No I haven't! Will that make a difference? Commented Mar 15, 2012 at 13:28

2 Answers 2

1

This error doesn't say anything about not being able to find the gif4j classes at runtime. Instead, it's saying that, when the code was compiled, those classes weren't available. javac does not produce these kinds of errors (instead it simply fails to compile), so I'm assuming this code was compiled by Eclipse. In that case, you should check your Eclipse project configuration and make sure that the gif4j libraries are properly included there.

Sign up to request clarification or add additional context in comments.

2 Comments

Ok I do believe the project was compiled in Eclipse. But I'm new to it so I don't know where to check. So, anyway, what you're saying is that I should properly include the libraries and compile the code again? No need to bother about about setting the classpath variable?
Yes, you should properly include the libraries and compile the code again. You probably will also need to set the classpath variable to run the code, but you won't know that for sure until you've got the code compiled correctly.
1

The throw new Error(..() statement has been created by eclipse. Whenever eclipse can't compile a class because of compile time errors in methods, it tries to create stubs for those methods. So you'll always find a class file, even if the source code has errors.

Such a method would look like (example):

public long calculate(long a, long b) {
   throw new Error("Unresolved compilation problems");  // + additional information
}

It doesn't actually exist in your source, it's only created on byte code level.

So, what has happened: Most likely that you (or someone else) ignored error markers in your project and now tried to use the class files in the bin folder. You can't fix that problem at runtime, you have fix the project to create properly compiled classes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.