Skip to content

Commit 335ca67

Browse files
authored
Merge pull request #4 from NmurtasDev/feature/windows-exe
start creation windows exe file
2 parents 4e34bd6 + 3de7026 commit 335ca67

4 files changed

Lines changed: 97 additions & 18 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Thumbs.db
3838

3939
# Application specific
4040
android_emulator_config.properties
41+
jre/
4142
*.log
4243

4344
# Java

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Android Emulator Manager
22

3+
[![Java CI with Maven](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/maven.yml/badge.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/maven.yml)
4+
[![CodeQL](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/codeql.yml/badge.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager/actions/workflows/codeql.yml)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
[![Java Version](https://img.shields.io/badge/Java-21-blue.svg)](https://www.oracle.com/java/technologies/javase/jdk21-archive-downloads.html)
7+
[![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager)
8+
[![Version](https://img.shields.io/badge/version-3.0.0--SNAPSHOT-orange.svg)](https://github.com/NmurtasDev/AndroidEmulatorManager/releases)
9+
310
A modern **Java-based GUI tool** to download, install, and manage Android SDK and emulators.
411

512
## Features
@@ -35,6 +42,21 @@ cd AndroidEmulatorManager
3542
mvn clean package
3643
java -jar target/android-emulator-manager-3.0.0-jar-with-dependencies.jar
3744
```
45+
### Build with EXE output (require java)
46+
47+
```bash
48+
git clone https://github.com/NmurtasDev/AndroidEmulatorManager.git
49+
cd AndroidEmulatorManager
50+
mvn clean package -Pwindows
51+
```
52+
### Build with EXE output (dont require java)
53+
54+
```bash
55+
git clone https://github.com/NmurtasDev/AndroidEmulatorManager.git
56+
cd AndroidEmulatorManager
57+
jlink --output jre --add-modules java.base,java.desktop --strip-debug --compress=2 --no-header-files --no-man-pages
58+
mvn clean package -Pwindows-standalone
59+
```
3860

3961
## Usage
4062

pom.xml

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
55
http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
67
<modelVersion>4.0.0</modelVersion>
78

89
<groupId>net.nicolamurtas</groupId>
@@ -38,6 +39,10 @@
3839
<junit.version>5.10.1</junit.version>
3940
<slf4j.version>2.0.9</slf4j.version>
4041
<logback.version>1.5.19</logback.version>
42+
43+
<!-- Launch4j default properties -->
44+
<bundled.jre.path></bundled.jre.path>
45+
<exe.suffix></exe.suffix>
4146
</properties>
4247

4348
<dependencies>
@@ -65,6 +70,7 @@
6570

6671
<build>
6772
<plugins>
73+
6874
<!-- Maven Compiler Plugin -->
6975
<plugin>
7076
<groupId>org.apache.maven.plugins</groupId>
@@ -77,29 +83,14 @@
7783
</configuration>
7884
</plugin>
7985

80-
<!-- Maven Surefire Plugin for tests -->
86+
<!-- Maven Surefire Plugin -->
8187
<plugin>
8288
<groupId>org.apache.maven.plugins</groupId>
8389
<artifactId>maven-surefire-plugin</artifactId>
8490
<version>3.2.2</version>
8591
</plugin>
8692

87-
<!-- Maven Jar Plugin with Main-Class -->
88-
<plugin>
89-
<groupId>org.apache.maven.plugins</groupId>
90-
<artifactId>maven-jar-plugin</artifactId>
91-
<version>3.3.0</version>
92-
<configuration>
93-
<archive>
94-
<manifest>
95-
<mainClass>net.nicolamurtas.android.emulator.AndroidEmulatorManager</mainClass>
96-
<addClasspath>true</addClasspath>
97-
</manifest>
98-
</archive>
99-
</configuration>
100-
</plugin>
101-
102-
<!-- Maven Assembly Plugin for fat JAR -->
93+
<!-- Fat JAR con dipendenze -->
10394
<plugin>
10495
<groupId>org.apache.maven.plugins</groupId>
10596
<artifactId>maven-assembly-plugin</artifactId>
@@ -124,6 +115,70 @@
124115
</execution>
125116
</executions>
126117
</plugin>
118+
119+
<!-- Launch4j Plugin per EXE -->
120+
<plugin>
121+
<groupId>com.akathist.maven.plugins.launch4j</groupId>
122+
<artifactId>launch4j-maven-plugin</artifactId>
123+
<version>2.5.1</version>
124+
<executions>
125+
<execution>
126+
<id>launch4j-exe</id>
127+
<phase>package</phase>
128+
<goals>
129+
<goal>launch4j</goal>
130+
</goals>
131+
<configuration>
132+
<headerType>gui</headerType>
133+
<outfile>${project.build.directory}/${project.artifactId}-${project.version}${exe.suffix}.exe</outfile>
134+
<jar>${project.build.directory}/${project.artifactId}-${project.version}-jar-with-dependencies.jar</jar>
135+
<errTitle>Android Emulator Manager</errTitle>
136+
<classPath>
137+
<mainClass>net.nicolamurtas.android.emulator.AndroidEmulatorManager</mainClass>
138+
</classPath>
139+
<jre>
140+
<path>${bundled.jre.path}</path>
141+
<minVersion>21</minVersion>
142+
<requires64Bit>true</requires64Bit>
143+
<bundledJre64Bit>true</bundledJre64Bit>
144+
</jre>
145+
<versionInfo>
146+
<fileVersion>3.0.0.0</fileVersion>
147+
<txtFileVersion>3.0.0-SNAPSHOT</txtFileVersion>
148+
<fileDescription>Android Emulator Manager</fileDescription>
149+
<copyright>MIT License - Nicola Murtas</copyright>
150+
<productVersion>3.0.0.0</productVersion>
151+
<txtProductVersion>3.0.0-SNAPSHOT</txtProductVersion>
152+
<productName>Android Emulator Manager</productName>
153+
<internalName>android-emulator-manager</internalName>
154+
<originalFilename>android-emulator-manager.exe</originalFilename>
155+
</versionInfo>
156+
</configuration>
157+
</execution>
158+
</executions>
159+
</plugin>
127160
</plugins>
128161
</build>
162+
163+
<!-- Profili per EXE -->
164+
<profiles>
165+
<!-- Richiede JRE di sistema -->
166+
<profile>
167+
<id>windows</id>
168+
<properties>
169+
<bundled.jre.path></bundled.jre.path>
170+
<exe.suffix></exe.suffix>
171+
</properties>
172+
</profile>
173+
174+
<!-- Include una JRE locale -->
175+
<profile>
176+
<id>windows-standalone</id>
177+
<properties>
178+
<bundled.jre.path>jre</bundled.jre.path>
179+
<exe.suffix>-standalone</exe.suffix>
180+
</properties>
181+
</profile>
182+
</profiles>
183+
129184
</project>

src/main/java/net/nicolamurtas/android/emulator/service/SdkDownloadService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.slf4j.LoggerFactory;
77

88
import java.io.*;
9+
import java.net.URI;
910
import java.net.URL;
1011
import java.nio.file.Files;
1112
import java.nio.file.Path;
@@ -126,7 +127,7 @@ public void downloadAndInstallSdk(Path sdkPath, List<String> components, BiConsu
126127
*/
127128
private void downloadFile(String urlString, Path outputPath,
128129
BiConsumer<Integer, String> progressCallback) throws IOException {
129-
URL url = new URL(urlString);
130+
URL url = URI.create(urlString).toURL();
130131

131132
try (InputStream in = url.openStream();
132133
FileOutputStream out = new FileOutputStream(outputPath.toFile())) {

0 commit comments

Comments
 (0)