LoginSignup
1
1

More than 1 year has passed since last update.

プログラムの引数とVM引数って何?

Last updated at Posted at 2021-07-09

Eclipseの実行構成画面でコマンドライン引数の設定やってみた。
プログラムの引数にコマンドライン引数にしたいものを記入。
VM引数はJava 仮想マシン (JVM) の振る舞いを変更する値。例えば以下の様な設定値が入る。

-classpath(あるいは-cp):クラスパスの指定
-D:プロパティの定義
-Xmx:ヒープ領域の最大サイズの指定

適当に入力してみる・・・
スクリーンショット 2021-07-09 9.54.29.png

コンソールにarg[0]〜arg[3]で出力

arg[0]:山田
arg[1]:太郎
arg[2]:伊藤
arg[3]:佐藤
1
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
1
1