0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Javaのコンパイル

Posted at

Mavenを使用してjarファイルを作成する際の調べたことをまとめる。

1.Maven

1-1.build設定

pom.xml
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
				<configuration>
					<source>8</source>
					<target>8</target>
				</configuration>
			</plugin>

1-2.jar内のMANIFEST

1-1の設定で作成されたjarファイルのMANIFESTファイルは以下。

MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.6.3
Built-By: けろ
Build-Jdk: 11.0.7

Build-Jdkの値はどこから取得している?
Built-ByはWindows OSのログインユーザ名と同じ。

1-3.

2.Maven以外

2-1.jarファイルのjavaバージョン確認

jarファイルはただの圧縮ファイル。その中のクラスファイルを調べる必要がある。

以下のコマンドで確認できる。

javap -v クラスファイル.class | find "major"

2-1-1.majorバージョンとJDKのバージョン

45 = Java 1.1
46 = Java 1.2
47 = Java 1.3
48 = Java 1.4
49 = Java 5
50 = Java 6
51 = Java 7
52 = Java 8
53 = Java 9
54 = Java 10
55 = Java 11
56 = Java 12
57 = Java 13
58 = Java 14
https://en.wikipedia.org/wiki/Java_class_file#General_layout

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?