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

  • Home
  • SEARCH
  • 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 5850647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:10:11+00:00 2026-05-22T13:10:11+00:00

Working with some basic java apps on CentOS 5 linux and I have my

  • 0

Working with some basic java apps on CentOS 5 linux and I have my classpath set to point to home/pathToJava/bin which contains javac and java

and I have .java files in home/pathToFolderA/src

and home/pathToFolderB/gen-java

When I run javac and java in home/pathToFolderA/src everything works perfectly

But when I run javac from within home/pathToFolderB/gen-java on fileName.java I get a file not found error, specifically

javac: file Not found: fileName.java
Usage: javac <options> <source files>

Why could this be happening?

Thanks for all help

  • 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-22T13:10:12+00:00Added an answer on May 22, 2026 at 1:10 pm

    You shouldn’t set your classpath to point to your JDK bin directory — instead it should be the PATH environment variable, which serves a different purpose to classpath. (The classpath defines a list of jars and directories containing compiled Java .class code; the PATH variable defines a list of paths where the shell needs to look and locate programs to execute when they are not found in the current directory — so if you type for instance zip — it would look in all the directories defined in PATH and figure out that zip program is located under /usr/bin)
    Secondly if you want to compile sources from both directory you need to specify:

    • all the paths where the sources are (both home/pathToFolderA/src and home/pathToFolderB/gen-java)
    • the path where the compiled .class files to be generated
    • specify in the classpath any library you might use in your source files

    To sum it up, it would be something like this to compile:

    javac -d /home/pathToFolderWithResultsOfCompilation -classpath /path/to/some.jar:/path/to/another.jar home/pathToFolderA/src/*.java home/pathToFolderB/gen-java/*.java 
    

    and to run your compiled programs:

    java -classpath /path/to/some.jar:/path/to/another.jar:/home/pathToFolderWithResultsOfCompilation full.name.of.your.Java
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lately I have been thinking about developing some basic android app. Its only due
Im trying to append some JSON data from the last.fm API, I have been
I've been working writing fairly small applications and doing some maintenance work for some
I am working on a Java project after a period using C++ and C#,
I want to write a program in Objective-c that grabs some sports stats off
According to maven site , and some tutorials on the web, mvn archetype:generate would
Maybe I'm being misled by my profiler (Netbeans), but I'm seeing some odd behavior,
I'm setting up a glassfish server with a single EJB3 as a mocked up
I've been stuck for ages now trying to implement threading or background image loading
We are facing a problem with lastest JRE 6 update 22 and 23. The

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.