1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3
* Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
4
* Use is subject to license terms.
8
<title>Setting the Runtime Classpath</title>
9
<link rel="StyleSheet" href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/ide.css" type="text/css">
12
<h2>Setting the Runtime Classpath</h2>
13
<p> <small><a href="#seealso">See Also</a> </small>
14
<p>By default, the runtime classpath of each <object classid="java:com.sun.java.help.impl.JHSecondaryViewer">
15
<param name="content" value="../project/csh/glossary_standard.html">
16
<param name="viewerActivator" value="javax.help.LinkLabel">
17
<param name="viewerStyle" value="javax.help.Popup">
18
<param name="viewerSize" value="400,220">
19
<param name="text" value="standard project">
20
<param name="textFontSize" value="medium">
21
<param name="textFontFamily" value="SansSerif">
22
<param name="textFontStyle" value="italic">
23
<param name="textFontWeight" value="bold">
24
<param name="textColor" value="blue">
26
contains the project's compiled classes and everything in the
27
project's compilation classpath. For information on viewing the compilation
28
classpath, see <a href="../compile/comp_classpath.html">Managing
31
<p>If your project uses special libraries dynamically at runtime through an indirect
32
interface or reflection <!--note : clarify term "reflection"--> (like JDBC drivers or JAXP implementations), you have
33
to add these libraries to the runtime classpath. </p>
36
<li>For <object classid="java:com.sun.java.help.impl.JHSecondaryViewer">
37
<param name="content" value="../project/csh/glossary_standard.html">
38
<param name="viewerActivator" value="javax.help.LinkLabel">
39
<param name="viewerStyle" value="javax.help.Popup">
40
<param name="viewerSize" value="400,220">
41
<param name="text" value="standard projects">
42
<param name="textFontSize" value="medium">
43
<param name="textFontFamily" value="SansSerif">
44
<param name="textFontStyle" value="italic">
45
<param name="textFontWeight" value="bold">
46
<param name="textColor" value="blue">
47
</object> that have a main class is specified, the IDE automatically copies any JAR
48
files on the project's classpath to the <tt>dist/lib</tt> folder.
49
The IDE also adds each of the JAR files
50
to the Class-Path element in the application JAR's <tt>manifest.mf</tt>
51
file. This simplifies running the application outside the IDE. For more
52
information, see <a href="../compile/comp_jar_deploy.html">Preparing
53
a JAR for Deployment Outside the IDE</a></li>
56
<p>You also have to adjust your
57
runtime classpath if the runtime dependencies between your projects do not
58
match the compilation dependencies between the projects. For example, imagine
59
that project A compiles against project B, and project B compiles against project
60
C, but project A does not compile against project C. This means that project
61
A only has project B on its runtime classpath. If project A requires both project
62
B and project C during execution, you have to add project C to project A's runtime
64
<p><b>To set the runtime classpath:</b>
66
<li>Right-click the project node in the Projects window and choose Project Properties.</li>
67
<li>In the Project Properties dialog box, select the Libraries node in the
68
Categories pane. </li>
69
<li>Select the Run tab in the dialog's right pane.</li>
70
<li>Add the necessary elements to the project's runtime classpath by clicking
71
the appropriate button. You can add any of the following:<ul><li><b><a href="../compile/comp_dependencies.html">Project</a>.</b> The
72
build output, source files, and Javadoc files of another IDE project.
73
Adding a project to the classpath makes it dependent on the present project.
74
Whenever you clean or build the project, all of its dependent projects
75
are also cleaned or built.</li>
76
<li><b><a href="../compile/comp_libraries.html">Library</a>. </b>A collection
77
of binary files, source files, and Javadoc files.</li>
78
<li><b>JAR file.</b> A JAR file or folder somewhere on your system.</li>
79
<li><b>Folder</b></li>
83
(Optional) Click the Move Up and Move Down buttons to alter to the
87
<li>In <object classid="java:com.sun.java.help.impl.JHSecondaryViewer">
88
<param name="content" value="../project/csh/glossary_freeform.html">
89
<param name="viewerActivator" value="javax.help.LinkLabel">
90
<param name="viewerStyle" value="javax.help.Popup">
91
<param name="viewerSize" value="400,160">
92
<param name="text" value="free-form projects">
93
<param name="textFontSize" value="medium">
94
<param name="textFontFamily" value="SansSerif">
95
<param name="textFontStyle" value="italic">
96
<param name="textFontWeight" value="bold">
97
<param name="textColor" value="blue">
98
</object>, your Ant script handles the classpath for all of your source
99
folders. The classpath settings for free-form projects only tell the IDE
100
what classes to make available for code completion and refactoring. For
101
more information, see <a href="../project/proj_free_classpath.html">Declaring
102
the Classpath in Free-Form Projects</a>.
107
<dt><a name="seealso">See Also</a></dt>
108
<dd><a href="run_quickref.html">Running Tasks: Quick Reference</a></dd>
109
<dd><a href="run_app.html">Running an Application</a> </dd>
110
<dd><a href="run_file.html">Running a Single File</a></dd>
111
<dd><a href="run_args.html">Setting the Main Class and Runtime Arguments</a></dd>
112
<dd><a href="../compile/comp_classpath.html">Managing the Classpath</a></dd>
116
<hr><small><a href="../credits.html">Legal Notices</a></small>
118
<table border="0" cellpadding="20">
119
<tr><td> </td></tr>
120
<tr><td> </td></tr>
121
<tr><td> </td></tr>