Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Executing jar without system java (JRE) on linux

オープン
#741 コメント 14 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
bash, java, shell

調査の方向性

まず、issue に記載されている bash launcher と linuxJdk/bin のレイアウトを確認し、Cube Chaos.jar がどのように呼び出されるかも確認します。Linux 上で Steam の起動とアセットパスの動作を再現し、そのうえで、ゲームのアセットパスを維持し、予期しない Steam の動作を説明できるバンドル Java での起動を完了条件として定義します。

索引モデルが issue の本文から書いたものです。

説明

This issue is about a public attempt of transitioning my game on linux to have a bundled java version since systems java is no longer accessable.
Its public to possibly help people at steam to provide better assistance, it may also be usefull as an example. This is mostly due to @TTimo offering/asking about this.

Previous method:
There was a .sh (bash) file
-this bash file checked the systems java version via:
version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '{sub("^$", "0", $2); print $1$2}')
-this translated the version into a 2 digit number to then compare it and check if the java version is high enough
-the jar file is then executed via:
java -jar Cube\ Chaos.jar "$@" (the "$@" apparently
-this is a simple jar file produced by a Java IDE (in my case Eclipse) which is the game itself

This is no longer functional because steam launches the bash file without access to the systems java.

Disclaimer:
I have close to no experience with bash scripts, most of this is snippeted together.
Also I am releasing an update on the first of the next month so I may be a little slow to respond or do work on this.
I can only test on linux very slowly due to the virual machine beeing very slow and finicky, as such I have asked one of the people of the community for help, though this is obviouly still messy.

Attempt:
-This whole attempt is on a seperate devtest branch to make sure normal use is not impacted
-I have downloaded the newest linux openjdk jdk (oracle is not free to distribute) and added it to the folder which is the package
-I have modified the bash to be:

#!/bin/bash

cd ./linuxJdk/bin

java -jar ../../Cube\ Chaos.jar

read

-the read command is just there to keep the terminal open for the purpose of testing
-I have attempted it without the cd going into the java bin subfolder but without that the java command does not work, even if changed to /linuxJdk/bin/java -jar Cube\ Chaos.jar to include the path there.
-This does launch the file in some way however this approach has 2 problems so far:
--Presumably due to beeing opened from a different path the game cannot find its own assets, I have no idea how to possibly be in the java path as well as in the main game path, but likely am just missing some bash knowledge. Could also be some other problem who knows.
--For some reason when the bash is executed manually steam automaticly tries to launch as well and adds its log to the bash terminal, this is quite perplexing considering the previous bash file did not do this. I am currently using https://github.com/code-disaster/steamworks4j to connect to steam with the game for stuff like friends list info and achievements, however this shouldent launch steam nor has it in the past. Additionally the game is made to work fine even without steam. This is not strictly required to fix but would make the game more susceptible to future problems.

Questions:
-Is there a common way to launch jar games via steam which doesnt require this messy bash workaround?
-Any ideas on how to resolve the bash folder issue?
-Any idea why manually executing the bash also launches steam?

主要言語
Shell
スター
1.5k
フォーク
98
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ValveSoftware/steam-runtime のほかの issue

ValveSoftware/steam-runtime の issue をすべて見る

似ている issue

Shell/Bash の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。