Jump to content

Edit filter log

Details for log entry 8908258

10:05, 14 June 2013: 192.193.216.147 (talk) triggered filter 135, performing the action "edit" on Classpath (Java). Actions taken: Warn; Filter description: Repeating characters (examine)

Changes made in edit

Similar to the classic [[Library (computing)#Dynamic loading|dynamic loading]] behavior, when executing [[Java (programming language)|Java]] programs, the [[Java Virtual Machine]] finds and loads classes lazily (it loads the [[Java bytecode|bytecode]] of a class only when this class is first used). The classpath tells Java where to look in the filesystem for files defining
Similar to the classic [[Library (computing)#Dynamic loading|dynamic loading]] behavior, when executing [[Java (programming language)|Java]] programs, the [[Java Virtual Machine]] finds and loads classes lazily (it loads the [[Java bytecode|bytecode]] of a class only when this class is first used). The classpath tells Java where to look in the filesystem for files defining


The virtual machine searches for and loads classes in this order:
The virtual machine searches for and loads classes in this order abdcdkdbcb:


# bootstrap classes: the classes that are fundamental to the [[Java Platform]] (comprising the public classes of the [[Java Class Library]], and the private classes that are necessary for this library to be functional).
# bootstrap classes: the classes that are fundamental to the [[Java Platform]] (comprising the public classes of the [[Java Class Library]], and the private classes that are necessary for this library to be functional).

Action parameters

VariableValue
Edit count of the user (user_editcount)
null
Name of the user account (user_name)
'192.193.216.147'
Age of the user account (user_age)
0
Groups (including implicit) the user is in (user_groups)
[ 0 => '*' ]
Page ID (page_id)
6328370
Page namespace (page_namespace)
0
Page title without namespace (page_title)
'Classpath (Java)'
Full page title (page_prefixedtitle)
'Classpath (Java)'
Last ten users to contribute to the page (page_recent_contributors)
[ 0 => '92.23.113.124', 1 => '69.110.102.48', 2 => 'Addbot', 3 => '123.238.176.139', 4 => 'Nageh', 5 => '115.112.233.72', 6 => 'Andrewman327', 7 => 'Abdull', 8 => '68.227.235.117', 9 => '121.0.29.193' ]
Action (action)
'edit'
Edit summary/reason (summary)
'/* Overview and architecture */ '
Whether or not the edit is marked as minor (no longer in use) (minor_edit)
false
Old page wikitext, before the edit (old_wikitext)
'{{dablink|This article is about the argument on the command line of Java programs. For the Free Software Foundation's implementation of the Java [[Java Class Library|standard library]], see [[GNU Classpath]].}} {{Primary sources|date=July 2012}} {{Howto|date=July 2012}} '''Classpath''' is a parameter—set either on the [[Command line interface|command-line]], or through an [[environment variable]]—that tells the [[Java Virtual Machine]] or the [[Java compiler]] where to look for user-defined [[Class (computer science)|classes]] and [[Java package|packages]]. ==Overview and architecture== {{see also|Java Classloader}} Similar to the classic [[Library (computing)#Dynamic loading|dynamic loading]] behavior, when executing [[Java (programming language)|Java]] programs, the [[Java Virtual Machine]] finds and loads classes lazily (it loads the [[Java bytecode|bytecode]] of a class only when this class is first used). The classpath tells Java where to look in the filesystem for files defining The virtual machine searches for and loads classes in this order: # bootstrap classes: the classes that are fundamental to the [[Java Platform]] (comprising the public classes of the [[Java Class Library]], and the private classes that are necessary for this library to be functional). # extension classes: [[Java package|packages]] that are in the ''extension'' directory of the [[JRE]] or [[JDK]], <tt>jre/lib/ext/</tt> # user-defined packages and libraries By default only the packages of the [[JDK]] [[Java Platform, Standard Edition|standard API]] and extension packages are accessible without needing to set where to find them. The path for all user-defined [[Java package|packages]] and libraries must be set in the command-line (or in the [[manifest file|Manifest]] associated with the [[JAR (file format)|Jar file]] containing the classes). == Setting the path to execute Java programs == === Basic usage === Suppose we have a package called ''org.mypackage'' containing the classes: * ''HelloWorld'' (main class) * ''SupportClass'' * ''UtilClass'' and the files defining this package are stored physically under the directory ''D:\myprogram'' (on [[Microsoft Windows|Windows]]) or ''/home/user/myprogram'' (on [[Linux]]). The file structure will look like this: {| class="wikitable" style="font-size:90%" |- ! [[Microsoft Windows]] ! [[Linux]] |- | <pre> D:\myprogram\ | ---> org\ | ---> mypackage\ | ---> HelloWorld.class ---> SupportClass.class ---> UtilClass.class </pre> | <pre> /home/user/myprogram/ | ---> org/ | ---> mypackage/ | ---> HelloWorld.class ---> SupportClass.class ---> UtilClass.class </pre> |- |} When we invoke Java, we specify the name of the application to run: org.mypackage.HelloWorld. However we must also tell Java where to look for the files and directories defining our package. So to launch the program, we use the following command: {| class="wikitable" style="font-size:90%" |- ! [[Microsoft Windows]] ! [[Linux]] |- | <pre> java -classpath D:\myprogram org.mypackage.HelloWorld </pre> | <pre> java -classpath /home/user/myprogram org.mypackage.HelloWorld </pre> |- |} where: * ''-classpath D:\myprogram'' sets the path to the packages used in the program (on Linux, ''-classpath /home/user/myprogram'') * ''org.mypackage.HelloWorld'' is the name of the main class Note that if we ran Java in D:\myprogram\ (on Linux, /home/user/myprogram/) then we would not need to specify the classpath since Java implicitly looks in the [[Working directory|current working directory]] for files containing classes. === Adding all JAR files in a directory === In [[Java 6]] and higher, one can add all jar-files in a specific directory to the classpath using wildcard notation. Windows example: <pre> java -classpath ".;c:\mylib\*" MyApp </pre> Linux example: <pre> java -classpath '.:/mylib/*' MyApp </pre> ===Setting the path through an environment variable=== The [[environment variable]] named CLASSPATH may be alternatively used to set the classpath. For the above example, we could also use on Windows: Sometimes you have to check the JAVA_HOME also, if it is pointing towards the right JDK version <pre> set CLASSPATH=D:\myprogram java org.mypackage.HelloWorld </pre> === Setting the path of a Jar file === Now, suppose the program uses a supporting library enclosed in a [[JAR (file format)|Jar file]] called ''supportLib.jar'', physically in the directory ''D:\myprogram\lib\''. The corresponding physical file structure is : <pre> D:\myprogram\ | ---> lib\ | ---> supportLib.jar | ---> org\ | --> mypackage\ | ---> HelloWorld.class ---> SupportClass.class ---> UtilClass.class </pre> We should use the following [[Command-line_interface#Command-line_option|command-line option]]: java -classpath D:\myprogram;D:\myprogram\lib\supportLib.jar org.mypackage.HelloWorld or alternatively: set CLASSPATH=D:\myprogram;D:\myprogram\lib\supportLib.jar java org.mypackage.HelloWorld === Setting the path in a Manifest file === Suppose that our program has been enclosed in a [[JAR (file format)|Jar file]] called ''helloWorld.jar'', put directly in the ''D:\myprogram'' directory. We have the following file structure: <pre> D:\myprogram\ | ---> helloWorld.jar | ---> lib\ | ---> supportLib.jar </pre> The [[manifest file]] defined in this [[JAR (file format)|Jar file]] has this definition: <pre> Main-Class: org.mypackage.HelloWorld Class-Path: lib/supportLib.jar </pre> Note: It's important that the [[manifest file]] ends with either a new line or carriage return. Also, note that the classpath string in this case describes the location of the supportLib.jar file relative to the location of the helloWorld.jar file, and not as an absolute file path (as it might be when setting the -classpath parameter on the command line, for example). Thus, the actual locations of the jar file and its support library are irrelevant so long as the relative directory structure between the two is preserved. To launch the program, we can use the following command: java -jar D:\myprogram\helloWorld.jar It is not necessary to define the Classpath to the program classes, or the support library classes, because it is already defined in the [[manifest file]]. Caution, it is useless to define the Main class at launch, the manifest of the JAR file must contain a line of the form <pre> Main-Class: classname </pre> in order for the -jar option to work [http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html JavaDoc]. The syntax for specifying multiple library JAR files in the [[manifest file]] is to separate the entries with a space: <pre> Class-Path: lib/supportLib.jar lib/supportLib2.jar </pre> == OS specific notes == Being closely associated with the file system, the [[Command-line argument|command-line]] Classpath syntax depends on the operating system. For example: * on all [[Unix|Unix-like]] operating systems (such as [[Linux]] and [[Mac OS X]]), the directory structure has a Unix syntax, with separate file paths separated by a [[Colon (punctuation)|colon]] (":"). * on [[Microsoft Windows|Windows]], the directory structure has a Windows syntax, and each file path must be separated by a [[semicolon]] (";"). This does not apply when the Classpath is defined in [[manifest file]]s, where each file path must be separated by a space ("&nbsp;"), regardless of the operating system. == Diagnose == Application programmers may want to find out/debug the current settings under which the application is running: <pre>System.getProperty("java.class.path")</pre> [http://java.sun.com/javase/6/docs/api/java/lang/System.html#getProperties() JavaDoc] == External links == * [http://docs.oracle.com/javase/6/docs/technotes/tools/findingclasses.html Note explaining how Java classes are found, on Oracle website] * [http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/classpath.html Specification of how to set the Classpath on Oracle site] * [http://www.jibble.org/settingupjava.php Specification of how to install java.] [[Category:Java platform|Classpath]]'
New page wikitext, after the edit (new_wikitext)
'{{dablink|This article is about the argument on the command line of Java programs. For the Free Software Foundation's implementation of the Java [[Java Class Library|standard library]], see [[GNU Classpath]].}} {{Primary sources|date=July 2012}} {{Howto|date=July 2012}} '''Classpath''' is a parameter—set either on the [[Command line interface|command-line]], or through an [[environment variable]]—that tells the [[Java Virtual Machine]] or the [[Java compiler]] where to look for user-defined [[Class (computer science)|classes]] and [[Java package|packages]]. ==Overview and architecture== {{see also|Java Classloader}} Similar to the classic [[Library (computing)#Dynamic loading|dynamic loading]] behavior, when executing [[Java (programming language)|Java]] programs, the [[Java Virtual Machine]] finds and loads classes lazily (it loads the [[Java bytecode|bytecode]] of a class only when this class is first used). The classpath tells Java where to look in the filesystem for files defining The virtual machine searches for and loads classes in this order abdcdkdbcb: # bootstrap classes: the classes that are fundamental to the [[Java Platform]] (comprising the public classes of the [[Java Class Library]], and the private classes that are necessary for this library to be functional). # extension classes: [[Java package|packages]] that are in the ''extension'' directory of the [[JRE]] or [[JDK]], <tt>jre/lib/ext/</tt> # user-defined packages and libraries By default only the packages of the [[JDK]] [[Java Platform, Standard Edition|standard API]] and extension packages are accessible without needing to set where to find them. The path for all user-defined [[Java package|packages]] and libraries must be set in the command-line (or in the [[manifest file|Manifest]] associated with the [[JAR (file format)|Jar file]] containing the classes). == Setting the path to execute Java programs == === Basic usage === Suppose we have a package called ''org.mypackage'' containing the classes: * ''HelloWorld'' (main class) * ''SupportClass'' * ''UtilClass'' and the files defining this package are stored physically under the directory ''D:\myprogram'' (on [[Microsoft Windows|Windows]]) or ''/home/user/myprogram'' (on [[Linux]]). The file structure will look like this: {| class="wikitable" style="font-size:90%" |- ! [[Microsoft Windows]] ! [[Linux]] |- | <pre> D:\myprogram\ | ---> org\ | ---> mypackage\ | ---> HelloWorld.class ---> SupportClass.class ---> UtilClass.class </pre> | <pre> /home/user/myprogram/ | ---> org/ | ---> mypackage/ | ---> HelloWorld.class ---> SupportClass.class ---> UtilClass.class </pre> |- |} When we invoke Java, we specify the name of the application to run: org.mypackage.HelloWorld. However we must also tell Java where to look for the files and directories defining our package. So to launch the program, we use the following command: {| class="wikitable" style="font-size:90%" |- ! [[Microsoft Windows]] ! [[Linux]] |- | <pre> java -classpath D:\myprogram org.mypackage.HelloWorld </pre> | <pre> java -classpath /home/user/myprogram org.mypackage.HelloWorld </pre> |- |} where: * ''-classpath D:\myprogram'' sets the path to the packages used in the program (on Linux, ''-classpath /home/user/myprogram'') * ''org.mypackage.HelloWorld'' is the name of the main class Note that if we ran Java in D:\myprogram\ (on Linux, /home/user/myprogram/) then we would not need to specify the classpath since Java implicitly looks in the [[Working directory|current working directory]] for files containing classes. === Adding all JAR files in a directory === In [[Java 6]] and higher, one can add all jar-files in a specific directory to the classpath using wildcard notation. Windows example: <pre> java -classpath ".;c:\mylib\*" MyApp </pre> Linux example: <pre> java -classpath '.:/mylib/*' MyApp </pre> ===Setting the path through an environment variable=== The [[environment variable]] named CLASSPATH may be alternatively used to set the classpath. For the above example, we could also use on Windows: Sometimes you have to check the JAVA_HOME also, if it is pointing towards the right JDK version <pre> set CLASSPATH=D:\myprogram java org.mypackage.HelloWorld </pre> === Setting the path of a Jar file === Now, suppose the program uses a supporting library enclosed in a [[JAR (file format)|Jar file]] called ''supportLib.jar'', physically in the directory ''D:\myprogram\lib\''. The corresponding physical file structure is : <pre> D:\myprogram\ | ---> lib\ | ---> supportLib.jar | ---> org\ | --> mypackage\ | ---> HelloWorld.class ---> SupportClass.class ---> UtilClass.class </pre> We should use the following [[Command-line_interface#Command-line_option|command-line option]]: java -classpath D:\myprogram;D:\myprogram\lib\supportLib.jar org.mypackage.HelloWorld or alternatively: set CLASSPATH=D:\myprogram;D:\myprogram\lib\supportLib.jar java org.mypackage.HelloWorld === Setting the path in a Manifest file === Suppose that our program has been enclosed in a [[JAR (file format)|Jar file]] called ''helloWorld.jar'', put directly in the ''D:\myprogram'' directory. We have the following file structure: <pre> D:\myprogram\ | ---> helloWorld.jar | ---> lib\ | ---> supportLib.jar </pre> The [[manifest file]] defined in this [[JAR (file format)|Jar file]] has this definition: <pre> Main-Class: org.mypackage.HelloWorld Class-Path: lib/supportLib.jar </pre> Note: It's important that the [[manifest file]] ends with either a new line or carriage return. Also, note that the classpath string in this case describes the location of the supportLib.jar file relative to the location of the helloWorld.jar file, and not as an absolute file path (as it might be when setting the -classpath parameter on the command line, for example). Thus, the actual locations of the jar file and its support library are irrelevant so long as the relative directory structure between the two is preserved. To launch the program, we can use the following command: java -jar D:\myprogram\helloWorld.jar It is not necessary to define the Classpath to the program classes, or the support library classes, because it is already defined in the [[manifest file]]. Caution, it is useless to define the Main class at launch, the manifest of the JAR file must contain a line of the form <pre> Main-Class: classname </pre> in order for the -jar option to work [http://docs.oracle.com/javase/6/docs/technotes/tools/windows/java.html JavaDoc]. The syntax for specifying multiple library JAR files in the [[manifest file]] is to separate the entries with a space: <pre> Class-Path: lib/supportLib.jar lib/supportLib2.jar </pre> == OS specific notes == Being closely associated with the file system, the [[Command-line argument|command-line]] Classpath syntax depends on the operating system. For example: * on all [[Unix|Unix-like]] operating systems (such as [[Linux]] and [[Mac OS X]]), the directory structure has a Unix syntax, with separate file paths separated by a [[Colon (punctuation)|colon]] (":"). * on [[Microsoft Windows|Windows]], the directory structure has a Windows syntax, and each file path must be separated by a [[semicolon]] (";"). This does not apply when the Classpath is defined in [[manifest file]]s, where each file path must be separated by a space ("&nbsp;"), regardless of the operating system. == Diagnose == Application programmers may want to find out/debug the current settings under which the application is running: <pre>System.getProperty("java.class.path")</pre> [http://java.sun.com/javase/6/docs/api/java/lang/System.html#getProperties() JavaDoc] == External links == * [http://docs.oracle.com/javase/6/docs/technotes/tools/findingclasses.html Note explaining how Java classes are found, on Oracle website] * [http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/classpath.html Specification of how to set the Classpath on Oracle site] * [http://www.jibble.org/settingupjava.php Specification of how to install java.] [[Category:Java platform|Classpath]]'
Unified diff of changes made by edit (edit_diff)
'@@ -7,7 +7,7 @@ {{see also|Java Classloader}} Similar to the classic [[Library (computing)#Dynamic loading|dynamic loading]] behavior, when executing [[Java (programming language)|Java]] programs, the [[Java Virtual Machine]] finds and loads classes lazily (it loads the [[Java bytecode|bytecode]] of a class only when this class is first used). The classpath tells Java where to look in the filesystem for files defining -The virtual machine searches for and loads classes in this order: +The virtual machine searches for and loads classes in this order abdcdkdbcb: # bootstrap classes: the classes that are fundamental to the [[Java Platform]] (comprising the public classes of the [[Java Class Library]], and the private classes that are necessary for this library to be functional). # extension classes: [[Java package|packages]] that are in the ''extension'' directory of the [[JRE]] or [[JDK]], <tt>jre/lib/ext/</tt> '
New page size (new_size)
8613
Old page size (old_size)
8602
Size change in edit (edit_delta)
11
Lines added in edit (added_lines)
[ 0 => 'The virtual machine searches for and loads classes in this order abdcdkdbcb:' ]
Lines removed in edit (removed_lines)
[ 0 => 'The virtual machine searches for and loads classes in this order:' ]
Whether or not the change was made through a Tor exit node (tor_exit_node)
0
Unix timestamp of change (timestamp)
1371204313