Coder Social home page Coder Social logo

flowarg / openlauncherlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from litarvan/openlauncherlib

17.0 2.0 5.0 660 KB

A simple modern java launching library with minecraft support (UPDATED)

License: GNU General Public License v3.0

Java 100.00%

openlauncherlib's Introduction

version

OpenLauncherLib

Add OpenLauncherLib in your dependencies :

repositories {
    mavenCentral()
}
dependencies {
    implementation 'fr.flowarg:openlauncherlib:VERSION'
}

External Java Launching

You can launch a Java program using the external system. It launches directly the java program, to run a simple runnable jar with its librairies.

ClasspathConstructor constructor = new ClasspathConstructor();
constructor.add(new File("mymainjar.jar"));
constructor.add(Explorer.dir("libs").files());

ExternalLaunchProfile profile = new ExternalLaunchProfile("fr.theshark34.MyClass", classpath.make());
ExternalLauncher launcher = new ExternalLauncher(profile);

Process p = launcher.launch(); // throws LaunchException

This will launch a java process with in classpath: mymainjar.jar and all the files of the libs folder. You can also add program/vm parameters, and a LaunchingEvent to customize the ProcessBuilder just before launching.

Tools

There are a lot of tools that can be used before or after the program launching.

The Single Saver

The Saver uses Java Properties to save or load some data. It is useful if your launch has authentication by exemple to save the user name, or things like this.

Saver saver = new Saver(new File("myfile.properties"));
saver.set("username", "jack");
String age = saver.get("age");

The data is automatically saved when you do set()

The Splash Screen

The Splash Screen can be used to display a simple splash that you can personalize.

SplashScreen splash = new SplashScreen("MySplashTitle", mySplashImage);
splash.add(new JProgressBar());
splash.displayFor(5000L);

The Ram Selector

The Ram Selector can be used to display a Ram Choosing Frame easily

RamSelector selector = new RamSelector(new File("ram.txt"));
selector.display();

// Then when your launching
String[] ramArguments = selector.getRamArguments();

Minecraft

There is a support for Minecraft launching, you can use these tools to create a Minecraft Launcher:

Minecraft Launcher

You can use the Minecraft Launcher to create external launch profile for Minecraft

GameInfos infos = new GameInfos("MyMinecraft", new GameVersion("1.7.2", GameType.V1_7_2_LOWER), new GameTweak[] {GameTweak.FORGE});
AuthInfos authInfos = new AuthInfos("PlayerUsername", "token", "uuid");

ExternalLaunchProfile profile = MinecraftLauncher.createExternalProfile(infos, GameFolder.BASIC, authInfos);
ExternalLauncher launcher = new ExternalLauncher(profile);

launcher.launch();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.