oshi | Native Operating System and Hardware Information | Monitoring library
kandi X-RAY | oshi Summary
Support
Quality
Security
License
Reuse
- Returns the windows power source .
- update the stats of the disk
- This method will read the performance data from the registry .
- Read Smbios strings .
- Creates a new processor ID based on the current settings .
- Get a map of partition names .
- Get physical volumes
- Retrieves the arguments for a process .
- Given a disk name returns a list of partition s parameters .
- Queries the efi information .
oshi Key Features
oshi Examples and Code Snippets
Trending Discussions on oshi
Trending Discussions on oshi
QUESTION
I am trying to create a custom Minecraft client but first I need to decompile the source files with MCP but it fails. It fails with a JavaOutOfMemoryError
. Here is the error:
18:31:41 - Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
18:31:41 - at java.util.Arrays.copyOfRange(Arrays.java:3664)
18:31:41 - at java.lang.String.(String.java:207)
18:31:41 - at java.io.DataInputStream.readUTF(DataInputStream.java:661)
18:31:41 - at java.io.DataInputStream.readUTF(DataInputStream.java:564)
18:31:41 - at org.jetbrains.java.decompiler.struct.consts.ConstantPool.(ConstantPool.java:54)
18:31:41 - at org.jetbrains.java.decompiler.struct.StructClass.(StructClass.java:87)
18:31:41 - at org.jetbrains.java.decompiler.struct.StructClass.(StructClass.java:75)
18:31:41 - at org.jetbrains.java.decompiler.struct.StructContext.addArchive(StructContext.java:167)
18:31:41 - at org.jetbrains.java.decompiler.struct.StructContext.addSpace(StructContext.java:100)
18:31:41 - at org.jetbrains.java.decompiler.struct.StructContext.addSpace(StructContext.java:78)
18:31:41 - at org.jetbrains.java.decompiler.main.Fernflower.addAllClasspath(Fernflower.java:120)
18:31:41 - at org.jetbrains.java.decompiler.main.Fernflower.(Fernflower.java:49)
18:31:41 - at org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.(ConsoleDecompiler.java:126)
18:31:41 - at org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(ConsoleDecompiler.java:87)
18:31:41 - '"C:\Program Files\Java\jdk1.8.0_261\bin\java" -jar runtime\bin\fernflower.jar -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -log=WARN "-e=jars\libraries\net/java/jinput\jinput\2.0.5\jinput-2.0.5.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl-platform\2.9.4-nightly-20150209\lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar" "-e=jars\libraries\com/ibm/icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar" "-e=jars\libraries\tv/twitch\twitch-external-platform\4.5\twitch-external-platform-4.5-natives-windows-32.jar" "-e=jars\libraries\org/apache/httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar" "-e=jars\libraries\org/apache/commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar" "-e=jars\libraries\net/java/dev/jna\jna\3.4.0\jna-3.4.0.jar" "-e=jars\libraries\com/paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar" "-e=jars\libraries\net/sf/jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar" "-e=jars\libraries\com/google/guava\guava\17.0\guava-17.0.jar" "-e=jars\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar" "-e=jars\libraries\org/apache/httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar" "-e=jars\libraries\org/apache/commons\commons-compress\1.8.1\commons-compress-1.8.1.jar" "-e=jars\libraries\net/java/dev/jna\platform\3.4.0\platform-3.4.0.jar" "-e=jars\libraries\com/paulscode\codecjorbis\20101023\codecjorbis-20101023.jar" "-e=jars\libraries\com/paulscode\soundsystem\20120107\soundsystem-20120107.jar" "-e=jars\libraries\com/paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar" "-e=jars\libraries\net/java/jutils\jutils\1.0.0\jutils-1.0.0.jar" "-e=jars\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar" "-e=jars\libraries\com/mojang\realms\1.7.39\realms-1.7.39.jar" "-e=jars\libraries\com/mojang\authlib\1.5.21\authlib-1.5.21.jar" "-e=jars\libraries\com/google/code/gson\gson\2.2.4\gson-2.2.4.jar" "-e=jars\libraries\com/mojang\netty\1.7.7\netty-1.7.7.jar" "-e=jars\libraries\tv/twitch\twitch\6.5\twitch-6.5.jar" "-e=jars\libraries\com/paulscode\codecwav\20101023\codecwav-20101023.jar" "-e=jars\libraries\tv/twitch\twitch-platform\6.5\twitch-platform-6.5-natives-windows-32.jar" "-e=jars\libraries\net/java/jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar" "-e=jars\libraries\io/netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar" temp/minecraft_ff_in.jar temp\src\minecraft' failed : 1
18:31:41 - Decompile failed
I have tried running just the command:
"C:\Program Files\Java\jdk1.8.0_261\bin\java" -jar runtime\bin\fernflower.jar -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -log=WARN "-e=jars\libraries\net/java/jinput\jinput\2.0.5\jinput-2.0.5.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl-platform\2.9.4-nightly-20150209\lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar" "-e=jars\libraries\com/ibm/icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar" "-e=jars\libraries\tv/twitch\twitch-external-platform\4.5\twitch-external-platform-4.5-natives-windows-32.jar" "-e=jars\libraries\org/apache/httpcomponents\httpcore\4.3.2\httpcore-4.3.2.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar" "-e=jars\libraries\org/apache/commons\commons-lang3\3.3.2\commons-lang3-3.3.2.jar" "-e=jars\libraries\net/java/dev/jna\jna\3.4.0\jna-3.4.0.jar" "-e=jars\libraries\com/paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar" "-e=jars\libraries\net/sf/jopt-simple\jopt-simple\4.6\jopt-simple-4.6.jar" "-e=jars\libraries\com/google/guava\guava\17.0\guava-17.0.jar" "-e=jars\libraries\oshi-project\oshi-core\1.1\oshi-core-1.1.jar" "-e=jars\libraries\org/apache/httpcomponents\httpclient\4.3.3\httpclient-4.3.3.jar" "-e=jars\libraries\org/apache/commons\commons-compress\1.8.1\commons-compress-1.8.1.jar" "-e=jars\libraries\net/java/dev/jna\platform\3.4.0\platform-3.4.0.jar" "-e=jars\libraries\com/paulscode\codecjorbis\20101023\codecjorbis-20101023.jar" "-e=jars\libraries\com/paulscode\soundsystem\20120107\soundsystem-20120107.jar" "-e=jars\libraries\com/paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl_util\2.9.4-nightly-20150209\lwjgl_util-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-codec\commons-codec\1.9\commons-codec-1.9.jar" "-e=jars\libraries\net/java/jutils\jutils\1.0.0\jutils-1.0.0.jar" "-e=jars\libraries\commons-logging\commons-logging\1.1.3\commons-logging-1.1.3.jar" "-e=jars\libraries\org/lwjgl/lwjgl\lwjgl\2.9.4-nightly-20150209\lwjgl-2.9.4-nightly-20150209.jar" "-e=jars\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar" "-e=jars\libraries\com/mojang\realms\1.7.39\realms-1.7.39.jar" "-e=jars\libraries\com/mojang\authlib\1.5.21\authlib-1.5.21.jar" "-e=jars\libraries\com/google/code/gson\gson\2.2.4\gson-2.2.4.jar" "-e=jars\libraries\com/mojang\netty\1.7.7\netty-1.7.7.jar" "-e=jars\libraries\tv/twitch\twitch\6.5\twitch-6.5.jar" "-e=jars\libraries\com/paulscode\codecwav\20101023\codecwav-20101023.jar" "-e=jars\libraries\tv/twitch\twitch-platform\6.5\twitch-platform-6.5-natives-windows-32.jar" "-e=jars\libraries\net/java/jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar" "-e=jars\libraries\org/apache/logging/log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar" "-e=jars\libraries\io/netty\netty-all\4.0.23.Final\netty-all-4.0.23.Final.jar" temp/minecraft_ff_in.jar temp\src\minecraft
but with an added -Xmx1124m
and it works.
I don't know how to reproduce the same while running the decompile.bat
file as the file just runs another python file.
I am using MCP 9.18 and trying to decompile Minecraft 1.8.8. My computer has 2GB of memory with 1.9GB being usable.
ANSWER
Answered 2021-Dec-06 at 05:49Go to conf/mcp.cfg
. Find this line
CmdFernflower = %s -jar %s -din=1 -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir}
and change it to this
CmdFernflower = %s -Xmx1.7G -jar %s -din=1 -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir}
That should give MCP 1.7gb of ram when decompiling. I really recommend to get more ram even 8gb will be a huge help
QUESTION
So,I am trying to collect paths from the minecraft 1.8.8 json file only using json file,
Here is the content of 1.8.8.json (if you don't khow):
{"assetIndex":{"id":"1.8","sha1":"f6ad102bcaa53b1a58358f16e376d548d44933ec","size":78494,"totalSize":114885064,"url":"https://launchermeta.mojang.com/v1/packages/f6ad102bcaa53b1a58358f16e376d548d44933ec/1.8.json"},"assets":"1.8","complianceLevel":0,"downloads":{},"id":"BatMod","javaVersion":{"component":"jre-legacy","majorVersion":8},"mainClass":"net.minecraft.client.main.Main","minecraftArguments":"--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}","minimumLauncherVersion":14,"releaseTime":"2015-12-03T09:24:39+00:00","time":"2015-12-03T09:24:39+00:00","type":"release","logging":{"client":{"argument":"-Dlog4j.configurationFile=${path}","file":{"id":"client-1.7.xml","sha1":"6605d632a2399010c0085d3e4da58974d62ccdfe","size":871,"url":"https://launcher.mojang.com/v1/objects/6605d632a2399010c0085d3e4da58974d62ccdfe/client-1.7.xml"},"type":"log4j2-xml"}},"libraries":[{"name":"com.mojang:netty:1.6","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/mojang/netty/1.6/netty-1.6.jar","sha1":"4b75825a06139752bd800d9e29c5fd55b8b1b1e4","size":7877}}},{"name":"oshi-project:oshi-core:1.1","downloads":{"artifact":{"url":"https://libraries.minecraft.net/oshi-project/oshi-core/1.1/oshi-core-1.1.jar","sha1":"9ddf7b048a8d701be231c0f4f95fd986198fd2d8","size":30973}}},{"name":"net.java.dev.jna:jna:3.4.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar","sha1":"803ff252fedbd395baffd43b37341dc4a150a554","size":1008730}}},{"name":"net.java.dev.jna:platform:3.4.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar","sha1":"e3f70017be8100d3d6923f50b3d2ee17714e9c13","size":913436}}},{"name":"com.ibm.icu:icu4j-core-mojang:51.2","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar","sha1":"63d216a9311cca6be337c1e458e587f99d382b84","size":1634692}}},{"name":"net.sf.jopt-simple:jopt-simple:4.6","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar","sha1":"306816fb57cf94f108a43c95731b08934dcae15c","size":62477}}},{"name":"com.paulscode:codecjorbis:20101023","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar","sha1":"c73b5636faf089d9f00e8732a829577de25237ee","size":103871}}},{"name":"com.paulscode:codecwav:20101023","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/codecwav/20101023/codecwav-20101023.jar","sha1":"12f031cfe88fef5c1dd36c563c0a3a69bd7261da","size":5618}}},{"name":"com.paulscode:libraryjavasound:20101123","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar","sha1":"5c5e304366f75f9eaa2e8cca546a1fb6109348b3","size":21679}}},{"name":"com.paulscode:librarylwjglopenal:20100824","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar","sha1":"73e80d0794c39665aec3f62eee88ca91676674ef","size":18981}}},{"name":"com.paulscode:soundsystem:20120107","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar","sha1":"419c05fe9be71f792b2d76cfc9b67f1ed0fec7f6","size":65020}}},{"name":"io.netty:netty-all:4.0.23.Final","downloads":{"artifact":{"url":"https://libraries.minecraft.net/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar","sha1":"0294104aaf1781d6a56a07d561e792c5d0c95f45","size":1779991}}},{"name":"com.google.guava:guava:17.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/google/guava/guava/17.0/guava-17.0.jar","sha1":"9c6ef172e8de35fd8d4d8783e4821e57cdef7445","size":2243036}}},{"name":"org.apache.commons:commons-lang3:3.3.2","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar","sha1":"90a3822c38ec8c996e84c16a3477ef632cbc87a3","size":412739}}},{"name":"commons-io:commons-io:2.4","downloads":{"artifact":{"url":"https://libraries.minecraft.net/commons-io/commons-io/2.4/commons-io-2.4.jar","sha1":"b1b6ea3b7e4aa4f492509a4952029cd8e48019ad","size":185140}}},{"name":"commons-codec:commons-codec:1.9","downloads":{"artifact":{"url":"https://libraries.minecraft.net/commons-codec/commons-codec/1.9/commons-codec-1.9.jar","sha1":"9ce04e34240f674bc72680f8b843b1457383161a","size":263965}}},{"name":"net.java.jinput:jinput:2.0.5","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar","sha1":"39c7796b469a600f72380316f6b1f11db6c2c7c4","size":208338}}},{"name":"net.java.jutils:jutils:1.0.0","downloads":{"artifact":{"url":"https://libraries.minecraft.net/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar","sha1":"e12fe1fda814bd348c1579329c86943d2cd3c6a6","size":7508}}},{"name":"com.google.code.gson:gson:2.2.4","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar","sha1":"a60a5e993c98c864010053cb901b7eab25306568","size":190432}}},{"name":"com.mojang:authlib:1.5.21","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar","sha1":"aefba0d5b53fbcb70860bc8046ab95d5854c07a5","size":64412}}},{"name":"com.mojang:realms:1.7.39","downloads":{"artifact":{"url":"https://libraries.minecraft.net/com/mojang/realms/1.7.39/realms-1.7.39.jar","sha1":"c282954ce2a3bc62812e0d41c05f179b3b5839d7","size":443224}}},{"name":"org.apache.commons:commons-compress:1.8.1","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar","sha1":"a698750c16740fd5b3871425f4cb3bbaa87f529d","size":365552}}},{"name":"org.apache.httpcomponents:httpclient:4.3.3","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar","sha1":"18f4247ff4572a074444572cee34647c43e7c9c7","size":589512}}},{"name":"commons-logging:commons-logging:1.1.3","downloads":{"artifact":{"url":"https://libraries.minecraft.net/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar","sha1":"f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f","size":62050}}},{"name":"org.apache.httpcomponents:httpcore:4.3.2","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar","sha1":"31fbbff1ddbf98f3aa7377c94d33b0447c646b6e","size":282269}}},{"name":"org.apache.logging.log4j:log4j-api:2.0-beta9","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar","sha1":"1dd66e68cccd907880229f9e2de1314bd13ff785","size":108161}}},{"name":"org.apache.logging.log4j:log4j-core:2.0-beta9","downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar","sha1":"678861ba1b2e1fccb594bb0ca03114bb05da9695","size":681134}}},{"name":"org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar","sha1":"697517568c68e78ae0b4544145af031c81082dfe","size":1047168}}},{"name":"org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar","sha1":"d51a7c040a721d13efdfbd34f8b257b2df882ad0","size":173887}}},{"name":"org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"osx"}}],"natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows"},"extract":{"exclude":["META-INF/"]},"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar","sha1":"b04f3ee8f5e43fa3b162981b50bb72fe1acabb33","size":22},"classifiers":{"natives-windows":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar","sha1":"b84d5102b9dbfabfeb5e43c7e2828d98a7fc80e0","size":613748},"natives-osx":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar","sha1":"bcab850f8f487c3f4c4dbabde778bb82bd1a40ed","size":426822},"natives-linux":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux.jar","sha1":"931074f46c795d2f7b30ed6395df5715cfd7675b","size":578680}}}},{"name":"org.lwjgl.lwjgl:lwjgl:2.9.2-nightly-20140822","rules":[{"action":"allow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar","sha1":"7707204c9ffa5d91662de95f0a224e2f721b22af","size":1045632}}},{"name":"org.lwjgl.lwjgl:lwjgl_util:2.9.2-nightly-20140822","rules":[{"action":"allow","os":{"name":"osx"}}],"downloads":{"artifact":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar","sha1":"f0e612c840a7639c1f77f68d72a28dae2f0c8490","size":173887}}},{"name":"org.lwjgl.lwjgl:lwjgl-platform:2.9.2-nightly-20140822","rules":[{"action":"allow","os":{"name":"osx"}}],"natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-windows.jar","sha1":"78b2a55ce4dc29c6b3ec4df8ca165eba05f9b341","size":613680},"natives-osx":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar","sha1":"79f5ce2fea02e77fe47a3c745219167a542121d7","size":468116},"natives-linux":{"url":"https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-linux.jar","sha1":"d898a33b5d0a6ef3fed3a4ead506566dce6720a5","size":578539}}}},{"name":"net.java.jinput:jinput-platform:2.0.5","natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar","sha1":"385ee093e01f587f30ee1c8a2ee7d408fd732e16","size":155179},"natives-osx":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar","sha1":"53f9c919f34d2ca9de8c51fc4e1e8282029a9232","size":12186},"natives-linux":{"url":"https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar","sha1":"7ff832a6eb9ab6a767f1ade2b548092d0fa64795","size":10362}}}},{"name":"tv.twitch:twitch:6.5","downloads":{"artifact":{"url":"https://libraries.minecraft.net/tv/twitch/twitch/6.5/twitch-6.5.jar","sha1":"320a2dfd18513a5f41b4e75729df684488cbd925","size":55977}}},{"name":"tv.twitch:twitch-platform:6.5","rules":[{"action":"allow"},{"action":"disallow","os":{"name":"linux"}}],"natives":{"osx":"natives-osx","linux":"natives-linux","windows":"natives-windows-${arch}"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows-64":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-64.jar","sha1":"9fdd0fd5aed0817063dcf95b69349a171f447ebd","size":580098},"natives-osx":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-osx.jar","sha1":"5f9d1ee26257b3a33f0ca06fed335ef462af659f","size":455359},"natives-windows-32":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-32.jar","sha1":"206c4ccaecdbcfd2a1631150c69a97bbc9c20c11","size":474225}}}},{"name":"tv.twitch:twitch-external-platform:4.5","rules":[{"action":"allow","os":{"name":"windows"}}],"natives":{"windows":"natives-windows-${arch}"},"extract":{"exclude":["META-INF/"]},"downloads":{"classifiers":{"natives-windows-64":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar","sha1":"c3cde57891b935d41b6680a9c5e1502eeab76d86","size":7457619},"natives-windows-32":{"url":"https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar","sha1":"18215140f010c05b9f86ef6f0f8871954d2ccebf","size":5654047}}}}]}
(you propelly won't read it) My question is that how am i gonna get all the path that link to the libaries? Here is the batch script i have tested:
for /f "tokens=1,2 delims=:{}, " %%A in (1.8.8.json) do (
if %%~A==path (
echo %%~B >> path.txt
)
)
This work fine on 1.7.10 json file:
{
"assets": "1.7.10",
"id": "CheatBreaker",
"libraries": [
{
"downloads": {
"artifact": {
"path": "com/mojang/netty/1.6/netty-1.6.jar",
"sha1": "4b75825a06139752bd800d9e29c5fd55b8b1b1e4",
"size": 7877,
"url": "https://libraries.minecraft.net/com/mojang/netty/1.6/netty-1.6.jar"
}
},
"name": "com.mojang:netty:1.6"
},
{
"downloads": {
"artifact": {
"path": "com/mojang/realms/1.3.5/realms-1.3.5.jar",
"sha1": "0807ae355ee63583becd7ea60e76aab1532bb42e",
"size": 353818,
"url": "https://libraries.minecraft.net/com/mojang/realms/1.3.5/realms-1.3.5.jar"
}
},
"name": "com.mojang:realms:1.3.5"
},
{
"downloads": {
"artifact": {
"path": "org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar",
"sha1": "a698750c16740fd5b3871425f4cb3bbaa87f529d",
"size": 365552,
"url": "https://libraries.minecraft.net/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar"
}
},
"name": "org.apache.commons:commons-compress:1.8.1"
},
"name": "net.java.jinput:jinput:2.0.5"
},
{
"downloads": {
"artifact": {
"path": "net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar",
"sha1": "e12fe1fda814bd348c1579329c86943d2cd3c6a6",
"size": 7508,
"url": "https://libraries.minecraft.net/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar"
}
},
"name": "net.java.jutils:jutils:1.0.0"
},
{
"downloads": {
"artifact": {
"path": "com/google/code/gson/gson/2.2.4/gson-2.2.4.jar",
"sha1": "a60a5e993c98c864010053cb901b7eab25306568",
"size": 190432,
"url": "https://libraries.minecraft.net/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar"
}
},
"name": "com.google.code.gson:gson:2.2.4"
},
{
"downloads": {
"artifact": {
"path": "com/mojang/authlib/1.5.21/authlib-1.5.21.jar",
"sha1": "aefba0d5b53fbcb70860bc8046ab95d5854c07a5",
"size": 64412,
"url": "https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar"
}
},
"name": "com.mojang:authlib:1.5.21"
},
{
"downloads": {
"artifact": {
"path": "org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar",
"sha1": "1dd66e68cccd907880229f9e2de1314bd13ff785",
"size": 108161,
"url": "https://libraries.minecraft.net/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar"
}
},
"name": "org.apache.logging.log4j:log4j-api:2.0-beta9"
},
{
"downloads": {
"artifact": {
"path": "org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar",
"sha1": "678861ba1b2e1fccb594bb0ca03114bb05da9695",
"size": 681134,
"url": "https://libraries.minecraft.net/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar"
}
},
"name": "org.apache.logging.log4j:log4j-core:2.0-beta9"
},
{
"downloads": {
"artifact": {
"path": "org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar",
"sha1": "f58c5aabcef0e41718a564be9f8e412fff8db847",
"size": 1014790,
"url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl/2.9.1/lwjgl-2.9.1.jar"
}
},
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1"
},
{
"downloads": {
"artifact": {
"path": "org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar",
"sha1": "290d7ba8a1bd9566f5ddf16ad06f09af5ec9b20e",
"size": 173909,
"url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl_util/2.9.1/lwjgl_util-2.9.1.jar"
}
},
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1"
},
{
"downloads": {
"classifiers": {
"natives-linux": {
"path": "org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-linux.jar",
"sha1": "aa9aae879af8eb378e22cfc64db56ec2ca9a44d1",
"size": 571424,
"url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-linux.jar"
},
"natives-osx": {
"path": "org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-osx.jar",
"sha1": "2d12c83fdfbc04ecabf02c7bc8cc54d034f0daac",
"size": 527196,
"url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-osx.jar"
},
"natives-windows": {
"path": "org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-windows.jar",
"sha1": "4c517eca808522457dd95ee8fc1fbcdbb602efbe",
"size": 611334,
"url": "https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.1/lwjgl-platform-2.9.1-natives-windows.jar"
}
}
},
"extract": {
"exclude": [
"META-INF/"
]
},
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1",
"natives": {
"linux": "natives-linux",
"osx": "natives-osx",
"windows": "natives-windows"
}
},
{
"downloads": {
"classifiers": {
"natives-linux": {
"path": "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar",
"sha1": "7ff832a6eb9ab6a767f1ade2b548092d0fa64795",
"size": 10362,
"url": "https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar"
},
"natives-osx": {
"path": "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar",
"sha1": "53f9c919f34d2ca9de8c51fc4e1e8282029a9232",
"size": 12186,
"url": "https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar"
},
"natives-windows": {
"path": "net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar",
"sha1": "385ee093e01f587f30ee1c8a2ee7d408fd732e16",
"size": 155179,
"url": "https://libraries.minecraft.net/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar"
}
}
},
"extract": {
"exclude": [
"META-INF/"
]
},
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"osx": "natives-osx",
"windows": "natives-windows"
}
},
{
"downloads": {
"artifact": {
"path": "tv/twitch/twitch/5.16/twitch-5.16.jar",
"sha1": "1f55f009c61637c10c0acfb8b5ffc600f30044b4",
"size": 52315,
"url": "https://libraries.minecraft.net/tv/twitch/twitch/5.16/twitch-5.16.jar"
}
},
"name": "tv.twitch:twitch:5.16"
},
{
"downloads": {
"classifiers": {
"natives-osx": {
"path": "tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-osx.jar",
"sha1": "62503ee712766cf77f97252e5902786fd834b8c5",
"size": 418331,
"url": "https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-osx.jar"
},
"natives-windows-32": {
"path": "tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-32.jar",
"sha1": "7c6affe439099806a4f552da14c42f9d643d8b23",
"size": 386792,
"url": "https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-32.jar"
},
"natives-windows-64": {
"path": "tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-64.jar",
"sha1": "39d0c3d363735b4785598e0e7fbf8297c706a9f9",
"size": 463390,
"url": "https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-64.jar"
}
}
},
"extract": {
"exclude": [
"META-INF/"
]
},
"name": "tv.twitch:twitch-platform:5.16",
"natives": {
"linux": "natives-linux",
"osx": "natives-osx",
"windows": "natives-windows-${arch}"
},
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "linux"
}
}
]
},
{
"downloads": {
"classifiers": {
"natives-windows-32": {
"path": "tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar",
"sha1": "18215140f010c05b9f86ef6f0f8871954d2ccebf",
"size": 5654047,
"url": "https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar"
},
"natives-windows-64": {
"path": "tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar",
"sha1": "c3cde57891b935d41b6680a9c5e1502eeab76d86",
"size": 7457619,
"url": "https://libraries.minecraft.net/tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar"
}
}
},
"extract": {
"exclude": [
"META-INF/"
]
},
"name": "tv.twitch:twitch-external-platform:4.5",
"natives": {
"windows": "natives-windows-${arch}"
},
"rules": [
{
"action": "allow",
"os": {
"name": "windows"
}
}
]
}
],
"logging": {
"client": {
"argument": "-Dlog4j.configurationFile=${path}",
"file": {
"id": "client-1.7.xml",
"sha1": "6605d632a2399010c0085d3e4da58974d62ccdfe",
"size": 871,
"url": "https://launcher.mojang.com/v1/objects/6605d632a2399010c0085d3e4da58974d62ccdfe/client-1.7.xml"
},
"type": "log4j2-xml"
}
},
etc...
"mainClass": "net.minecraft.client.main.Main",
"minecraftArguments": "--username ${auth_player_name} --version ${version_name} --gameDir ${game_directory} --assetsDir ${assets_root} --assetIndex ${assets_index_name} --uuid ${auth_uuid} --accessToken ${auth_access_token} --userProperties ${user_properties} --userType ${user_type}",
"minimumLauncherVersion": 13,
"releaseTime": "2019-10-16T19:29:57+00:00",
"time": "2014-05-14T17:29:23+00:00",
"type": "release"
}
you can see that the json file above have the "path".what the batch file did is output all of the value of "path" into a text file called "path.txt".The code above work fine on 1.7.10.json file,but it never output anything when i try to use it with 1.8.8.json.
content of path.txt:
com/mojang/netty/1.6/netty-1.6.jar
com/mojang/realms/1.3.5/realms-1.3.5.jar
org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
java3d/vecmath/1.3.1/vecmath-1.3.1.jar
net/sf/trove4j/trove4j/3.0.3/trove4j-3.0.3.jar
com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar
net/sf/jopt-simple/jopt-simple/4.5/jopt-simple-4.5.jar
com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar
com/paulscode/codecwav/20101023/codecwav-20101023.jar
com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar
com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar
etc...
from my look,There is the "url" value that store link to download these libaries. My guess is that we can use the url links to create path:Example:
https://libraries.minecraft.net/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar
We can reuse that link and turn it into a path,by deleting "https://libraries.minecraft.net/"
https://libraries.minecraft.net/ net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar (delete the blue bold one.)
So,how are we gonna erase that bold blue text,and only save the path into a txt file like path.txt using batch? (Sorry if my english is bad,english is not my main speaking thing.You can edit the if i write something wrong.)
ANSWER
Answered 2021-Nov-15 at 12:27Remember that batch and cmd is not suitable to parse JSON file !
But if you insist to use a batch file just give a try with this ugly code :
@echo off
Set "PathLink=%~dp0PathLink.txt"
If Exist "%PathLink%" Del "%PathLink%"
SetLocal EnableDelayedExpansion
@for /f "tokens=1-3 delims=:{}, " %%A in (1.8.8.json) do (
If /I %%~A==url (
Set "link=%%~C"
Set link=!link:"=!
Set link=!link://libraries.minecraft.net/=!
Set link=!link://launchermeta.mojang.com/=!
Set link=!link://launcher.mojang.com/=!
echo !link!>>"%PathLink%"
)
)
Start "" /MAX "%PathLink%"
EXIT
As a result you can get :
v1/packages/f6ad102bcaa53b1a58358f16e376d548d44933ec/1.8.json
v1/objects/6605d632a2399010c0085d3e4da58974d62ccdfe/client-1.7.xml
com/mojang/netty/1.6/netty-1.6.jar
oshi-project/oshi-core/1.1/oshi-core-1.1.jar
net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar
net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar
com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar
net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar
com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar
com/paulscode/codecwav/20101023/codecwav-20101023.jar
com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar
com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar
com/paulscode/soundsystem/20120107/soundsystem-20120107.jar
io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar
com/google/guava/guava/17.0/guava-17.0.jar
org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar
commons-io/commons-io/2.4/commons-io-2.4.jar
commons-codec/commons-codec/1.9/commons-codec-1.9.jar
net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar
net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar
com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
com/mojang/authlib/1.5.21/authlib-1.5.21.jar
com/mojang/realms/1.7.39/realms-1.7.39.jar
org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar
org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar
org/lwjgl/lwjgl/lwjgl/2.9.4-nightly-20150209/lwjgl-2.9.4-nightly-20150209.jar
org/lwjgl/lwjgl/lwjgl_util/2.9.4-nightly-20150209/lwjgl_util-2.9.4-nightly-20150209.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-windows.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-linux.jar
org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar
org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-windows.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar
org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-linux.jar
net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-windows.jar
net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar
net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-linux.jar
tv/twitch/twitch/6.5/twitch-6.5.jar
tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-64.jar
tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-osx.jar
tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-windows-32.jar
tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-64.jar
tv/twitch/twitch-external-platform/4.5/twitch-external-platform-4.5-natives-windows-32.jar
QUESTION
I manage an open source project and have a user reporting a situation which I think is impossible according to Java's order of initialization of static variables in classes. The value of a static final
class variable is incorrect, apparently resulting from different results of a dependency's static method based on its own static final variable.
I'd like to understand what's happening in order to figure the best workaround. At the moment, I am baffled.
The problemThe main entry point for my project is the class SystemInfo
which has the following constructor:
public SystemInfo() {
if (getCurrentPlatform().equals(PlatformEnum.UNKNOWN)) {
throw new UnsupportedOperationException(NOT_SUPPORTED + Platform.getOSType());
}
}
When run by itself, the problem doesn't reproduce; but when run as part of many tests being executed a larger build (mvn install
) it is consistently reproducible, implying the problem is likely associated with multithreading or multiple forks. (To clarify: I mean the simultaneous initialization of static members in two different classes, and the various JVM-internal locking/synchronization mechanisms associated with this process.)
They receive the following result:
java.lang.UnsupportedOperationException: Operating system not supported: JNA Platform type 2
This exception implies two things are true when SystemInfo
instantiation begins:
- The result of
getCurrentPlatform()
is the enum valuePlatformEnum.UNKNOWN
- The result of
Platform.getOSType()
is 2
However, this situation should be impossible; a value of 2 would return WINDOWS, and unknown would return a value other than 2. Since both variables are both static
and final
they should never simultaneously reach this state.
I have tried to reproduce this on my own and failed, and am relying on a report from a user executing tests in their Kotlin-based (kotest) framework.
The user's MCRE simply invokes this constructor as part of a larger number of tests, running on the Windows operating system:
public class StorageOnSystemJava {
public StorageOnSystemJava(SystemInfo info) {
}
}
class StorageOnSystemJavaTest {
@Test
void run() {
new StorageOnSystemJava(new SystemInfo());
}
}
The getCurrentPlatform()
method simply returns the value of this static final
variable.
public static PlatformEnum getCurrentPlatform() {
return currentPlatform;
}
This is a static final
variable populated as the very first line in the class (so it should be the first thing initialized):
private static final PlatformEnum currentPlatform = queryCurrentPlatform();
where
private static PlatformEnum queryCurrentPlatform() {
if (Platform.isWindows()) {
return WINDOWS;
} else if (Platform.isLinux()) {
// other Platform.is*() checks here
} else {
return UNKNOWN; // The exception message shows the code reaches this point
}
}
This means that during class initialization, all of the Platform.is*()
checks returned false.
However, as indicated above this should not have happened. These are calls to JNA's Platform
class static methods. The first check, which should have returned true
(and does, if called in the constructor or anywhere in code after instantiation) is:
public static final boolean isWindows() {
return osType == WINDOWS || osType == WINDOWSCE;
}
Where osType
is a static final
variable defined thus:
public static final int WINDOWS = 2;
private static final int osType;
static {
String osName = System.getProperty("os.name");
if (osName.startsWith("Linux")) {
// other code
}
else if (osName.startsWith("Windows")) {
osType = WINDOWS; // This is the value being assigned, showing the "2" in the exception
}
// other code
}
From my understanding of the order of initialization, Platform.isWindows()
should always return true
(on a Windows OS). I do not understand how it could possibly return false
when called from my own code's static variable initialization. I've tried both the static method, and a static initialization block immediately following the variable declaration.
- User calls the
SystemInfo
constructor SystemInfo
class initialization begins ("T is a class and an instance of T is created.")- The
static final currentPlatform
variable is encountered by the initializer (first line of class) - The initializer calls the static method
queryCurrentPlatform()
to obtain a result (same result if the value is assigned in a static block immediately following the static variable declaration) - The
Platform.isWindows()
static method is called - The
Platform
class is initialized ("T is a class and a static method of T is invoked.") - The
Platform
class sets theosType
value to 2 as part of initialization - When
Platform
initialization is complete, the static methodisWindows()
returnstrue
- The
queryCurrentPlatform()
sees thetrue
result and sets thecurrentPlatform
variable value (This is not happening as expected!) - After
SystemInfo
class initialization is complete, its constructor executes, showing the conflicting values and throwing the exception.
Some workarounds stop the problem, but I don't understand why they do:
Performing the
Platform.isWindows()
check anytime during the instantiation process (including the constructor) properly returnstrue
and assigns the enum appropriately.- This includes lazy instantiation of the
currentPlatform
variable (removing thefinal
keyword), or ignoring the enum and directly calling JNA'sPlatform
class.
- This includes lazy instantiation of the
Moving the first call to the
static
methodgetCurrentPlatform()
out of the constructor.
These workarounds imply a possible root cause is associated with executing static
methods of multiple classes during class initialization. Specifically:
- During initialization, the
Platform.isWindows()
check apparently returnsfalse
because code reaches theelse
block - After initialization (during instantiation), the
Platform.isWindows()
check returnstrue
. (Since it is based on astatic final
value it should not ever return different results.)
I've thoroughly reviewed multiple tutorials about Java clearly showing the initialization order, as well as these other SO questions and the linked Java Language Specs:
ANSWER
Answered 2021-Jul-17 at 00:49DISCLAIMER: I'm writing this as an answer because I don't know how to make it fit into a comment. If it doesn't help you let me know, and I'll delete it.
Let's start with a small recap which given the question quality, I'm sure you're aware of already:
- A field which is
static
to a class, means that it only exists once for any instance. No matter how many instances of the class you create, the field will always point to the same memory address. - A field which is
final
means that once initialized, its value cannot change any longer.
So, when you mix these two into a static final
field, it means:
- You only have one value for that field, no matter how many instances
- Once the value is assigned, it doesn't change any longer
So, my suspect is not that there is any thread-safety issue (I don't think you're running your tests in parallel, so I guess no two-threads would simultaneously work on these objects, right?), but rather that a previous test of your test suite has initialized the variables differently and, being they run into the same JVM, they don't change any longer their values.
Take this very simple test example.
I have one very basic class:
public final class SomeClass {
private static final boolean FILE_EXISTS;
static {
FILE_EXISTS = new File("test").exists();
}
public SomeClass() {
System.out.println("File exists? " + FILE_EXISTS);
}
}
The above class simply has a static final boolean
saying whether a certain file named test
exists into the working directory. As you can see, the field is initialized once (final
) and will be the same for each instance.
Now, let's run these two very simple tests:
@Test
public void test_some_class() throws IOException {
System.out.println("Running test_some_class");
File testFile = new File("test");
if (testFile.exists()) {
System.out.println("Deleting file: " + testFile.delete());
} else {
System.out.println("Could create the file test: " + testFile.createNewFile());
}
SomeClass instance1 = new SomeClass();
}
@Test
public void other_test_some_class() {
System.out.println("Running other_test_some_class");
SomeClass instance2 = new SomeClass();
}
In the first test, I check if file test
exists. If it does exists, I'll delete it. Else, I'll create it. Then, I'll initialize a new SomeClass()
.
In the second test, I simply initialize a new SomeClass()
.
This is the output of my tests run together:
Running other_test_some_class //<-- JUnit picks the second test to start
File exists? false //<-- The constructor of SomeClass() prints the static final variable: file doesn't exist
Running test_some_class //<-- JUnit continues running the first test
Could create the file test: true //<-- it is able to create the file
File exists? false //<-- yet, the initializer of new SomeClass() still prints false
The reason why it prints false
, even though we clearly created the test
file before initializing new SomeClass()
, is that the field FILE_EXISTS
is static
(hence shared across all instances) and final
(hence initialized once, lasting forever).
So if you wonder why private static final int osType;
has a value which returns you UNKNOWN
when you run mvn install
but not when you run the single test, I'd simply look what test, in your full test suite, has already initialized it with a value that you don't expect.
There are two types of solution for this, and they depend on your production code.
It may be that, functionally, you actually need this field to be maybe final
to the instance of the class, but not static
. If that's the case, you should just declare it final
to the class (once initialized, it doesn't change, but still you have one different value per instance).
Or, it may be that you really need the field to be static final
in production, but not during tests as you initialize a new test context each time. If that's the case, you should configure your test plugin to reuseForks
= false (meaning a fresh JVM fork is created for each test class, and that guarantees you that each test class will start with a fresh memory for your static final
fields):
org.apache.maven.plugins
maven-surefire-plugin
${maven.surefire.plugin.version}
1
false
QUESTION
When I use the @Push annotation on a view I get the following exception (JDK 16, Vaadin 19.0.7, Spring boot 2.4.7):
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at net.cbsolution.chameleon.ChameleonApplication.main(ChameleonApplication.java:10) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
... 14 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
... 19 common frames omitted
What shall I do to use server push with Spring boot? Can anybody point a working example?
Here is the complete log:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.7-SNAPSHOT)
2021-06-20 18:59:24.644 INFO 33309 --- [ restartedMain] n.c.chameleon.ChameleonApplication : Starting ChameleonApplication using Java 16 on franco-HP-ZBook-15-G5 with PID 33309 (/home/franco/projects/chameleon/target/classes started by franco in /home/franco/projects/chameleon)
2021-06-20 18:59:24.646 INFO 33309 --- [ restartedMain] n.c.chameleon.ChameleonApplication : No active profile set, falling back to default profiles: default
2021-06-20 18:59:24.672 INFO 33309 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in /home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/license-checker-1.2.0.jar referenced one or more files that do not exist: file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/gwt-elemental-2.8.2.vaadin2.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/oshi-core-5.5.0.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/jna-5.7.0.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/jna-platform-5.7.0.jar,file:/home/franco/.m2/repository/com/vaadin/license-checker/1.2.0/slf4j-api-1.7.30.jar
2021-06-20 18:59:24.672 INFO 33309 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in /home/franco/.m2/repository/com/oracle/database/jdbc/ojdbc8/19.8.0.0/ojdbc8-19.8.0.0.jar referenced one or more files that do not exist: file:/home/franco/.m2/repository/com/oracle/database/jdbc/ojdbc8/19.8.0.0/oraclepki.jar
2021-06-20 18:59:24.672 INFO 33309 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in /home/franco/.m2/repository/com/cronutils/cron-utils/9.1.5/cron-utils-9.1.5.jar referenced one or more files that do not exist: file:/home/franco/.m2/repository/com/cronutils/cron-utils/9.1.5/slf4j-api-1.7.30.jar,file:/home/franco/.m2/repository/com/cronutils/cron-utils/9.1.5/javax.el-3.0.0.jar
2021-06-20 18:59:24.672 INFO 33309 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2021-06-20 18:59:24.672 INFO 33309 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2021-06-20 18:59:25.095 INFO 33309 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-06-20 18:59:25.130 INFO 33309 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 32 ms. Found 6 JPA repository interfaces.
2021-06-20 18:59:25.471 INFO 33309 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-06-20 18:59:25.475 INFO 33309 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-06-20 18:59:25.475 INFO 33309 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
2021-06-20 18:59:25.525 INFO 33309 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-06-20 18:59:25.525 INFO 33309 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 853 ms
2021-06-20 18:59:25.574 INFO 33309 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2021-06-20 18:59:25.734 INFO 33309 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2021-06-20 18:59:25.737 INFO 33309 --- [ restartedMain] o.s.b.a.h2.H2ConsoleAutoConfiguration : H2 console available at '/h2-console'. Database available at 'jdbc:postgresql://localhost:5432/chameleon'
2021-06-20 18:59:25.841 INFO 33309 --- [ restartedMain] c.v.f.s.VaadinServletContextInitializer : Search for VaadinAppShell took 17 ms
2021-06-20 18:59:25.843 INFO 33309 --- [ restartedMain] c.v.f.s.s.VaadinAppShellInitializer : Using net.cbsolution.chameleon.MyAppShellConfigurator class for configuring `index.html` response
2021-06-20 18:59:25.848 ERROR 33309 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener]
java.lang.RuntimeException: Unable to initialize com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener
at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:192) ~[vaadin-spring-16.0.1.jar:na]
at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.lambda$contextInitialized$0(VaadinServletContextInitializer.java:209) ~[vaadin-spring-16.0.1.jar:na]
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) ~[na:na]
at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:209) ~[vaadin-spring-16.0.1.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4714) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5172) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:829) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486) ~[tomcat-embed-core-9.0.46.jar:9.0.46]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:123) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at net.cbsolution.chameleon.ChameleonApplication.main(ChameleonApplication.java:10) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
Caused by: com.vaadin.flow.server.InvalidApplicationConfigurationException:
Found app shell configuration annotations in non `AppShellConfigurator` classes.
Please create a custom class implementing `AppShellConfigurator` and move the following annotations to it:
- @Push from net.cbsolution.chameleon.ui.views.AlertView
at com.vaadin.flow.server.startup.VaadinAppShellInitializer.init(VaadinAppShellInitializer.java:157) ~[flow-server-6.0.8.jar:6.0.8]
at com.vaadin.flow.server.startup.VaadinAppShellInitializer.init(VaadinAppShellInitializer.java:94) ~[flow-server-6.0.8.jar:6.0.8]
at com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener.failFastContextInitialized(VaadinServletContextInitializer.java:550) ~[vaadin-spring-16.0.1.jar:na]
at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:188) ~[vaadin-spring-16.0.1.jar:na]
... 47 common frames omitted
2021-06-20 18:59:25.848 ERROR 33309 --- [ restartedMain] o.apache.catalina.core.StandardContext : One or more listeners failed to start. Full details will be found in the appropriate container log file
2021-06-20 18:59:25.849 ERROR 33309 --- [ restartedMain] o.apache.catalina.core.StandardContext : Context [] startup failed due to previous errors
2021-06-20 18:59:25.852 WARN 33309 --- [ restartedMain] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@16/jdk.internal.misc.Unsafe.park(Native Method)
java.base@16/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
java.base@16/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1661)
java.base@16/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
java.base@16/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
java.base@16/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1056)
java.base@16/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1116)
java.base@16/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
java.base@16/java.lang.Thread.run(Thread.java:831)
2021-06-20 18:59:25.853 WARN 33309 --- [ restartedMain] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [HikariPool-1 connection adder] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@16/java.lang.String.equals(String.java:1027)
java.base@16/sun.security.ssl.CipherSuite.nameOf(CipherSuite.java:898)
java.base@16/sun.security.ssl.SSLAlgorithmDecomposer.decompose(SSLAlgorithmDecomposer.java:262)
java.base@16/sun.security.util.AbstractAlgorithmConstraints.checkAlgorithm(AbstractAlgorithmConstraints.java:99)
java.base@16/sun.security.util.DisabledAlgorithmConstraints.permits(DisabledAlgorithmConstraints.java:140)
java.base@16/sun.security.ssl.SSLAlgorithmConstraints.permits(SSLAlgorithmConstraints.java:164)
java.base@16/sun.security.ssl.SSLAlgorithmConstraints.permits(SSLAlgorithmConstraints.java:154)
java.base@16/sun.security.ssl.HandshakeContext.isActivatable(HandshakeContext.java:550)
java.base@16/sun.security.ssl.HandshakeContext.getActiveCipherSuites(HandshakeContext.java:339)
java.base@16/sun.security.ssl.HandshakeContext.(HandshakeContext.java:185)
java.base@16/sun.security.ssl.ClientHandshakeContext.(ClientHandshakeContext.java:98)
java.base@16/sun.security.ssl.TransportContext.kickstart(TransportContext.java:238)
java.base@16/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:434)
java.base@16/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:412)
app//org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:41)
app//org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:534)
app//org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:149)
app//org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
app//org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
app//org.postgresql.jdbc.PgConnection.(PgConnection.java:223)
app//org.postgresql.Driver.makeConnection(Driver.java:465)
app//org.postgresql.Driver.connect(Driver.java:264)
app//com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
app//com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
app//com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
app//com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
app//com.zaxxer.hikari.pool.HikariPool.access$100(HikariPool.java:71)
app//com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:725)
app//com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:711)
java.base@16/java.util.concurrent.FutureTask.run(FutureTask.java:264)
java.base@16/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
java.base@16/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
java.base@16/java.lang.Thread.run(Thread.java:831)
2021-06-20 18:59:25.870 INFO 33309 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-06-20 18:59:25.872 WARN 33309 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2021-06-20 18:59:25.873 INFO 33309 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-06-20 18:59:25.878 INFO 33309 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-06-20 18:59:25.885 INFO 33309 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-06-20 18:59:25.895 ERROR 33309 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577) ~[spring-context-5.3.8.jar:5.3.8]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:771) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:763) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:438) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:339) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at net.cbsolution.chameleon.ChameleonApplication.main(ChameleonApplication.java:10) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:104) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:450) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:199) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
... 14 common frames omitted
Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.4.7-20210610.075414-42.jar:2.4.7-SNAPSHOT]
... 19 common frames omitted
Process finished with exit code 0
And here is MyAppShellConfigurator:
package net.cbsolution.chameleon;
import com.vaadin.flow.component.page.AppShellConfigurator;
import com.vaadin.flow.component.page.Push;
@Push
public class MyAppShellConfigurator implements AppShellConfigurator {
}
ANSWER
Answered 2021-Jun-22 at 07:45You must add annotation for the "whole" application (which @Push
is) to your central configuration place (which is the class implementing AppShellConfigurator
). As the error states:
Found app shell configuration annotations in non `AppShellConfigurator` classes.
Please create a custom class implementing `AppShellConfigurator` and move the following annotations to it:
- @Push from net.cbsolution.chameleon.ui.views.AlertView
Remove @Push
from net.cbsolution.chameleon.ui.views.AlertView
(as it's already set on your MyAppShellConfigurator
as seen in your code paste).
QUESTION
Is there a possibility to toggleText() for each element of the array separately?
Right now, when clicked, the values are changed for every single element at the same time and I'd like to go over them one by one as they're clicked.
$(function() {
var jap = ["kau", "matsu", "shiru"];
var eng = ["to buy", "to wait", "to know"];
var tds = [$('#td1'), $('#td2'), $('#td3')]
for (i = 0; i < tds.length; i++) {
$(tds[i]).on('click', function(){
for(i = 0; i < tds.length; i++) {
$(tds[i]).toggleText(jap[i], eng[i]);
}
});
}
});
Ideally, I'd like to change the text inside a table cell on each individual click for each array element.
-- edit:
Here's the HTML with the table:
Godan Verbs
V2
Ichidan Verbs
V2
Irregular Verbs
V2
kau
kai-
taberu
tabe-
kuru
ki-
matsu
machi-
miru
mi-
suru
shi-
shiru
shiri-
oshieru
oshie-
kaku
kaki-
neru
ne-
oyogu
oyogi-
kangaeru
kangae-
hanasu
hanashi-
okiru
oki-
shinu
shini-
sakeru
sake-
yomu
yomi-
kotaeru
kotae-
asobu
asobi-
iru
i-
Here's additional meaning of the words I'd like to display:
const jap2en = {"kau":"to buy", "matsu":"to wait", "shiru":"to know", "kaku":"to write", "oyogu":"to swim", "hanasu":"to talk", "shinu":"to die", "yomu":"to read", "asobu":"to play", "taberu": "to eat", "miru": "to look", "oshieru": "to teach", "neru": "to sleep", "kangaeru": "to think", "okiru": "to get up", "sakeru": "to avoid", "kotaeru": "to answer", "iru": "to be/exist", "kuru": "to come", "suru": "to do"};
I also added ids to the tds that are supposed to show the meaning like this for each individual td:
kau
kai-
taberu
// and so on
and changed the js code to this:
const $tds = $("#tb td[id]");
$("#tb").on("click", "td[id]", function() { ... }
However, as I mentioned in the comment, that one fragment changes the structure of the table and makes tds appear in wrong places. This fragment specifically:
$tds.each(function(i) {
$(this).text(jpArr[i])
$(this).data("lang","ja")
})
If removed, the code works but the cells require two clicks to show the meaning.
ANSWER
Answered 2021-May-28 at 11:12You have jQuery - use its power
It is not recommended to loop to add eventListeners in JavaScript, jQuery or not.
const jap2en = {"kau":"to buy", "matsu":"to wait", "shiru":"to know", "kaku":"to write", "oyogu":"to swim", "hanasu":"to talk", "shinu":"to die", "yomu":"to read", "asobu":"to play", "taberu": "to eat", "miru": "to look", "oshieru": "to teach", "neru": "to sleep", "kangaeru": "to think", "okiru": "to get up", "sakeru": "to avoid", "kotaeru": "to answer", "iru": "to be/exist", "kuru": "to come", "suru": "to do"};
const jpArr = Object.keys(jap2en); // just the Japanese keys
const en2jap = Object.fromEntries(Object.entries(jap2en).map(a => a.reverse())); // makes a reverse lookup
$(function() {
const $tds = $("#tb td");
$("#tb").on("click", "td", function() { // delegation
const text = $(this).text();
const lang = $(this).data("lang");
const langArr = lang === "ja" ? jap2en : en2jap;
const langText = langArr[text];
// console.log(text,lang,langText,langArr[text])
if (langText) {
$(this).text(langText);
$(this).data("lang",lang === "ja" ? "en" :"ja" );
}
});
$tds.each(function(i) {
$(this).data("lang","ja")
})
});
td {
border: 1px solid black;
padding: 3px
}
Godan Verbs
V2
Ichidan Verbs
V2
Irregular Verbs
V2
kau
kai-
taberu
tabe-
kuru
ki-
matsu
machi-
miru
mi-
suru
shi-
shiru
shiri-
oshieru
oshie-
kaku
kaki-
neru
ne-
oyogu
oyogi-
kangaeru
kangae-
hanasu
hanashi-
okiru
oki-
shinu
shini-
sakeru
sake-
yomu
yomi-
kotaeru
kotae-
asobu
asobi-
iru
i-
simpler version
const jap = ["kau", "matsu", "shiru"];
const eng = ["to buy", "to wait", "to know"];
$.fn.extend({ // extending jQuery to have a toggleText
toggleText: function(a, b) {
return this.text(this.text() == b ? a : b)
}
});
$(function() {
$("#tb").on("click", "tr", function() { // delegation
const idx = $(this).index();
$(this).find("td").eq(0).toggleText(jap[idx], eng[idx]);
});
});
td {
border: 1px solid black;
padding: 3px
}
Godan Verbs
V2
Ichidan Verbs
V2
Irregular Verbs
V2
kau
kai-
taberu
tabe-
kuru
ki-
matsu
machi-
miru
mi-
suru
shi-
shiru
shiri-
oshieru
oshie-
kaku
kaki-
neru
ne-
oyogu
oyogi-
kangaeru
kangae-
hanasu
hanashi-
okiru
oki-
shinu
shini-
sakeru
sake-
yomu
yomi-
kotaeru
kotae-
asobu
asobi-
iru
i-
QUESTION
I'm using oshi for creating a unique key in my application. I have created a fat jar with maven shaded plugin from the project. The fat jar is working fine without obfuscation. But if I obfuscate the jar using ProGuard, the jar is throwing the following error while trying to run.
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.a.H.h()Ljava/lang/String;
at com.sun.a.H.h(Native Method)
at com.sun.a.H.(Unknown Source)
at com.sun.a.ab.setAlignType(Unknown Source)
at com.sun.a.ab.(Unknown Source)
at com.sun.a.ab.(Unknown Source)
at com.sun.a.ab.(Unknown Source)
at com.sun.a.ab.(Unknown Source)
at com.sun.a.b.d.aJ.(Unknown Source)
at com.sun.a.b.d.X.a(Unknown Source)
at oshi.hardware.platform.windows.WindowsCentralProcessor.initProcessorCounts(Unknown Source)
at oshi.hardware.common.AbstractCentralProcessor.(Unknown Source)
at oshi.hardware.platform.windows.WindowsCentralProcessor.(Unknown Source)
at oshi.hardware.platform.windows.WindowsHardwareAbstractionLayer.createProcessor(Unknown Source)
at oshi.util.Memoizer$1.get(Unknown Source)
at oshi.hardware.common.AbstractHardwareAbstractionLayer.getProcessor(Unknown Source)
at com.pegado.qpguard.f.d.a(Unknown Source)
at com.pegado.qpguard.d.b.(Unknown Source)
at com.pegado.qpguard.editor.Application.main(Unknown Source)
So I have created a proguard.confile to manage obfuscation rules.
-keep public class com.acme.qpguard.editor.Application { *; }
-keep class org.apache.log4j.** { *; }
-keep class oshi.hardware.** { *; }
-keep class oshi.util.** { *; }
-keep class oshi.software.** { *; }
-keep class oshi.SystemInfo { *; }
But this is not helping me. The jar is still throwing java.lang.UnsatisfiedLinkError, caused by oshi. Looking forward for pointers to solve this issue. Thanks in advance.
ANSWER
Answered 2021-May-22 at 05:51I have modified my proguard.conf to:
-dontskipnonpubliclibraryclassmembers
-keepdirectories
-target 1.8
-forceprocessing
-dontoptimize
-allowaccessmodification
#-overloadaggressively
#-keeppackagenames org.**
-keepattributes *Annotation*
-verbose
-keep public class com.acme.qpguard.editor.Application { *; }
-keep class org.apache.logging.log4j.** { *; }
-keepattributes Signature,Annotation
-keep class org.sqlite.** { *; }
-keep class com.sun.** { *; }
-keep class com.google.** { *; }
-keep class oshi.** { *; }
-keep class com.acme.qpguard.logger.LoggerConstants { *; }
-keepclassmembers class com.acme.qpguard.logger.QPLogger {
QPLogger commonLoggerInstance;
}
-keep class com.acme.qpguard.logger.QPLogger { *; }
#
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepattributes SourceFile,LineNumberTable
-dontwarn
# absolutely must keep this commented out for production
# -keepattributes SourceFile,LineNumberTable
This may need further optimization or even corrections but working for me for the time being. Thank you
QUESTION
Im trying to decompile the MCP v1.8.8 on mac but when I run the decompile.sh file I get this error:
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.
If i look in eclipse > Client the folder is empty so i cant do anything
Here is the complete log
codergautam@Coders-Air mcp918 % bash decompile.sh
== MCP 9.18 (data: 9.18, client: 1.8.8, server: 1.8.8) ==
"scalac" is not found on the PATH. Scala files will not be recompiled
# found ff, ff patches, srgs, name csvs, doc csvs, param csvs, astyle, astyle config, rg, ss
Looking in /Users/codergautam/Library/Application Support/minecraft/versions for mc installs... OK
Copying assets... OK
Parsing JSON file... OK
Looking for minecraft main jar... Not found
Copying minecraft main jar... OK
> Checking libraries...
Copying library jinput... OK
Copying library lwjgl-platform... OK
Copying library icu4j-core-mojang... OK
Copying library httpcore... OK
Copying library log4j-api... OK
Copying library commons-lang3... OK
Copying library jna... OK
Copying library libraryjavasound... OK
Copying library jopt-simple... OK
Copying library guava... OK
Copying library oshi-core... OK
Copying library httpclient... OK
Copying library commons-compress... OK
Copying library platform... OK
Copying library codecjorbis... OK
Copying library soundsystem... OK
Copying library librarylwjglopenal... OK
Copying library lwjgl_util... OK
Copying library commons-codec... OK
Copying library jutils... OK
Copying library commons-logging... OK
Copying library lwjgl... OK
Copying library commons-io... OK
Copying library realms... OK
Copying library authlib... OK
Copying library gson... OK
Copying library netty... OK
Copying library twitch... OK
Copying library codecwav... OK
Copying library twitch-platform... OK
Copying library jinput-platform... OK
Copying library log4j-core... OK
Copying library netty-all... OK
> Checking Natives...
Extracting native libtwitchsdk.dylib... OK
Extracting native liblwjgl.dylib... OK
Extracting native libjinput-osx.jnilib... OK
Extracting native openal.dylib... OK
== Decompiling client using fernflower ==
> Creating SRGs
> Applying SpecialSource
> Applying MCInjector
> Creating renamed srg
> Filtering classes
> Decompiling
> Unpacking jar
> Copying sources
> Applying fernflower fixes
> Applying patches
'patch -p1 -u -i ../../temp/temp.patch -d src/minecraft' failed : 1
== ERRORS FOUND ==
1 out of 1 hunk FAILED -- saving rejects to file net/minecraft/util/Cartesian.java.rej
==================
> Cleaning comments
- Done in 111.82 seconds
== Reformating client ==
> Cleaning sources
> Replacing OpenGL constants
> Reformating sources
- Done in 6.95 seconds
== Updating client ==
> Adding javadoc
> Renaming sources
- Done in 1.52 seconds
== Decompiling server using fernflower ==
> Creating SRGs
> Applying SpecialSource
> Applying MCInjector
> Creating renamed srg
> Filtering classes
> Decompiling
> Unpacking jar
> Copying sources
> Applying fernflower fixes
> Applying patches
'patch -p1 -u -i ../../temp/temp.patch -d src/minecraft_server' failed : 1
== ERRORS FOUND ==
1 out of 1 hunk FAILED -- saving rejects to file net/minecraft/util/Cartesian.java.rej
==================
> Cleaning comments
- Done in 51.87 seconds
== Reformating server ==
> Cleaning sources
> Reformating sources
- Done in 4.44 seconds
== Updating server ==
> Adding javadoc
> Renaming sources
- Done in 1.03 seconds
== Recompiling client ==
> Cleaning bin
> Recompiling
'"javac" -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "jars/versions/1.8.8/1.8.8.jar:lib:lib/*:jars/libraries/net/java/jinput/jinput/2.0.5/jinput-2.0.5.jar:jars/libraries/org/lwjgl/lwjgl/lwjgl-platform/2.9.2-nightly-20140822/lwjgl-platform-2.9.2-nightly-20140822-natives-osx.jar:jars/libraries/com/ibm/icu/icu4j-core-mojang/51.2/icu4j-core-mojang-51.2.jar:jars/libraries/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar:jars/libraries/org/apache/logging/log4j/log4j-api/2.0-beta9/log4j-api-2.0-beta9.jar:jars/libraries/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar:jars/libraries/net/java/dev/jna/jna/3.4.0/jna-3.4.0.jar:jars/libraries/com/paulscode/libraryjavasound/20101123/libraryjavasound-20101123.jar:jars/libraries/net/sf/jopt-simple/jopt-simple/4.6/jopt-simple-4.6.jar:jars/libraries/com/google/guava/guava/17.0/guava-17.0.jar:jars/libraries/oshi-project/oshi-core/1.1/oshi-core-1.1.jar:jars/libraries/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar:jars/libraries/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar:jars/libraries/net/java/dev/jna/platform/3.4.0/platform-3.4.0.jar:jars/libraries/com/paulscode/codecjorbis/20101023/codecjorbis-20101023.jar:jars/libraries/com/paulscode/soundsystem/20120107/soundsystem-20120107.jar:jars/libraries/com/paulscode/librarylwjglopenal/20100824/librarylwjglopenal-20100824.jar:jars/libraries/org/lwjgl/lwjgl/lwjgl_util/2.9.2-nightly-20140822/lwjgl_util-2.9.2-nightly-20140822.jar:jars/libraries/commons-codec/commons-codec/1.9/commons-codec-1.9.jar:jars/libraries/net/java/jutils/jutils/1.0.0/jutils-1.0.0.jar:jars/libraries/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar:jars/libraries/org/lwjgl/lwjgl/lwjgl/2.9.2-nightly-20140822/lwjgl-2.9.2-nightly-20140822.jar:jars/libraries/commons-io/commons-io/2.4/commons-io-2.4.jar:jars/libraries/com/mojang/realms/1.7.39/realms-1.7.39.jar:jars/libraries/com/mojang/authlib/1.5.21/authlib-1.5.21.jar:jars/libraries/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar:jars/libraries/com/mojang/netty/1.6/netty-1.6.jar:jars/libraries/tv/twitch/twitch/6.5/twitch-6.5.jar:jars/libraries/com/paulscode/codecwav/20101023/codecwav-20101023.jar:jars/libraries/tv/twitch/twitch-platform/6.5/twitch-platform-6.5-natives-osx.jar:jars/libraries/net/java/jinput/jinput-platform/2.0.5/jinput-platform-2.0.5-natives-osx.jar:jars/libraries/org/apache/logging/log4j/log4j-core/2.0-beta9/log4j-core-2.0-beta9.jar:jars/libraries/io/netty/netty-all/4.0.23.Final/netty-all-4.0.23.Final.jar" -sourcepath src/minecraft -d bin/minecraft @temp/java_src_client.txt' failed : 2
== ERRORS FOUND in JAVA CODE ==
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.
==================
Initial client recompile failed, correct source then run updatemd5
== Recompiling server ==
> Cleaning bin
> Recompiling
'"javac" -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "lib:lib/*:jars/minecraft_server.jar" -sourcepath src/minecraft_server -d bin/minecraft_server @temp/java_src_server.txt' failed : 2
== ERRORS FOUND in JAVA CODE ==
error: Source option 6 is no longer supported. Use 7 or later.
error: Target option 6 is no longer supported. Use 7 or later.
==================
Initial server recompile failed, correct source then run updatemd5
codergautam@Coders-Air mcp918 %
ANSWER
Answered 2021-Apr-13 at 14:07Turns out the decompiled code was in the src folder
Dragging the contents from that into the Client folder worked
I have no idea why it didn't decompile into the Eclipse folder
QUESTION
The number of np.where()
's I would assume is the issue since removing 1 will allow the function to work. I'm not aware of another way to edit a name other than an if else
. I figured this would be faster. Mapping comes to mind as well, but I'm not sure how to return the names that are not changed. Any help understanding the best practice for this desired outcome would be very much appreciated!
# Takes names from various dataframes and websites and makes one name outcome
#
def player_name_filter(name):
name = name.str.title().str.replace('.', ' ', regex=True).str.strip()
name = np.where(name=='A J Greer','A.J. Greer',
np.where(name=='Alexis Lafreni?Re','Alexis Lafreniere',
np.where(name=='Alexis Lafrenière','Alexis Lafreniere',
np.where(name=='Alexandre Carrier', 'Alex Carrier',
np.where(name=='Alexander Burmistrov', 'Alex Burmistrov',
np.where(name=='Alexander Petrovic', 'Alex Petrovic',
np.where(name=='Alexander Edler', 'Alex Edler',
np.where(name=='Alexander Kerfoot', 'Alex Kerfoot',
np.where(name=='Alexander Nylander', 'Alex Nylander',
np.where(name=='Alexander Radulov', 'Alex Radulov',
np.where(name=='Alexander Steen', 'Alex Steen',
np.where(name=='Alexandre Texier', 'Alex Texier',
np.where(name=='Alexander Volkov', 'Alex Volkov',
np.where(name=='Alexander Wennberg', 'Alex Wennberg',
np.where(name=='Aaron Volpatt', 'Aaron Volpatti',
np.where(name=='Adam Cracknel', 'Adam Cracknell',
np.where(name=='Anze Kopitar', 'GOAT',
np.where(name=='B J Crombeen', 'B.J. Crombeen',
np.where(name=='C J Smith', 'C.J. Smith',
np.where(name=='Christopher Tanev', 'Chris Tanev',
np.where(name=='Colin White', 'Colin White2',
np.where(name=='Charlie Mcavoy', 'Charlie McAvoy',
np.where(name=='Casey Desmith', 'Casey DeSmith',
np.where(name=='Cal Petersen', 'Calvin Petersen',
np.where(name=='Calvin De Haan', 'Calvin de Haan',
np.where(name=='Cj Suess', 'C.J. Suess',
np.where(name=='Dj King', 'D.J. King',
np.where(name=='Erik Gustafsson', 'Erik Gustafsson2',
np.where(name=='Evgenii Dadonov', 'Evgeny Dadonov',
np.where(name=='Jake McCabe', 'Jake McCabe',
np.where(name=='Jacob Macdonald', 'Jacob MacDonald',
np.where(name=='Jacob de la Rose', 'Jacob De La Rose',
np.where(name=='Jean-Francois Berube', 'J-F Berube',
np.where(name=='Joseph Labate', 'Joseph LaBate',
np.where(name=='J T Brown', 'J.T. Brown',
np.where(name=='J T Compher', 'J.T. Compher',
np.where(name=='J C Beaudin', 'J.C. Beaudin',
np.where(name=='J T Miller', 'J.T. Miller',
np.where(name=='Jc Lipon', 'J.C. Lipon',
np.where(name=='Jt Wyman', 'J.T. Wyman',
np.where(name=='Martin St Louis', 'Martin St. Louis',
np.where(name=='Matthew Benning', 'Matt Benning',
np.where(name=='Maxime Comtois', 'Max Comtois',
np.where(name=='Max VÃf©ronneau', 'Max Veronneau',
np.where(name=='Max Lajoie', 'Maxime Lajoie',
np.where(name=='Michael Matheson', 'Mike Matheson',
np.where(name=='Mikhail Vorobyov', 'Mikhail Vorobyev',
np.where(name=='Mitchell Marner', 'Mitch Marner',
np.where(name=='Nicholas Caamano', 'Nick Caamano',
np.where(name=='Nicholas Suzuki', 'Nick Suzuki',
np.where(name=='P A Parenteau', 'P.A. Parenteau',
np.where(name=='P J Axelsson', 'P.J. Axelsson',
np.where(name=='P K Subban', 'P.K. Subban',
np.where(name=='R J Umberger', 'R.J. Umberger',
np.where(name=='Samuel Blais', 'Sammy Blais',
np.where(name=='Steve Santini', 'Steven Santini',
np.where(name=='Theodor Blueger', 'Teddy Blueger',
np.where(name=='Tim Gettinger', 'Timothy Gettinger',
np.where(name=='Tj Brodie', 'T.J. Brodie',
np.where(name=='Tj Brennan', 'T.J. Brennan',
np.where(name=='T J Brennan', 'T.J. Brennan',
np.where(name=='Tj Tynan', 'T.J. Tynan',
np.where(name=='T J Galiardi', 'T.J. Galiardi',
np.where(name=='T J Hensick', 'T.J. Hensick',
np.where(name=='T J Oshie', 'T.J. Oshie',
np.where(name=='Tony Deangelo', 'Tony DeAngelo',
np.where(name=='Anthony Deangelo', 'Tony DeAngelo',
np.where(name=='Vincent Hinostroza', 'Vinnie Hinostroza',
np.where(name=='Vitali Abramov', 'Vitaly Abramov',
np.where(name=="Logan O'Connor", "Logan O'Connor",
np.where(name=='Kurtis MacDermid', 'Kurtis MacDermid',
np.where(name=='Zachary Senyshyn', 'Zach Senyshyn',
np.where(name=='Christopher DiDomenico', 'Chris DiDomenico',
np.where(name=='Michael Cammalleri', 'Mike Cammalleri',
np.where(name=='Nicholas Shore', 'Nick Shore',
np.where(name=='Pat Maroon', 'Patrick Maroon',
np.where(name=='Ryan Macinnis', 'Ryan MacInnis',
np.where(name=='Tony Deangelo', 'Tony DeAngelo',
np.where(name=='Mackenzie Maceachern', 'Mackenzie MacEachern',
np.where(name=='Alex Debrincat', 'Alex DeBrincat',
np.where(name=='Samuel Montembeault', 'Sam Montembeault',
np.where(name=='Danny Taylor', 'Daniel Taylor',
np.where(name=='Pierre-Alexandr Parenteau', 'PA Parenteau',
np.where(name=='Christian Wolanin', 'Christian Wolanin',
np.where(name=="Dylan Sikura ", "Dylan Sikura",
np.where(name=='Troy Terry ', 'Troy Terry',
np.where(name=='Viktor Antipin', 'Victor Antipin',
np.where(name=='Zach Aston-reese', 'Zach Aston-Reese',
np.where(name=='Max Lagace', 'Maxime Lagace',
name)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))
return name
ANSWER
Answered 2021-Mar-20 at 12:48When you are dealing with more than two choices, use np.select
.
conditions = [df['name'] == 'A J Greer', df['name'] == 'Alexis Lafrenière', ...]
choices = ['A.J. Greer', 'Alexis Lafreniere', ...]
df.select(conditions, choices, default = df.name)
You can also use dictionary as a lookup table
name_table = {
'A J Greer': 'A.J. Greer',
'Alexis Lafrenière': 'Alexis Lafreniere',
'B J Crombeen': 'B.J. Crombeen',
# and so on
}
df['name'].str.title().apply(lambda x: name_table.get(x, x))
# or
def player_name_filter(dataf , column_name):
dataf[column_name] = dataf[column_name].str.title().map(name_table)
return dataf
df = df.pipe(player_name_filter, column_name='name')
# problem NaN for players not in the tables
QUESTION
I am attempting to set up continuous integration testing for my open source project on a remote AIX server. I can execute tests just fine in an interactive shell:
$ ssh gate.polarhome.com -p 775 -l oshi
$ echo $PATH
> /usr/java8_64/bin:~/apache-maven-3.6.3/bin/:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.
$ cd ~/git/oshi
$ mvn test -B
When executing in this interactive environment using exactly these steps, the test executes properly. However, when attempting to execute the identical commands via an SSH command line, the JaCoCo plugin fails:
$ ssh gate.polarhome.com -p 775 -l oshi "export PATH=/usr/java8_64/bin:~/apache-maven-3.6.3/bin/:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.; cd ~/git/oshi; mvn test -B"
After entering password, the commands proceed through the mvn test
but then fail with an exception:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Operating System and Hardware Information [pom]
[INFO] oshi-core [jar]
[INFO] oshi-core-shaded [jar]
[INFO] oshi-demo [jar]
[INFO] oshi-dist [pom]
[INFO]
[INFO] --------------------< com.github.oshi:oshi-parent >---------------------
[INFO] Building Operating System and Hardware Information 5.3.7-SNAPSHOT [1/5]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- git-commit-id-plugin:4.0.3:revision (git-commit-id) @ oshi-parent ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.2.0:parse-version (default) @ oshi-parent ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven) @ oshi-parent ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:prepare-agent (pre-unit-test) @ oshi-parent ---
[WARNING] Error injecting: org.jacoco.maven.AgentMojo
java.lang.NoClassDefFoundError: org.jacoco.core.runtime.AgentOptions
at java.lang.Class.getDeclaredMethodsImpl (Native Method)
at java.lang.Class.getDeclaredMethods (Class.java:1008)
at com.google.inject.spi.InjectionPoint.getDeclaredMethods (InjectionPoint.java:766)
at com.google.inject.spi.InjectionPoint.getInjectionPoints (InjectionPoint.java:683)
at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields (InjectionPoint.java:378)
at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies (ConstructorBindingImpl.java:182)
at com.google.inject.internal.InjectorImpl.getInternalDependencies (InjectorImpl.java:661)
at com.google.inject.internal.InjectorImpl.cleanup (InjectorImpl.java:617)
at com.google.inject.internal.InjectorImpl.initializeJitBinding (InjectorImpl.java:603)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding (InjectorImpl.java:932)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive (InjectorImpl.java:852)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding (InjectorImpl.java:291)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow (InjectorImpl.java:222)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow (InjectorImpl.java:1040)
at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1071)
at com.google.inject.internal.InjectorImpl.getProvider (InjectorImpl.java:1034)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57)
at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127)
at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66)
at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050)
at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke (Method.java:508)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
(Full log available here)
Using the -X
switch on maven, the log line immediately preceding the error is:
[DEBUG] Configuring mojo org.jacoco:jacoco-maven-plugin:0.8.6:prepare-agent from plugin realm ClassRealm[plugin>org.jacoco:jacoco
I have searched StackOverflow for similar issues. The closest I found was this question with similar symptoms, but associated with a Jenkins versioning problem.
I've tried various other attempts at solutions:
- Deleted the
.m2/repository
and let it rebuild - Added
clean
to the maven commands - Attempted to skip JaCoCo using
jacoco.skip=true
I'm pretty sure the issue has to do with the "injection" involved with JaCoCo, but can't figure out how to bypass, skip, or further investigate problems with this.
I'm at a loss for a next troubleshooting step. What is different about an interactive ssh enviornment vs. ssh
command-line that would cause different behavior from the jacoco-maven-plugin?
ANSWER
Answered 2020-Dec-12 at 07:09It turns out that there was one setting in my interactive .profile
that was key to resolving this:
ulimit -n 8192
Seems rather than trying to copy path and other things over, just using source .profile
would have saved me a lot of troubleshooting time.
QUESTION
I'm making a website that I wanted to be a white page that you could stamp to make another image appear under. So when you click, you make a holepunch. Like this exemple :
So I managed to have a randomized image in the background as I click which is fine for what I want, and to be able to .append()
the holepunches. But I don't know how to do the mask thing I've been digging online for a few things and help, and managed to make it work in certain cases but not that one...
It should be like that (I guess) :
- image in the background
- white shape in front
- the star shape is making a holepunch in the white shape
For now, the only thing I managed to do is to have the picture besides a bigger holepunch (which is my original img) but when I click it doesn't make any holepunch, it justs add the stamp.
Here is the code :
var images = ["https://icatcare.org/app/uploads/2018/07/Thinking-of-getting-a-cat.png", "https://ichef.bbci.co.uk/news/1024/cpsprodpb/151AB/production/_111434468_gettyimages-1143489763.jpg"];
$(document.body).click(function(c) {
var tw = 100 / 2;
var th = 30 / 2;
var x = Math.floor((Math.random() * images.length));
document.getElementById('random').src = images[x];
$("#random").css({
position: 'absolute',
display: "block",
left: 0,
top: 0
});
var tw = 50 / 2;
var th = tw;
$('#holepunch:last').clone().appendTo(this).css({
position: 'absolute',
display: "block",
left: c.pageX - tw - $(this).position().left,
top: c.pageY - th + $(this).scrollTop()
});
});
body{
background: lightgrey;
width: 100vw;
height: 100vh;
z-index: 1;
opacity: 1;
}
.fauxbody{
z-index: 100;
position: fixed;
width: 100vw;
height: 100vh;
background-color: white;
top: 0;
left: 0;
-webkit-mask:
-moz-element(#holepunch) 1vw 1vh no-repeat,
linear-gradient(#fff 0 0);
mask-composite:exclude;
}
#random{
z-index: -100;
width: 100vw;
height: auto;
}
#holepunch{
width: 50px;
height: auto;
}
ANSWER
Answered 2020-Dec-06 at 14:32I would try to use canvas with white background and add a mouseclick event listener, which cuts out the canvas. I found another question on stack overflow what may can help you:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install oshi
You can use oshi like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the oshi component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page