alphacep / alphacep/vosk-api

How to bundle model in to an executable Java JAR file?

Open
#653 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
15.1k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

I can run the code fine from IDE by referencing model folders placed in REOURCES or SRC folder like these.
**try(Model model = new Model("src/model2");
try(Model model = new Model("resources/model1");**

However,I can't seem to make it work once the code is compiled into an executable JAR file. I need the full thing bundled as a single JAR for my use case.

I tried many ways to reference it including following format
**try(Model model = new Model("jar:file:/Users/..../My_App.jar!/model1");**

How can we point to "resources/model1" so it still works when part of jar file? My project looks like this:
Screen Shot 2021-08-04 at 12 41 09 PM

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the Java project layout shown in the issue, especially src/model2 and resources/model1, and compare how Model loads those paths in the IDE versus an executable JAR. Reproduce the packaged-JAR failure and determine what resource path or packaging arrangement makes the bundled model load successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.