Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
"javac -source 10 -target 10" - Lower Java Version
How to lower the Java version in the bytecode? I want to generate class files for an older Java environment.
✍: FYIcenter
If you want generate class files for an older Java environment,
you need to use "-source x" and "-target x" options
in the "javac" command to compile the Java source code.
1. Check the default version of Java compiler:
> javac -version javac 15
2. Compile HelloWorldFrame.java used in the last tutorial into a bytecode file with the default version:
> javac HelloWorldFrame.java
3. Check the version of the bytecode. Bytecode major version 59 maps to Java 15.
> javap -v HelloWorldFrame.class | grep "major version" major version: 59
4. Compile HelloWorldFrame.java again for Java 10:
> javac -source 10 -target 10 HelloWorldFrame.java warning: [options] system modules path not set in conjunction with -source 10 1 warning
5. Check the version of the bytecode again. Bytecode major version 54 maps to Java 10.
> javap -v HelloWorldFrame.class | grep major major version: 54
This bytecode can be executed in Java 10 environment.
⇒ "javap jar:file:" - Specify Bytecode in JAR
2021-09-09, 1262🔥, 0💬
Popular Posts:
What Is javamail1_1_3.zip? javamail1_1_3.zip is the binary package of JavaMail API 1.1.3 in ZIP form...
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...
HttpComponents Client Source Code Files are provided in the source package file, httpcomponents-clie...
What Is mail.jar of JavaMail 1.4? I got the JAR file from javamail-1_4.zip. mail.jar in javamail-1_4...
What Is commons-codec-1.4.jar? commons-codec-1.4.jar is the JAR file for Apache Commons Codec 1.4, w...