HotswapProjects / HotswapAgent

Java unlimited redefinition of classes at runtime.
GNU General Public License v2.0
2.36k stars 493 forks source link

How to use HotswapAgent with Java 8? #578

Closed homejim closed 1 month ago

homejim commented 2 months ago

How to use hotswap with Java 8? Since Oracle JDK 8 requires using an exe installer, I don't plan to use it. I tried using TravaOpenJDK/trava-jdk-8-dcevm to install it, but the installation was unsuccessful.

@skybber Do you know how to solve this?

homejim commented 2 months ago

I encountered an error while using TravaOpenJDK/trava-jdk-8-dcevm to install JDK 8.

$ sh build_windows.sh build_windows.sh: line 3: wget: command not found build_windows.sh: line 4: wget: command not found zipinfo: cannot find or open OpenJDK8_x64_Windows.zip, OpenJDK8_x64_Windows.zip.zip or OpenJDK8_x64_Windows.zip.ZIP. unzip: cannot find or open OpenJDK8_x64_Windows.zip, OpenJDK8_x64_Windows.zip.zip or OpenJDK8_x64_Windows.zip.ZIP. mv: cannot stat 'freetype.zip': No such file or directory unzip: cannot find or open freetype.zip, freetype.zip.zip or freetype.zip.ZIP. build_windows.sh: line 26: ./makejdk-any-platform.sh: No such file or directory

skybber commented 2 months ago

@homejim there is TravaBuild build https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08, you've used build script.

homejim commented 2 months ago

@homejim there is TravaBuild build https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08, you've used build script.

https://api.adoptopenjdk.net/v2/binary/releases/openjdk8?openjdk_impl=hotspot&os=windows&arch=x64&release=latest&type=jdk

Is this link invalid? I can't download it. Could you add a GitHub Action similar to the one at https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/blob/master/.github/workflows/manually.yml for the release at https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08?

homejim commented 2 months ago

@homejim there is TravaBuild build https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08, you've used build script.

https://api.adoptopenjdk.net/v2/binary/releases/openjdk8?openjdk_impl=hotspot&os=windows&arch=x64&release=latest&type=jdk

Is this link invalid? I can't download it. Could you add a GitHub Action similar to the one at https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/blob/master/.github/workflows/manually.yml for the release at https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08?

@skybber I tried, but it failed. Do you know how to build JDK 8 with DCEVM included?

skybber commented 2 months ago

I've build

https://github.com/HotswapProjects/openjdk-jdk8u-dcevm

for Linux in the past. We have also built it on Travis, when the Travis was working.... As far as windows, I think we had problems with build enviroment and I'm not sure if we had working windows/Travis build. I would suggest you to study

https://github.com/TravaOpenJDK/temurin-build-dcevm

it is Temurin build script modified for dcevm. It is pretty old now, but it can work. May be you can try current Temurin build scripts for jdk8.

homejim commented 1 month ago

I've build

https://github.com/HotswapProjects/openjdk-jdk8u-dcevm

for Linux in the past. We have also built it on Travis, when the Travis was working.... As far as windows, I think we had problems with build enviroment and I'm not sure if we had working windows/Travis build. I would suggest you to study

https://github.com/TravaOpenJDK/temurin-build-dcevm

it is Temurin build script modified for dcevm. It is pretty old now, but it can work. May be you can try current Temurin build scripts for jdk8.

THX

homejim commented 1 month ago

@skybber I have successfully compiled OpenJDK 8 for Windows with DCEVM. However, when running with this JDK and using the -XXaltjvm=dcevm parameter, I encounter the following error:

Error: missing 'dcevm' JVM at 'D:\jdk\openjdk-jdk8u-dcevm-dcevm8u232b09\build\windows-x86_64-normal-server-fastdebug\jdk\bin\dcevm\jvm.dll'.

If I do not use the -XXaltjvm=dcevm parameter, it runs normally. When I modify the code, I can achieve a similar reload effect as with the DCEVM JDK。

Additionally, there is another issue where this JDK runs slower than other JDKs. This is the case even without using the dcevm javaagent

homejim commented 1 month ago

@skybber I have successfully compiled OpenJDK 8 for Windows with DCEVM. However, when running with this JDK and using the -XXaltjvm=dcevm parameter, I encounter the following error:

Error: missing 'dcevm' JVM at 'D:\jdk\openjdk-jdk8u-dcevm-dcevm8u232b09\build\windows-x86_64-normal-server-fastdebug\jdk\bin\dcevm\jvm.dll'.

If I do not use the -XXaltjvm=dcevm parameter, it runs normally. When I modify the code, I can achieve a similar reload effect as with the DCEVM JDK。

Additionally, there is another issue where this JDK runs slower than other JDKs. This is the case even without using the dcevm javaagent

The reason it's slow is because the debug parameter is enabled. After recompiling the release version of the JDK, it should work. However, there's still no need to add the XXaltjvm=dcevm parameter.

skybber commented 1 month ago

Great to hear that you've managed to compile it on Windows — it's not an easy task! Regarding -XXaltjvm, we've integrated DCEVM directly into JDK 8. So if you're building from this repository, there's no need to use the old -XXaltjvm parameter anymore.

homejim commented 1 month ago

Great to hear that you've managed to compile it on Windows — it's not an easy task! Regarding -XXaltjvm, we've integrated DCEVM directly into JDK 8. So if you're building from this repository, there's no need to use the old -XXaltjvm parameter anymore.

Thanks for your help