Javac command line options

Hi team ,

I have a folder called as src in E:\ drive . In this folder Iam storing the all the .java files.  Iam trying to compile using the below options

I have an Employee.java file  under a package com.businessobjects. I have issued the below comamnd to compile and create the .class file in the folder as per the package structure
Initially , I placed the .java file in E drive itself

e:\javac -d . Employee.java.

The folder structure as per package got created and the class file was placed in the E:\com\businessobjects.

After this step I decided to keep all the source files in E:\Src folder and then modified and java file and issued the below command

javac -sourcepath e:\src -d e:\src\ Employee.java --> the .class file is not getting updated with the current version

The class file timestamp did not change . Again I tried to issue the below command

javac -sourcepath e:\src -d . Employee.java

Now the .class file timestamp changed in e:\com\businessobjects folder .

First Question:

I want to know what happened when I gave -d with . and why it did not change the class file when I gave -d e:\src\.

Second Question:

I want to what is the use of -s option of Javac command ,

I tried to compile the code and store the source files in e:\src folder , but  got an error related to syntax

Employee.java file is in E:\

e:\javac -s src\ Employee.java
Employee.java
sam_2012Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kanti PrasadCommented:
Hi

I am not sure if there is an s option but if you don't specify any -d options, the class files will be put into directories according to the package structure, relative to the current directory. If you give an -d option, the class files will be put relative to the directory given by the option. Non-existing directories will be created here.

Here is a link that will give you all the options

http://www.dummies.com/how-to/content/how-to-use-the-javac-command.html
sam_2012Author Commented:
Hi ,
Uploading the screen shot which shows the -s option
CommandPrompt.png
Kanti PrasadCommented:
hi

If you question is why to use - d and - s then
          -d  is directory option to specify where the compiler should puts the generated .class file.
               For example:    javac -d classesdirName Employee.java  -- means it will place in that dir.
                                       javac -d . Employee.java   -- means it will place in the root dir as you mentioned .(dot)
          -s will  specifies where to place generated  source files
              For example:    javac -s classesdirName Employee.java   -- means it will place in that dir.
                                         javac -s . Employee.java   -- means it will place in the root dir as you mentioned .(dot)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sam_2012Author Commented:
Can we use -s option with -d ?
Kanti PrasadCommented:
Hi

I am not too sure, but you can try it

javac -d . -s .  Employee.java

or

javac -d  -s .  Employee.java
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.