views:

116

answers:

2

I am unable to compile a Java program because some of the imported packages are not found even though they are in both the build classpath and runtime classpath.

The image below shows the problem. I have highlighted the gdata-media package in eclipse. It corresponds to the first compile error.

screenshot Click for full size

What am I doing wrong?

+4  A: 

The Eclipse classpath and project setup has no bearing on the command line javac tool

dty
I wasn't commenting on your tagging! You appear to be using javac from the command line and expecting it to somehow pay attention to your Eclipse project settings.
dty
A: 

What's the command you are using to compile your code? Do you have something like -cp or -classpath there? Make sure that the jar file containing YouTubeUpld class is part of that -classpath parameters. More on how to set up CLASSPATH can be found here. If you do not specify the classpath explicitly javac reads it from the CLASSPATH environment variable

By the way why can't you just launch your app from Eclipse since it compiles there?

CoolBeans
I'm compiling automatically in Eclipse but I need to run the jar on the command line because the program takes in arguments.
Anthony
You can pass arguments in Eclipse too. Go to Run->Run Configurations. Then on the left hand side you should see a tree folder called Java Application. Expand it and select your project. Then on the right hand side go to Arguments tab and and put in your arguments under the program arguments. For more info see the link here http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-java-local-configuration.htm . HTH.
CoolBeans
Thanks, didn't see that...
Anthony