简体   繁体   English

如何知道使用Eclipse编译时传递的命令

[英]How to know the commands being passed when compiling with eclipse

I am new to Java programming, especially with eclipse. 我是Java编程的新手,尤其是eclipse。 I would really like to know how the java programs are actually getting compiled, it would help me in knowing the Java command line interface better. 我真的很想知道Java程序实际上是如何编译的,这将有助于我更好地了解Java命令行界面。 So, I want to know if there is a way to know exactly which commands are being sent along with the switches to compile and run the java program? 因此,我想知道是否有一种方法可以确切地知道正在发送哪些命令以及用于编译和运行java程序的开关

I am sure that you are taking up a J2SE edition of Java programming which should be a fundamental to you. 我确定您正在使用Java编程的J2SE版,这对您来说是一个基础。 Let me start with giving you an glimpse of a Java Program: 首先让我简要介绍一下Java程序:

class Greetings
{
public static void main(String args[])
{
     System.out.println("The first character of the command line " + args[0]);
}}

So let's go thru what I meant by each line. 因此,让我们仔细研究每行的含义。

  • The class indicates beginning of the class which would contain all of the methods to be into. 该类指示该类的开始,该类将包含所有要使用的方法。
  • The "public static void main" indicates the main method which would contain the method to be executed. “ public static void main”表示将包含要执行的方法的main方法。
  • And the characters found in the brackets of the only method is known as parameters. 在唯一方法的方括号中找到的字符称为参数。
  • Those parameters are passed from the command line to the program where they could be worked on depending on the program. 这些参数从命令行传递到程序,在此可以根据程序对其进行处理。

And with this, let me advise you to take up a read on this page for more on Java (J2SE). 因此,我建议您阅读本页上的内容,以获取有关Java(J2SE)的更多信息。

http://www.w3resource.com/java-tutorial/java-program-structure.php http://www.w3resource.com/java-tutorial/java-program-structure.php

Happy Coding! 编码愉快!

Unless there are some Eclipse logs that track that (check your installation folder), I doubt Eclipse shows it to you through the IDE. 除非有一些Eclipse日志跟踪该日志(检查您的安装文件夹),否则我怀疑Eclipse将通过IDE向您显示该日志。 Compiling and running java mostly comes down to two commands: 编译和运行Java主要归结为两个命令:

javac javac

You compile by executing 您通过执行编译

javac -cp <your classpath/libs> <your source folder>

java 爪哇

You run your program by executing 您通过执行来运行程序

java -cp <classpath> <Class with main method> <main method arguments>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM