Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (754)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Deploying a Java game on Steam  (Read 4667 times)
0 Members and 1 Guest are viewing this topic.
Offline yo252yo

Junior Newbie





« Posted 2017-09-07 15:45:10 »

Hello,
Forgive me for asking, but I fail to find documentation related to my problem.
I'm a hobbyist game developer preparing my first release on Steam. My game has only one dependency: java JRE. Surely there is other games on the platform with such a common dependency. However I do not understand what is the preferred way to handle this dependency as of now:
- It seems that packaging the JRE into my binaries is frowned upon by Oracle and not really a recommended practice.
- It seems that install script will only help me on Windows, not Linux or Mac.
- It seems that any solution that I've found on the web mentioning shared package may be deprecated ?

Would you please advise me on the best way to handle a JRE dependency?
Thanks a lot!
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2017-09-07 16:23:38 »

Embed the whole JRE structure in your game. This is actually what Oracle want you to do. They only take umbrage, in theory, if you change anything in the JRE distribution. (In practice they don't give a crap but don't tempt fate).

Cas Smiley

Offline nsigma
« Reply #2 - Posted 2017-09-07 16:41:47 »

They only take umbrage, in theory, if you change anything in the JRE distribution.

That's changing too. If you read the blog post I linked to in the Oracle OpenJDK thread there's a bit about this, but also a reference to jlink coming in Java 9 that will allow for building custom runtime images of modules.

Right now, if you use OpenJDK anyway (eg. Azul has cross-platform versions) you can pull it apart however you want.

Praxis LIVE - hybrid visual IDE for (live) creative coding
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline yo252yo

Junior Newbie





« Reply #3 - Posted 2017-09-08 11:38:23 »

Thanks a lot to you both! That's very reassuring Smiley
I've found a couple of links around so I should be able to take it from here, but if you'd like to tell me your favorite tool to package a JRE with my app that would be most appreciated Smiley
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2017-09-08 12:10:46 »

I use no special tools as such, I just tar up the entire directory structure, game and all, and gzip.

Cas Smiley

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 120
Projects: 15


★★★★★


« Reply #5 - Posted 2017-09-08 16:42:26 »

Also relevant to this topic in case anyone missed it, Oracle now plans to ship OpenJDK builds (GPL) which will be identical to the Oracle JDK (BCL). See Java: Free At Last.
Offline nsigma
« Reply #6 - Posted 2017-09-08 18:47:40 »

Also relevant to this topic in case anyone missed it, Oracle now plans to ship OpenJDK builds (GPL) which will be identical to the Oracle JDK (BCL). See Java: Free At Last.

That's what the other thread referred to earlier (Oracle OpenJDK, every 6 months) is about.  Lousy title, I know!   Smiley  Still, I find the 6-monthly releases at least as interesting as the license change, but then I never use Oracle's releases anyway - OpenJDK on all 3 OS's here.

Praxis LIVE - hybrid visual IDE for (live) creative coding
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2017-09-08 19:12:36 »

The licensing change is actually hugely significant, because it means chopping up JDKs to make them smaller.
And it means finally a path to PS4 and XB1 if someone can be arsed.

Cas Smiley

Offline nsigma
« Reply #8 - Posted 2017-09-08 20:18:15 »

You have heard of this OpenJDK thing, right?!  Tongue  It's 99% (ish) the same code, and nothing has been stopping you from doing any of those things for years.  Which means there was already a path to PS4 and XB1 with that license, by which I assume no-one could be arsed.  Grin [EDIT - ignoring the mention of an open build and testing infrastructure which is interesting.]

Praxis LIVE - hybrid visual IDE for (live) creative coding
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2017-09-08 22:17:37 »

Yeah, I've been using OpenJDK for years (at least on Mac and Linux, haven't bothered with Windows yet). I think though that the main issue was there not being a credible implementation of the JDK (well, HotSpot) anywhere else without paying Oracle money. So no useful JVM on consoles, Raspberry Pi, etc.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline cygnus
« Reply #10 - Posted 2017-09-10 01:27:51 »

Wait a second, isn't there some Steam feature that allows you to install dependencies? I've seen a game install VC redist tons of times, why not the same with the JRE?
Offline VaTTeRGeR
« Reply #11 - Posted 2017-09-10 08:03:48 »

There's no reason to install anything, the JVM can be put in your game folder and be used from there, as an embedded runtime environment, like it's supposed to.
Why should you f**k around with the users system by installing anything except of your game files into the steamapps folder? This only gets you esoteric bugs and then bad reviews...
Offline cygnus
« Reply #12 - Posted 2017-09-14 18:00:13 »

I see your point. That does seem like a better idea Smiley
Offline ral0r2

Junior Devvie


Medals: 2



« Reply #13 - Posted 2018-04-21 11:15:07 »

I use no special tools as such, I just tar up the entire directory structure, game and all, and gzip.

Cas Smiley

@princec

Sorry for necroposting but I've read a little bit on this topic and just copying my JRE to my project seems to be the easiest way. There are a lot of different tools and I'm not sure if these might be little bit overkill. Could you maybe elaborate a little bit on how you achieved that your games is using it's on JRE? My current unterstanding is somewhat of the following:

1. Copy JRE into my game project folder (e.g. a folder with java8)
2. Zip everything up (Somehow included in my build process)
3. Tell Maven to use the included JRE

What I'm a little bit struggling with right now is how can I tell Maven to use the embedded JRE? Right now to build my game I'm using the maven-assembly-plugin along with the maven-nativedependencies-plugin to resolve native dependencies and the maven-jar-plugin.

