I've been using LWJGL for a couple of years now. I'm fairly comfortable with it. I've gotten to the deployment stage with one of my projects. So far I've experimented with packaging it as a zip file and letting people extract it and run the executable jar manually, that's a bit messy. I used JarSplice to create a single cross platform executable jar, that was less messy; but cramming 100mb of game files into a single jar and having people re-download the whole thing every time there's an update is not appealing to me.

I'm looking for suggestions on how to get started with creating a Minecraft style launcher application. I want to:

Embed a twitter feed

Check for newer versions and update changed files

Use the "home" directory of the user, %appdata% on windows, the actual home directory on Linux variants

Provide some click-able links in a sidebar

I'm confident that I can learn how to provide all of the features described on my own; but I don't know where to start. Should I be using C++, Java, C#, Mono or something else? How do I create a cross platform native application? I'm a game developer; I don't know the first thing about regular applications. What is my best option to create something like this?

Hey hey thats awesome! Spent this morning learning the ins and outs of swing. Rigged this functional prototype up. Loads a html page from an external server and the launch button actually launches the game (and closes the launcher).

Are you coding in Netbeans? The nice people of the JavaFX community have created Native packaging support using Ant commands that work with 3 free installers, one for MAC, Win, and Linux. I currently got it working with the Windows installer Inno Setup 5. It works great and by default it installs in AppData. I imagine you can either get Inno Setup 5 yourself and give it a shot, you write the Inno Setup 5 script and compile. Also I can send you the Inno Setup 5 script that the JavaFX Ant script creates. Also, the Ant script bundles your JRE with your package. It might take a little bit of work to figure it out but the results are great. I get to use which ever JRE I want.

Hey, its not so much an installer, as it is a launcher. It will act as an installer, but any time the user wants to run they game, they'll do it via the launcher. This will feed them any news related to the game, and automatically download any updates to the game before allowing them to launch it directly.

I use IntelliJ IDEA, but I'll look into that jmart. Thanks! :-)

gouessej, I agree that packaging the whole game in a jar file is a bad idea. Which is why I'm opting for the launcher in the fist place.

Hey, its not so much an installer, as it is a launcher. It will act as an installer, but any time the user wants to run they game, they'll do it via the launcher. This will feed them any news related to the game, and automatically download any updates to the game before allowing them to launch it directly.

I use IntelliJ IDEA, but I'll look into that jmart. Thanks! :-)

gouessej, I agree that packaging the whole game in a jar file is a bad idea. Which is why I'm opting for the launcher in the fist place.

I believe that Minecraft's launcher uses HTML The Minecraft homepage his a twitter feed on it which means you could use HTML to display the twitter feed, however I think it uses javascript as well (this might help with that). So they just put everything into an HTML file and have it embedded in the launcher. Of course this isn't the only way to do it. You could have a separate embedded HTML page for the twitter feed, you could use Twitter's Search API to search for and list the tweets from a certain twitter account, or (it looks like) you could use the Public streams part of Twitter's Streaming API to do it as well.

I'm having a bit of an issue with these swing controls. So far all the functionality I want is there, almost effortlessly. But I can't seem to get rid of this white border. The components in question are a JEditorPane embedded in a JScrollPane, embedded in a JFrame.

Yeah ZMan, I understand that. They use a tumblr blog with a super minimal theme. I've just set up a similar system today. The launcher now pulls a tumblr blog with a custom html-only theme I've made. (tumblr throws a random quantserv script in though - weird). At this point I'm looking at writing a program that'll run locally and pull all the data I want from various sources manually, then write them to a html file.

I'm having a bit of an issue with these swing controls. So far all the functionality I want is there, almost effortlessly. But I can't seem to get rid of this white border. The components in question are a JEditorPane embedded in a JScrollPane, embedded in a JFrame.

...snip...

Any Swing guru's know how to squelch the white border?

Try calling setBorder(new EmptyBorder(0,0,0,0)) on your JScrollPane.EDIT: I think you may have to call setBorder(new EmptyBorder(0,0,0,0)) on the JFrame as well.

Yeah ZMan, I understand that. They use a tumblr blog with a super minimal theme. I've just set up a similar system today. The launcher now pulls a tumblr blog with a custom html-only theme I've made. (tumblr throws a random quantserv script in though - weird). At this point I'm looking at writing a program that'll run locally and pull all the data I want from various sources manually, then write them to a html file.

I edited my post to expand to other possibilities of getting the info from Twitter. I haven't tried any myself but it looks like you could hack together something that way.

You're not meant to hardcode positions and stuff, but I want to lock this to a specific size/location. There's also probably some redundant calls to stuff because I'm learning swing for the first time - so I'm testing different functionality

For updating, it's not that hard to implement your own updater. Just have it test against a version file on the server for each file, with the launcher downloading the new version of each file. It's not that hard if you know how to properly use the java.net and java.io packages.

For updating, it's not that hard to implement your own updater. Just have it test against a version file on the server for each file, with the launcher downloading the new version of each file. It's not that hard if you know how to properly use the java.net and java.io packages.

Thanks for the input. :-)

Thats exactly what I have planned to do. (Spent a few hours in bed last night reading up on exactly those; java.net and java.io packages). The challenges that I'm going to face next though; detecting the OS group, and based on the result I want to put the downloaded files in specific directories. I'm thinking %appdata% works for Minecraft on windows, so it may as well work for me too. I'm thinking along the lines of a .hidden directory in the user's home folder on linux, and I have no idea how mac's work - never used one. So I have no idea what directory is appropriate with those.

I'm not sure yet on how to detect the OS, but if I can't do it in code, then I suppose I'll just have to have three different launchers. It would be silly to download the windows natives onto a linux box, and vice versa.

EDIT:So I've found System.getProperty("os.name"); To be used like this:

Will return true if the OS is windows. Cascading if-statements with "win" switched out for "nux", "nix", "mac" or "sunos" will detect which of the popular OSes we're using.

So now I'm back to choosing an appropriate directory for game files for each OS.

EDIT 2:I've been a minecraft player for a couple of years now - its what made me switch from XNA/C# to LWJGL/Java. I don't know if there is a specific reason of benefit of using appdata or the application support folders. But my research just now suggests that the user.home property is available on all OSes, and doesn't require administrator rights to write to. Sounds almost ideal, unless there's a reason not to? Just out of curiosity, can someone on linux and or mac give me the output of:

1

System.out.println("user.home: " + System.getProperty("user.home"));

Output (for me):

1

user.home: C:\Users\Scott

If there are no real caveats, I'm thinking of using this as my universal game-data directory:

EDIT: Apparently "Application Data" also works on Vista and 7 for backwards compatibility purposes.

Thanks again Ra4king. Everything I've been reading has been saying that you require administrator rights to write to appdata on windows. I haven't experienced this issue myself because I have UAC disabled completely. But if 90% of people playing my game will be children without admin rights on their parents' PC; and as a result they cant play the game; then I want to avoid appdata at all costs.

The idea that admin rights are required only came from a couple of stackexchange answers. So I'm not sure about the authenticity of the claim. ;-)

At this point I think I'll roll with the appdata directories like in your code anyway; if its good enough for Ra4king and Minecraft, then its good enough for me. :-)

user.home on Linux returns "/home/<username>/". On Linux, all folders that start with '.' are automatically hidden. On Windows they are not, and this leads to cluttering of the home directory. It is best to put it in Application Data because then it's in its proper place in Windows and out of sight.

EDIT: In no way does AppData need administrative privileges. I have UAC enabled and new File(System.getProperty("user.home") + "/Application Data/My Test Folder/").mkdir() successfully creates the folder: "C:\Users\<username>\AppData\Roaming\My Test Folder\"

EDIT: UAC in Windows 7 is actually quite good now. It only prompts me for system-wide changes, like installations. It's now a good second line of defense against viruses, with your AV being the first. I recommend you turn it on

user.home on Linux returns "/home/<username/". On Linux, all folders that start with '.' are automatically hidden. On Windows they are not, and this leads to cluttering of the home directory. It is best to put it in Application Data because then it's in its proper place in Windows and out of sight.

EDIT: In no way does AppData need administrative privileges. I have UAC enabled and new File(System.getProperty("user.home") + "/Application Data/My Test Folder/").mkdir() successfully creates the folder: "C:\Users\<username>\AppData\Roaming\My Test Folder\"

EDIT: UAC in Windows 7 is actually quite good now. It only prompts me for system-wide changes, like installations. It's now a good second line of defense against viruses, with your AV being the first. I recommend you turn it on

Awesome. That's really good to hear. That should be all the information I need to make this launcher work now. :-) Thanks for everything today and yesterday Ra4king.

I know that similar ideas come up very often around here , but what about uploading that launcher right now to github and creat some nice launcher together. A game launcher with update functionality is something which is useful for everybody.With git everybody can branch and merge stuff together as he likes, so we would end up with perhaps some a bit different launchers, but I think this would be quite great for everybody.

I know that similar ideas come up very often around here , but what about uploading that launcher right now to github and creat some nice launcher together. A game launcher with update functionality is something which is useful for everybody.With git everybody can branch and merge stuff together as he likes, so we would end up with perhaps some a bit different launchers, but I think this would be quite great for everybody.

I would also invest some hours into this.

Java Web Start, IzPack and GetDown are often enough... Anyway, good luck.

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