在Linux下JAVA路径问题及命令行编译运行基础

时间:2022-12-01 14:30:18

原因:

有看见许多高手都是直接用vim编辑文件,命令行编译运行,觉得那样不是反而更繁琐?

转折点是在前几天本科毕设题目选定之后。毕设题是一个基于java 字节码的类关系动态分析。需要对.class文件中字节码进行更改(具体的说是在许多指令后加入做标记的新指令,以实现动态跟踪的目的)。

我发现,eclipse根本无法如此灵活,他无法直接装载运行一个我修改过的.class文件。它是照顾大多数的一般情况。它为我们做了很多事情:自动将.java源文件编译成.class字节文件,帮我们加载类、运行。但却无法满足我个性化的需求。命令行虽然麻烦,却是更加本质。

至少从这一点上看,java的命令行编译运行还是非常重要的。

java的运行机制的基本概念:

源文件 也就是我们熟知的.java文件。

类文件  .class文件是编译器由.java文件编译而成。众所周知,Java的跨平台性在于Java虚拟机(JVM)这一层对硬件的隔离,而.class文件可以理解为JVM中的执行文件(自己的理解,可能不太准确)。里面存储的是java字节码,Javabytecode 是基于栈的(stack based)(关于字节码和JVM更详细的官方解释可以参照 The Java Virtual Machine Specification ,如果嫌那本书太厚,另外再推荐一本 Programming for the Java Virtual Machine)。

编译 Java的编译一般是指从源文件(.java文件)到类文件(.class文件)的转化过程。在JDK命令行中是 javac 命令(java compiler的缩写~跟C语言木关系的~)

运行 在JVM中执行.class文件。是 java 命令。

CLASSPATH 环境变量,存储着编译某文件或运行某类时,所要搜索的目录。 比如:在Hello.java中有使用到一个第三方包ThirdPart.jar中的类,那么必须在classpath中添加相应的路径,让编译器能找到它。(注意~把ThirdParty.jar放在当前的工作目录下,没有告诉环境变量也是不行的~编译器只认环境变量的!)同样的道理,在运行某类文件时,有涉及到第三方jar包的也必须添加到CLASSPATH中。一般的,有三种方式修改环境变量。

1.在javac 或者java命令中,使用 -classpath 选项,后面跟着需要的目录地址。显然,这种方法只能在当前语句范围内生效。

2.直接命令行修改CLASSPATH或者PATH  # PATH=$JAVA_HOME/bin:/home/username/bin

#export PATH

不过这种方法只能在此次运行中生效。

