본문 바로가기

Program/Java

Compile recursively with javac


To my shame I have never used javac directly for compiling source files, always it was something like "ant". And today it was the first time on my memory when I had to do that :) It was a simple application, just an example for presentation and I didn't want to add anything additional there.
Thing which looks like a trivial task appeared to be not so trivial, because javac doesn't recursively compile files in directories, you have to specify each directory separately or create file with list of files for compilation, something like that:

find ./src -name "*.java" > sources_list.txt
javac -classpath "${CLASSPATH}" @sources_list.txt


On Windows first line should be replaced with: dir .\src\*.java /s /B > sources_list.txt

'Program > Java' 카테고리의 다른 글

Eclipse Properites Editor  (0) 2012.01.05
Eclipse - .svn delete  (1) 2012.01.03
JAVA Eclipse GUI ToolKit  (5) 2011.07.15
Ant MANIFEST.MF Class-Path  (2) 2011.01.10
JAVA Version!!  (1) 2010.08.02