Last active
December 24, 2019 04:35
-
-
Save hubertgrzeskowiak/8802720 to your computer and use it in GitHub Desktop.
This small script converts a .classpath file as Eclipse IDE creates it into a colon-separated CLASSPATH line which you can use as command line parameter to Java or as environment variable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
""" | |
This small script converts a .classpath file as Eclipse IDE creates it into a colon-separated | |
CLASSPATH line which you can use as command line parameter to Java or as environment variable. | |
""" | |
import sys | |
from bs4 import BeautifulSoup as bs | |
if len(sys.argv) != 2: | |
print "Please provide path to .classpath as parameter" | |
sys.exit(1) | |
cpfile = open(sys.argv[1]).read() | |
soup = bs(cpfile) | |
entries = [] | |
for entry in soup.find_all("classpathentry"): | |
entries.append(entry.attrs["path"]) | |
if "output" in entry.attrs: | |
entries.append(entry.attrs["output"]) | |
print ":".join(entries) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment