0

I have 3 *.Java files. Two of the three have the statement package com.osama.temp and the main class does not have this statement. It only imports the 2 other classes like import com.osama.temp.List.

I don't know how to compile it with the Command line console .. please Help!

2
  • Have you structured the source code file locations according to the package declarations? You don't have to, but it helps. Commented Dec 31, 2013 at 16:36
  • the problem that i want to tell the compiler where to get the other .class files ! Commented Dec 31, 2013 at 17:03

1 Answer 1

1

In the directory where the main class lives create a subdirectory structure like com/osama/temp/ and put the other 2 .java files in there. Then you should be able to compile it with javac Main.java

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

2 Comments

I would personally always specify all of the source files, rather than relying on it finding them itself. It just feels cleaner to me.
Is there another way to tell the compiler where my *.class files exists !

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.