-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d5b8ac
commit bc3da82
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM stepik/epicbox-base:stretch | ||
MAINTAINER Pavel Sviderski <[email protected]> | ||
|
||
ENV JAVA_INSTALLER_VERSION 9.0.1-1~webupd8~0 | ||
|
||
# Add Oracle Java 9 (JDK9) repository | ||
RUN apt-get update && apt-get install -y --no-install-recommends gnupg1 \ | ||
&& apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 \ | ||
&& apt-get purge -y --auto-remove gnupg1 \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list \ | ||
&& echo oracle-java9-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
oracle-java9-installer=${JAVA_INSTALLER_VERSION} \ | ||
&& rm -rf /var/lib/apt/lists/* /var/cache/oracle-jdk9-installer | ||
|
||
COPY java_lookup_main.sh /usr/local/bin/java_lookup_main.sh | ||
RUN chmod +x /usr/local/bin/java_lookup_main.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
# Grep *.class files in the given directory to find one with psvm method defined | ||
# Usage: java_lookup_main.sh DIRECTORY_PATH | ||
|
||
PSVM_REGEX="public static( final)? void main\(java\.lang\.String(\[\]|\.\.\.)\)" | ||
|
||
shopt -s nullglob | ||
for f in "$1"/*.class; do | ||
if javap -p "$f" 2> /dev/null | grep -Pq "$PSVM_REGEX"; then | ||
filename=$(basename "$f") | ||
echo -n "${filename%.*}" | ||
exit 0 | ||
fi | ||
done | ||
exit 1 |