Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on May 12, 2024. It is now read-only.
/JavaDowngraderPublic archive

Standalone program and library which can downgrade Java classes/programs down to Java 8

License

NotificationsYou must be signed in to change notification settings

RaphiMC/JavaDowngrader

Repository files navigation

This project has been discontinued in favour ofhttps://github.com/unimined/JvmDowngrader which is a more complete java downgrading project.


JavaDowngrader

Standalone program and library which can downgrade Java classes/programs down to Java 8.

To use JavaDowngrader as a library in your application, check out theUsage (As a library) section.
If you just want to downgrade .jar files you can check out theUsage (Standalone) section.

Features

  • Supports up to Java 22 and down to Java 8
  • Downgrades language features
  • Downgrades important Java API calls
  • Can be applied during runtime
  • Can downgrade .jar files

Releases

Executable Jar File

If you want the executable jar file you can download a stable release fromGitHub Releases or the latest dev version fromGitHub Actions orLenni0451's Jenkins.

Gradle/Maven

To use JavaDowngrader with Gradle/Maven you can get it fromMaven Central,Lenni0451's Maven orJitpack.You can also find instructions how to implement it into your build script there.

Usage (Standalone/Bootstrap)

  1. Download the latest version from theGitHub Releases
  2. Run the jar file withjava -jar JavaDowngrader-whateverversion.jar to see the usage

Downgrade ahead of time

Here is an example command to convert the jar input.jar to Java 8 and output it to output.jar:java -jar JavaDowngrader-Standalone-whateverversion.jar -i "input.jar" -o "output.jar" -v 8

Downgrade during runtime

Here is an example command to run a jar file and downgrade it during runtime by using the bootstrap java agent:java -javaagent:JavaDowngrader-Bootstrap-whateverversion.jar -jar the_real_jar_you_want_to_run.jar

Additionally, you can set the-DspoofJavaVersion=<java version> property to bypass application specific checks for the Java version.

Usage (As a library)

To transform aClassNode you can use theJavaDowngrader class.
As a low level class modification framework in your applicationClassTransform is recommended.JavaDowngrader provides theimpl-classtransform submodule which contains various utility classes for ClassTransform.

Usage (In Gradle)

To use JavaDowngrader in Gradle you can get it fromLenni0451's Maven.You can also find instructions how to implement it into your build script there.

After adding the repository to yoursettings.gradle file you can apply the plugin like this:

plugins {    id"net.raphimc.java-downgrader" version"x.x.x"}

Downgrade the main source set

importnet.raphimc.javadowngrader.gradle.task.DowngradeSourceSetTasktasks.register("java8Main",DowngradeSourceSetTask) {    sourceSet= sourceSets.main}.get().dependsOn("classes")classes.finalizedBy("java8Main")

Downgrade the built jar (If you use Java 8+ libraries)

importnet.raphimc.javadowngrader.gradle.task.DowngradeJarTasktasks.register("java8Jar",DowngradeJarTask) {    input= tasks.jar.archiveFile.get().asFile    outputSuffix="+java8"    compileClassPath= sourceSets.main.compileClasspath}.get().dependsOn("build")build.finalizedBy("java8Jar")

Some of the optional properties include:

  • targetVersion: The target classfile version (Default: 8)
  • outputSuffix: The suffix to append to the output jar file (Default: "-downgraded")
  • copyRuntimeClasses: Whether to copy the JavaDowngrader runtime classes to the output jar (Default: true). Should be set to false if your jar already contains JavaDowngrader itself

Usage (In Maven)

JavaDowngrader doesn't have official maven support, but there is anunofficial maven plugin made by tr7zw.You can find instructions on how to implement it into your build script there.

Contact

If you encounter any issues, please report them on theissue tracker.
If you just want to talk or need help using JavaDowngrader feel free to join myDiscord.


[8]ページ先頭

©2009-2025 Movatter.jp