-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.py
More file actions
27 lines (24 loc) · 861 Bytes
/
Copy pathcompile.py
File metadata and controls
27 lines (24 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os;
from util import *
def complier() :
javacCommand = "javac -sourcepath ./src/ %s -d .\\bin"
for parent,dirnames,filenames in os.walk('./'):
for filename in filenames:
if isJava(filename):
inPath = os.path.join(parent,filename)
try:
os.system(javacCommand % inPath)
except Exception, e:
sys.exit()
def run() :
output = os.popen('findstr /s /M /C:"public static void main" .\*.java')
mainPath = output.read()
mainClass = formatMain(mainPath)
output = os.popen('findstr "package" %s' % mainPath)
package = output.read();
if len(package) != 0:
mainClass = formatPackage(package) + '.' + mainClass
os.system("java -classpath ./bin %s" % mainClass)
if __name__ == '__main__':
complier()
run()