Danh mục

giáo trình Java By Example phần 10

Số trang: 75      Loại file: pdf      Dung lượng: 218.06 KB      Lượt xem: 22      Lượt tải: 0    
tailieu_vip

Xem trước 8 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tham khảo tài liệu giáo trình java by example phần 10, công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả
Nội dung trích xuất từ tài liệu:
giáo trình Java By Example phần 10 Instructs the interpreter to run the compiler on files that -checksource are not up to date. -classpath path Determines the path in which the compiler looks for classes. Same as -checksource. -cs Instructs the interpreter to set a property value. -D Runs the debugger along with the application. -debug Displays the commands you can use with the interpreter. -help Specifies the amount of memory allocated at startup. -ms x Specifies the maximum amount of memory that can be -mx x allocated for the session. Tells Java not to use asynchronous garbage collection. -noasyncgc Tells the interpreter not to verify code. -noverify Specifies the maximum stack size for Java code. -oss x Specifies the maximum stack size for C code. -ss x Specifies that the interpreter should display status -v information as it works. Same as -v. -verbose Specifies that the garbage collector should display status -verbosegc information as it works. Tells the interpreter to verify all Java code. -verify Tells the interpreter to verify code loaded by a classloader. -verifyremote This option is the default.As you can see, the interpreter can accept quite a few command-line options. Of these options, though,only a few are used frequently. Youll get a look at those more useful options in the sections that follow.Keeping Files Up to DateWhen youre working on a new application, youll make frequent changes to the source code. Wheneveryou change the source code, you must recompile the program before you run it. Otherwise, youll berunning an old version of the program. When you start writing larger applications, youll have many filesfor the classes that are used in the program. As you change the contents of these files, you may lose trackof which files need to be recompiled. This is where the interpreters -checksource command-lineoption comes into play.The -checksource option tells the interpreter to compare the dates and times of your source-codefiles with the dates and times of the matching .CLASS files. When a source-code file is newer than thematching .CLASS file, the interpreter automatically runs the compiler to bring the files up to date. Youuse the -checksource option like this: http://www.ngohaianh.info java -checksource appnameHere, appname is the name of the class you want the interpreter to run. NOTE When running a standalone application, any arguments that you place after the name of the file to execute are passed to the applications main() method. For more information on handling these application arguments, please refer to Chapter 32, Writing Java Applications.Setting the Class PathIn order to run a standalone application, the interpreter usually needs to load class files that are used bythe program. These files might be files that youve created for custom classes or they may be the classfiles that make up the class hierarchy of the class youre executing. When you derive your applet fromJavas Applet class, for example, the interpreter needs to load the Applet class, as well as Appletssuperclasses, in order to run your application. Before the interpreter can access these class files, it has toknow where they are.Normally, when you run a program, the interpreter finds classes using the current setting of your systemsCLASSPATH variable, whose default value is the folder that contains Javas classes. Java will also lookin the active folder (the one youre in when you type the java command line). However, you canchange the setting of CLASSPATH temporarily for the current program run by using the -classpathoption, like this: java -classpath path FileNameIn the preceding line, path is the path you want to include, each separated by a semicolon. Forexample, assuming that you installed Java in a folder called C:JAVA and ...

Tài liệu được xem nhiều: