Does there exist a tool for combining java files -
i joining competition requires me put java classes in 1 single .java file. there exist tool me (including changing visibility of classes able this)?
addition: trying me read site of competition quote:
it possible make more 1 class program, have put source classes in single .java file (the compiler produce multiple .class files anyway). when this, should not declare classes public, or compiler complain it.
so, 1 .java file allowed (no jar) , in file can have multiple non-public classes besides public main class (and not static inner classes suggested).
if have access unix-y shell (for windows, can install e.g. git decent bash implementation, and gives great vc tool):
cat *.java | sed 's/public class/class/g' >alltehcodez.java
doesn't have more complicated (unless have lot of strings containing substring "public class", of course).
edit: doesn't work package , imports. but...
( egrep -h ^package *.java | head -1 egrep -h ^import *.java | sort -u egrep -hv '^(import|package)' *.java | sed 's/public class/class/g' ) >alltehcodez.java
this of course assume classes in same package.
Comments
Post a Comment