aspose file tools*
The moose likes Beginning Java and the fly likes How to compile all the java classes which are inside one package? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to compile all the java classes which are inside one package?" Watch "How to compile all the java classes which are inside one package?" New topic
Author

How to compile all the java classes which are inside one package?

Chandrashekhar Kotekar
Greenhorn

Joined: Aug 17, 2009
Posts: 14
0 down vote favorite


Hi,

I am new to Java world. I have few classes which are inside nested folders (namespace).

My namespace has following folder structure (Assume that companyName folder is on C:\ ):



My problem is, I want to compile all of these classes from command prompt.

I tried the following command but its not working :



but its not working. I am getting following error :



Please help to compile all of these classes and possibly to create jar out of it.
Wim Vanni
Ranch Hand

Joined: Apr 06, 2011
Posts: 96

I would recommend the use of an IDE like Netbeans of Eclipse that will help you accomplish those tasks very easily. Other than that you could look into scripting this yourself (compile.bat file or something similar) or even better, making use of ant.

Cheers,
Wim
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Chandrashekhar Kotekar wrote:0 down vote favorite


Chandrashekhar, please BeForthrightWhenCrossPostingToOtherSites
http://stackoverflow.com/questions/5962776/how-to-compile-java-classes-which-are-inside-multiple-folders


luck, db
There are no new questions, but there may be new answers.
Tapan Maru
Ranch Hand

Joined: May 08, 2006
Posts: 65
If you are using a windows platform, you can create a batch file and write the order in which class needs to be compiled.
If you are using linux platform you can write a shell script.

OR alternatively,

use IDE (e.g. Eclipse, Netbeans...)


Tapan Maru
tapanmaru@gmail.com
Jared Malcolm
Ranch Hand

Joined: May 02, 2011
Posts: 54

From Oracle

FILE LIST

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



To me if you aren't willing to use an IDE then this seems like the best option.......list your files in one place and then just run command once (if i understand this correctly).


SCJA 6 (Studying for SCJP 6)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to compile all the java classes which are inside one package?
 
Similar Threads
Environment Variables
ANT Out of Memmory problem
Unable to import a my package.
Automated Regression Testing suite
Unable to complie