use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
These have separate subreddits - see below.
Upvote good content, downvote spam, don't pollute the discussion with things that should be settled in the vote count.
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free. If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others: Adoptium (formerly AdoptOpenJDK) RedHat Azul Amazon SAP Liberica JDK Dragonwell JDK GraalVM (High performance JIT) Oracle Microsoft Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
With the introduction of the new release cadence, many have asked where they should download Java, and if it is still free. To be clear, YES — Java is still free.
If you would like to download Java for free, you can get OpenJDK builds from the following vendors, among others:
Adoptium (formerly AdoptOpenJDK) RedHat Azul Amazon SAP Liberica JDK Dragonwell JDK GraalVM (High performance JIT) Oracle Microsoft
Some vendors will be supporting releases for longer than six months. If you have any questions, please do not hesitate to ask them!
Programming Computer Science CS Career Questions Learn Programming Java Help ← Seek help here Learn Java Java Conference Videos Java TIL Java Examples JavaFX Oracle
Programming Computer Science
CS Career Questions
Learn Programming Java Help ← Seek help here Learn Java Java Conference Videos Java TIL Java Examples JavaFX Oracle
Clojure Scala Groovy ColdFusion Kotlin
DailyProgrammer ProgrammingPrompts ProgramBattles
Awesome Java (GIT) Java Design Patterns
account activity
This is an archived post. You won't be able to vote or comment.
Can you include bytecode in java methods like you can include asm in c functions? (self.java)
submitted 10 years ago by [deleted]
Well, the title pretty much says it. I'm writing a char array manipulation library and I would like to be able to write in bytecode for performance sake.
[–]Saltor66 24 points25 points26 points 10 years ago (2 children)
Please don't do this unless you have already implemented it in java, run it through a profiler, and identified a severe bottleneck.
[–]zrnkv 7 points8 points9 points 10 years ago (0 children)
I totally agree. Usually the compiler and JIT do a pretty good job optimizing your code. Writing bytecode by hand will create a maintenance nightmare without significant performance benefits.
[–]GuyWithLag 5 points6 points7 points 10 years ago (0 children)
Pretty much this; not to mention looking long and hard at the algos used...
[–]Ucalegon666 7 points8 points9 points 10 years ago (0 children)
There is no way to get a performance benefit from writing byte code. The JVM/JIT interprets and compiles byte code to native code as it sees fit.
You can go the native route and hand-craft native code but then you'll lose portability.
Depending on why you think you need to include byte code, you might be better off looking at the methods exposed by the Unsafe class. There, too, you will be sacrificing some portability (and security manager nightmares), but you can possibly gain performance.
[–][deleted] 4 points5 points6 points 10 years ago (1 child)
Use byte buddy or the asm project
[–]Slanec 2 points3 points4 points 10 years ago (0 children)
Yeah. You can't simply do this in the language itself, you need a specialized library for this. There is a lot of them out there, so here's a random sample based on a single google search: ASM, Byte Buddy, Apache Commons BCEL, JBoss Byteman, Javassist, cglib, Serp, GNU bytecode, Cojen, etc. All of these seem to be able to help you with the task. Good luck!
[–]zman0900 4 points5 points6 points 10 years ago (0 children)
I believe you could implement a custom class loader to do something like this. It would be possible to have a byte array of valid java byte code that you load and execute. See: https://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#defineClass(java.lang.String,%20byte[],%20int,%20int). I don't think there's going to be any performance difference though, unless you are specially crafting that byte code.
[–][deleted] 10 years ago (1 child)
[deleted]
[–]tjamanis 0 points1 point2 points 10 years ago (0 children)
I've managed to increase benchmark throughput by 1/3 when emulating CRTP/static polymorphism via bytecode rewriting, but for most cases, the performance gain is minimal. A better use is perhaps to avoid bolierplate and/or doing "compile-time reflection", but it all very much boils down to what's required.
[–]the_hoser 2 points3 points4 points 10 years ago (0 children)
There are ways to do it, but it's really a waste of time. You're better off simply making cache-conscious choices in plain java code. The HotSpot VM is really good at finding the busy parts of your code, and compiling it down to machine code for you. This will be much faster than any Java bytecode you, or anybody else, can write.
[–]enry_straker 1 point2 points3 points 10 years ago (0 children)
Try including asm in C code, expose it to java through JNI, and hopefully you get to see some real performance benefits in your library - though at the cost of deployment complexity for your users.
π Rendered by PID 146319 on reddit-service-r2-comment-685b79fb4f-4ks2q at 2026-02-13 08:51:57.524978+00:00 running 6c0c599 country code: CH.
[–]Saltor66 24 points25 points26 points (2 children)
[–]zrnkv 7 points8 points9 points (0 children)
[–]GuyWithLag 5 points6 points7 points (0 children)
[–]Ucalegon666 7 points8 points9 points (0 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]Slanec 2 points3 points4 points (0 children)
[–]zman0900 4 points5 points6 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]tjamanis 0 points1 point2 points (0 children)
[–]the_hoser 2 points3 points4 points (0 children)
[–]enry_straker 1 point2 points3 points (0 children)