aspose file tools*
The moose likes Servlets and the fly likes what syntax to compile java clases in subdirectory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "what syntax to compile java clases in subdirectory" Watch "what syntax to compile java clases in subdirectory" New topic
Author

what syntax to compile java clases in subdirectory

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hi
What sytax do you use to compile a tree of directory in java?.
Example root/subroot1/subsubroot1/
if I am in root how do I write the sytax that will compile all .java files in all of those directories. javac *.java /.java does not work.
Thanks
Shloime
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Please note that The Java Ranch has a naming policy, described here and "orshulim" is not a valid name. Please choose one which meets the requirements.
Thanks.

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Where do I change my name?
Thanks
Shloime
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Unfortunately, this forum s/w doen't have this feature. We have to re-register as new member. Thank you.
javac *.java will compile all .java files in current dir. I have used many times. Simillarly, if current dir is c:\test and there is a sub dir under test like c:\test\subTest we can compile all .java files under subTest dir from test dir like this.
c:\test\javac subTest\*.java
This will compile all *.java files under subTest and put all *.class files under subTest.
May be I don't get your question properly.
regds
maha anna

[This message has been edited by maha anna (edited December 14, 2000).]
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
To shorten or simplify the javac command, you may specify one or more files that themselves contain one filename per line. On the command line, use the '@' character with the filename to specify it as a file list. When javac encounters an argument beginning with the character `@', it operates on the filenames in that file as if they had been on the command line. This enables you to overcome the command-line length limitation of Windows.
For example, you can list all of the source file names in a file named sourcefiles. This file might look like:
MyClass1.java
MyClass2.java
MyClass3.java
You could then run the compiler with:
C:> javac @sourcefiles
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks foe all of you.
My question is how can I compile all java files in root directory also in sub directory and in sub\sub directory. all together using a wild card.
javac *.java does only all files in this directory. but if I have 5 directory from root directory and each of the 5 have 3 directory. Ho do I command JAVAC to do recursive compiling.
I have a src.zip file that has a many directory files system how do I command javac to do this in one shot.
Thanks
Shloime
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
"orshulim", please choose another name, that one will soon be switched off and you will no longer be able to log in to Java Ranch unsing it.
Thanks.
Bhupinder Dhillon
Ranch Hand

Joined: Oct 12, 2000
Posts: 124
There isn't a way to compile the whole packages. However, there is a work around - at least on windows.
Go to the top level package and type this in command prompt:
dir /b /s *.java >> files.txt
Then type: javac @files.txt
This will compile all the files, in all the sub-directories.
For example if your classes are in a folder called c:\classes
c:\>cd c:\classes
c:\classes>javac @files.txt
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks it worked.
Why when I try to compile
javac @src.zip
which has all the files it refuses to do so?
Thanks
Shloime
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what syntax to compile java clases in subdirectory
 
Similar Threads
Java Round-Up game
previous & Last
can i compile java from java code?
Problem with ArrayList not being recognized
Java Code puzzle