Modules Flashcards

1
Q

Nemodularni java: prikaz pro kompilaci
* zdroje jsou v src
* knihovny lib/x.jar, lib/y.jar
* potrebuji resources
* vystup (classes) do out

A

java -cp resources:lib/x.jar:lib/y.jar -d out –source-path src

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Prikaz pro spusteni jaru x.jar

A

java -jar x.jar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Prikaz pro zabaleni trid do jaru
* zkompilovane tridy jsou v out
* nazev bude x.jar
* mam manifest file

A

jar -c -f x.jar -C out -m=META-INF/MANIFEST.MF .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Jak se muzu dostat k metodam a fieldum tridy, kam nemam prava?

A

Pomoci reflexe
Class c = Class.forName(“pkg.MyClass”);
c.getMethods()
c.getFields()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Jak zjistim obsah modulu

A

java –list-module my.module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Modularni java: prikaz pro kompilaci
* vystup do out
* zdroje na src
* zavisim na modulu lib/z.jar

A

javac –module-path lib/z.jar -d out -sourcepath src

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

vytvoreni jaru x.jar pro modul
* classes jsou v out
* main class je pkg.MainClass

A

jar –create -f x.jar -C out –main-class pkg.MainClass .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

popis modulu

A

java –module-path x.jar –describe-module my.module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Spusteni modulu v x.jar

A

java -jar x.jar

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Spusteni pkg.MainClass s argumenty v modulu my.module v out

A

java -p out -m my.module/pkg.MainClass args

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Jak se vola nemodularni aplikace, ktera potrebuje modul x.jar?

A

java -cp someApp.jar:x.jar pkg.MainClass

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Jak se v nemodularni aplikaci projevi modul?

A

Bude tam jako unnamed module, neboli automatic module

How well did you know this?
1
Not at all
2
3
4
5
Perfectly