3.永久生效的方法是修改配置文件。在 /etc/profile 或者 /etc/profile.d 或者其他,不同操作系统发行版地点不同。在文件中加上CLASSPATH=......(相应路径),重启电脑即可(也可一执行source命令,那样不用重启就已经生效啦~# source /etc/profile.d    其实 . 跟source是一样的效果噢~ #. /etc/profile.d   )

PATH环境变量 跟CLASSPATH 类似,只不过它不是用来寻找类的,而是用来寻找java相关执行文件的。可以通过 java -version 命令来查看自己是否已经设置好了PATH(如果显示了详细java信息,则已经设置好了,没有的话,还需要找到java的安装位置,重新设置)

环境变量的具体相关信息,参照doc   PATH and CLASSPATH 和 Setting the class path

jar包

java里用package的概念避免重复命名的问题。有点像C++的namespace。同一个包里的类是可以直接使用的。不同包的话,则需要在.java文件头部import进对应的package。初学者写的helloworld程序当然是不用注意到包的问题,但当工程越来越大,重复命名的可能性增大,我们就必须依靠package的概念来更好的管理我们的代码了。

同时,为了方便管理、传输,jar包出现了。

jar包其实是用zip压缩的文件包。我们可以打包自己的package,方便复用,到哪果然,也可以直接引用文件夹(此时注意,必须引用文件夹的根目录,比如文件定义为package mypackage.foo , 那个必须将myapackage这个文件夹连同内部的foo文件一起放在相应的路径上)

制作jar压缩包和解压缩包的命令如下:

 jar -cvf foo.jar foo
其中最后一个参数为需要压缩的文件包。-cvf几个选项中,f必须放在最后,f后面紧跟的必须是output的文件名。v表示输出详细信息(verbose)

对应的解压缩命令为:

 jar -xvf foo.jar

注意其中有个可选的mainifest文件,在META-INF/MANIFEST.MF路径上。

我们可以在manifest.mf文件中加入如下语句

Main-Class: myPackage.MyClass
指定MyClass类为具有main()入口的主类。再利用如下语句,就可以值执行对应的程序了

java -jar foo.jar


命令

javac命令:编译源文件

-classpath  初学者必须掌握的options ,后接类中使用到的第三方类(形式可以是jar或者zip或者直接就是文件包)的目录。Linux下,多个目录用冒号 : 分隔。

值得注意的是,-classpath中的内容是会覆盖掉环境变量classpath中的内容的~

-cp 是 -classpath的缩写

-d  制定生成的.class文件存放的目录。

-o 此选项告诉javac优化由内联的static、final以及privite成员函数所产生的码。 
-verbose 此选项告知Java显示出有关被编译的源文件和任何被调用类库的信息。比如 -verbose:class 能看到各种类加载的信息。 -verbose:gc是garbage collection的信息。

还有许多option平时用的不多(话说我也其实只是刚会用,并不熟练直接在命令行环境下的调试编译 = =),需要用的时候直接翻阅 man javac 好了。


java 命令:加载运行类文件

-classpath 跟javac中的-classpath同样的道理。

-cp 也就是 -classpath的缩写啦。

-jar 执行在jar包上定义的主类的程序


一个.java文件的编译、运行示例如下:

# javac -classpath ./:/home/username/bin/ThirdParty.jar  Hello.java

#java -classpath ./:/home/username/bin/ThirdParty.jar  Hello    


另外,对于带有package信息的java文件,执行如下:

<code style="margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; font-size:14px; vertical-align:baseline; background-color:rgb(238,238,238); font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif"><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">$ ls </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">                   </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Current</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> directory contains the </span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">"x"</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">package</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
x

$ ls x                   </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">The</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">"x"</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">package</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> contains a </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">java file</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">...</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
</span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">java

$ cat x</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">/</span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">java      </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">...</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">which looks like </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">this</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
</span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">package</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> x</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">;</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
</span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">public</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">class</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">{</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
    </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">public</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">static</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">void</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> main</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">(</span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">String</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">...</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> args</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">)</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">{</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
        </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">System</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">out</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">println</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">(</span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">"Hello from Sample class"</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">);</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
    </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">}</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">}</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">

$ javac x</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">/</span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">java    </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Use</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">"/"</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> as delimiter and
                         </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> include the </span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">".java"</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">-</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">suffix when compiling</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">

$ java x</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">          </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Use</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">"."</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> as delimiter when running</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">,</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> and don</span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">'</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">t include
                         </span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">#</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> the </span><span class="str" style="font-size:14px;color:#8000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">".class"</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> suffix</span><span class="pun" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">.</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">
</span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Hello</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> from </span><span class="typ" style="font-size:14px;color:#2b91af;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">Sample</span><span class="pln" style="font-size:14px;color:#000000;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;"> </span><span class="kwd" style="font-size:14px;color:#008b;margin-top:0px; margin-right:0px; margin-bottom:0px; margin-left:0px; padding-top:0px; padding-right:0px; padding-bottom:0px; padding-left:0px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; vertical-align:baseline; background-color:transparent;">class</span></code>

 

补充:eclipse的路径

eclipse下,每个project都可以控制路径。

1.在package explorer目录下,右击自己的project。下拉菜单中点击最底部的properties,弹出的窗口的左侧,有Java Build Path这一选项卡。

这里主要是对其他工程包、第三方jar包的路径引入,也有对project中源文件路径的设置。

2.在run的下拉菜单中(就是那个绿色的Run开始按钮),选择Run Configuration.

在每个运行的程序中,都有main、argument、JRE、classpath、source、environment、common这几个选项卡。

其中argument里可以设置java命令行运行时的参数。也就试main(String[] args)中的args。

classpath里可以设置system classloader加载类时的查找目录。(关于类的加载,可以参照另几篇文章 classloader 三原则java 类加载器浅析


雷区: 

在linux下运行时,添加目录,千万不要弄错分割符。windows下是 \ ,而linux下是 / 。

运行类时,不用加.class。比如有一个类Hello.class,运行命令是 # java  Hello 而不是 #java Hello.class 。运行机制中是寻找类,而不是像编译的时候那样找到某个文件。

如果引用的类有package层次,引用的路径是包层次的起点,而不可以延伸到包中的某个目录层次。比如引用了~/workspace目录下的第三方类 com.thirdparty.hello ,在java命令的 -classpath 输入的是第三方类的包的根目录所在位置: #java -classpath ~/workspaceHello,而不能是java -classpath ~/workspace/com/thirdparty  Hello。


NoSuchMethodException! 

在运行自己的程序时,遇到了这个问题。查找了很多资料,最后发现原来是路径问题!原来的路径中,一个老版本的.class文件是在优先的位置上,于是每次invoke一个新写的method时,就出现这个错误 = =。