[In-house study session] Java basics-execution without using IDE- (2017/07/06)

0. Introduction


Target person etc.

Target person

Prerequisite knowledge

What i want to tell


Reference books

Java本格入門.jpg "Introduction to Java -From the basics of modern style to object-oriented and practical libraries "Technical Review Co., Ltd.


table of contents

  1. Java overview
  2. Execute Java with commands without using IDE

1. Java overview


Java features

A programming language announced by Sun Microsystem in 1995.


Diagram of Java Virtual Machine (JVM)

JVMのスライド.jpg


Java 3 editions


Java environment


Java conceptual diagram

JREとJDK.PNG


2. Execute Java with commands without using IDE


Purpose of trying with commands without using IDE


Advance preparation


Compile and execute with [Try] command

javac sample\Hello.java

sample/Hello.java


package sample;
/** Print Hello World */
public class Hello {
	public static void main(String[] args) {
		System.out.println("Hello");
	}
}
java sample.Hello 
REM ⇒ "Hello"

Java class file

A Java class file is a file (with a .class extension) that contains Java bytecode that can be executed on the Java Virtual Machine (JVM).

[Try] Disassemble with javap command

javap -verbose sample\Hello

3. Java basic terms


Classpath

It needs to be set to refer to an external library (jar file, etc.).

The classpath is the path that the Java Runtime Environment (JRE) searches for classes and other resource files.

The class search path (class path) can be set with the -classpath option (the recommended method) when calling the JDK tools, or by setting the CLASSPATH environment variable. The -classpath option is recommended because it can be set individually for each application so that it does not affect other applications or change this value.


jar file

Abbreviation for ** J ** ava ** AR ** chive.

The> jar command is a general purpose archiving and compression tool based on the ZIP and ZLIB compression formats. However, the main purpose of the jar command is to package several Java applets and applications into a single archive.

Oracle Reference jar

[Try] Change the extension of the jar file to "zip" and confirm that it can be unzipped. [Try] Extract the jar file with the jar command.

REM -x:Deployment, -v:Detailed information output, -f:File name specification
jar -xvf sample.jar

[Supplement] Manifest file

In the jar file, there is a manifest file called META-INF / MANIFEST.MF.

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: 1.5.0_22 (Sun Microsystems Inc.)
Built-By: hen
Build-Jdk: 1.5.0_22
Implementation-Title: Commons Lang
Implementation-Vendor: The Apache Software Foundation
Implementation-Vendor-Id: org.apache
Implementation-Version: 3.0

~ Omitted below ~

The manifest file describes the version and the tools used to create the jar file.


Java command options

Part of the Java Options category.


Java options I've used


appendix


Java EE


Java version

How to check the Java command version.

 java -version
 ⇒ java version "1.8.0_131"

Updates will be available on a regular basis at Oracle. When an update occurs, the version string will also include the updated version number. In other words, in JDK 8 update 5 (JDK 8u5), the version string will be "1.8.0_5".


Java environment variables

Applications that use Java (such as Tomcat) may set environment variables such as JAVA_HOME and JAVA_OPTS.

Recommended Posts

[In-house study session] Java basics-execution without using IDE- (2017/07/06)
[In-house study session] Java exception handling (2017/04/26)
Summary of in-house newcomer study session [Java]
[In-house study session] Java basics-Lambda expression and Stream API- (2017/07/13)
[In-house study session] Basics of Java annotation (2017/11/02) ~ Under construction ~
I want to build Java Applet without using an IDE
[Study session memo] Java Day Tokyo 2017
[Java] Express Enum type without using Enum (enumeration) type
Map without using an array in java
Study Java Try using Scanner or Map
[In-house study session] Introduction of "Readable Code"
Study session memo: Kansai Java Engineers Association 8/5 --Selenium
Let's study Java
2017 IDE for Java
[Java] Study notes
Java 8 study (repeatable)
Java study memorandum
Java session scope
Study Java Silver 1
I want to use Java Applet easily on the command line without using an IDE