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 5 years have passed since last update.

Javaをコマンドプロンプト上でコンパイルする

Posted at

windowsのコマンドプロンプト上でjavaのコンパイル・実行をする機会があり、苦戦したのでまとめました。

javac ... javaのコンパイルコマンド
①cdで、まずコンパイルしたいjavaファイルのある場所へ移動する。
②コンパイル
//パッケージのないクラスの場合
javac Test.java

//パッケージのあるクラスの場合
javac pacakage.Test.java

//jarのライブラリを参照してコンパイルしたい場合
※jarの指定時は、フルパスで
javac -classpath C¥test.jar; pacakage.Test.java

//コンパイルしたclassファイルの出力先変更をしたい場合
※javaファイル指定の前に、-dで出力先を指定する、
javac -classpath C¥test.jar; -d C¥local¥classes pacakage.Test.java
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?