Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4082904
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:14:43+00:00 2026-05-20T18:14:43+00:00

I am very new to JAVA. I have written simple program (in Linux -VIM

  • 0

I am very new to JAVA. I have written simple program (in Linux -VIM editor), compiled and executed it, everything is fine.

Now,I have moved that file to a different directory and am trying to compile(javac Myfile.java) it, but it throws an error message as javac-not found.

Can somebody explain what is the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:14:44+00:00Added an answer on May 20, 2026 at 6:14 pm

    Your original question was not totally clear (since it did not contain the complete error message).

    From your comment:

    $ javac Example1.java
    javac: file not found: Example1.java
    Usage: javac <options> <source files> use -help for a list of possible options
    

    So, javac did not find your file example java.

    Normally, you should not have to set the CLASSPATH (use export CLASSPATH= in bash), and javac would search the source in the current directory. Is your Example1.java in the current directory? (Type ls and look at the output.)

    If not, you should give the path to this file to javac as a parameter … but it really is better so simply move to the right directory with cd.

    If you are using packages, position your shell to the directory on top of the package directory hierarchy, and call the compiler with the relative filename from there.


    Edit, since I see the next questions coming:

    • The compiler will put the resulting class files in the output directory tree given by the -d parameter (or the current directory, if not given), by their package structure, so make sure you search them there later (when invoking the program).
    • If the compiler needs other classes to compiler the files indicated in the command line, it searches class files in the classpath (given by the -classpath or -cp option, or by the CLASSPATH environment variable, or the current directory) and source files in the sourcepath (given by the -sourcepath option or the classpath if no sourcepath is set). If for a needed both exist and the source file is newer, it is recompiled too. (They are searched according to the package-structure, too.)

      So in this case you should make sure to pass the -sourcepath option so the compiler can find your other source files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me start by saying, I am new to Java programming. I have coded
I am new to Java and have background of C.I am going through Khalid
I'm new to java and having some problems. The main idea is to connect
An algorithm written in Java should be faster than the same algorithm written in
I am new to java and database connections and I am trying to make
Hello I have very strange problem and maybe some of you could help my.
I have many small java programs running in crons in my server. I have
This is a very simple question for many of you reading this, but it's
I have a feeling my problem is a bit strange, but here goes... I
I'm attempting to create my own custom ToolTip for a program I've ported to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.