I assume that I somehow need to tell maven to unpack that shipped JRE and use it? However is it even possible for Maven to unzip a packed JRE and tell my game to use this without using the JRE itself (Because it might require an unpacked JRE to be able to do so)?

In a few words I'm just not entirely sure how I can optimize my Maven build process to use an embedded JRE. If you could link me to a ressource or give me a hint that would be great!
Online philfrei
« Reply #14 - Posted 2018-04-22 02:44:09 »

What about working with the Java 9 Deployment Guide?

I just worked through an article on Modules, which is kind of important to know something about, to make this path work. Also was able to make a JLink example work. Am hoping to give this a try in the next week or so.

It is kind of a pain in that a lot seems to be done at the command line level, and the file structure needed for Modules makes Eclipse Oxygen see red. But it also seems to be what Oracle is suggesting as the way to go for distribution of a Java program as an .exe. The resulting Modular JRE included in the self-contained deployment is supposed to be smaller and faster.

music and music apps: http://adonax.com
Online Spasi
« Reply #15 - Posted 2018-04-22 10:16:11 »

We started using jlink'ed images in production a few months before Java 9 was released, they're convenient and work great. One problem is that all dependencies must be modular. Having an Automatic-Module-Name in the manifest is not enough, all JAR files must include a module-info.class with appropriate declarations.

A relatively easy solution to this is the ModiTect plugin for Maven. It injects module-info.class in your non-modular JAR files automatically, but the module descriptors must be written by hand. It can become annoying if dependencies use reflection a lot, but it's usually straightforward.
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #16 - Posted 2018-04-22 11:48:30 »

I've never looked at Maven nor gradle. Ant works for me.

Cas Smiley

Offline ral0r2

Junior Devvie


Medals: 2



« Reply #17 - Posted 2018-04-22 13:35:29 »

We started using jlink'ed images in production a few months before Java 9 was released, they're convenient and work great. One problem is that all dependencies must be modular. Having an Automatic-Module-Name in the manifest is not enough, all JAR files must include a module-info.class with appropriate declarations.

A relatively easy solution to this is the ModiTect plugin for Maven. It injects module-info.class in your non-modular JAR files automatically, but the module descriptors must be written by hand. It can become annoying if dependencies use reflection a lot, but it's usually straightforward.

Thanks for the responses guys. Ill check this out. This actually sounds quite interesting since right now I'm using Java 8 and not 9, eventhough it might be worthy upgrading.

Unfortunately all of this sounds a bit tricky I hoped that it might be a little bit easier Cheesy
Offline princec

« JGO Spiffy Duke »


Medals: 1030
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #18 - Posted 2018-04-22 14:15:37 »

Indeed, don't make life hard for yourself. Just deploy the entire embedded JRE you want, and use jsmooth to create a launcher for it.
On the Mac it's just a zip of a .app folder with a shellscript to launch and a .plist file explaining to the system how the app is configured.
On Linux it's just a tar.gz and a shellscript to launch.

All three methods just involve an entire JRE - the lib and bin folders specifically - and your game stuff at the root. There's really nothing to it. Use Ant to automate it if you want but there's not even really a need to do that.

Cas Smiley

Online philfrei
« Reply #19 - Posted 2018-04-22 17:23:45 »

I couldn't figure JSmooth out. Gave up and decided to give the Java 9/JLink path a go.

Migrating to Java 9 was easy. I don't have any external jars, just Java, with Swing front end on this one.

If I can't get the deployment to work, maybe I'll go back to trying JSmooth again, but I'll be asking a lot of questions here! I don't seem to have some of the background knowledge needed to make it work.

music and music apps: http://adonax.com
Offline ral0r2

Junior Devvie


Medals: 2



« Reply #20 - Posted 2018-04-23 10:12:05 »

Indeed, don't make life hard for yourself. Just deploy the entire embedded JRE you want, and use jsmooth to create a launcher for it.
On the Mac it's just a zip of a .app folder with a shellscript to launch and a .plist file explaining to the system how the app is configured.
On Linux it's just a tar.gz and a shellscript to launch.

All three methods just involve an entire JRE - the lib and bin folders specifically - and your game stuff at the root. There's really nothing to it. Use Ant to automate it if you want but there's not even really a need to do that.

Cas Smiley

Gonna check out jsmooth. I also found out that oracle has a maven dependency for a jre (might be interesting for the ppl who use maven):

1  
2  
3  
4  
5  
<dependency>
  <groupId>com.oracle.java</groupId>
  <artifactId>jre</artifactId>
  <version>1.8.0_131</version>
</dependency>


However it is not supported anymore as far as I know. So there a serveral options right now:

  • jlink (if needed with ModiTect plugin)
  • launch4j
  • jsmooth

Guess I'll play a little bit around with all of them and see how it goes. Thanks again guys Smiley
Pages: [1]
  ignore  |  Print  
 
 

 
DesertCoockie (33 views)
2018-05-13 18:23:11

nelsongames (75 views)
2018-04-24 18:15:36

nelsongames (70 views)
2018-04-24 18:14:32

ivj94 (752 views)
2018-03-24 14:47:39

ivj94 (82 views)
2018-03-24 14:46:31

ivj94 (622 views)
2018-03-24 14:43:53

Solater (98 views)
2018-03-17 05:04:08

nelsongames (179 views)
2018-03-05 17:56:34

Gornova (405 views)
2018-03-02 22:15:33

buddyBro (1065 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!