Solved

how to include a an external jar file in a class path to to compile and run a java program?

Posted on 2007-04-05
5
816 Views
Last Modified: 2013-11-23
how to include a an external jar file in a class path to to compile and run a java program? what is the command line instruction?
0
Comment
Question by:anup001
  • 4
5 Comments
 
LVL 30

Expert Comment

by:mayankeagle
ID: 18860873
java - cp. yourJARFilePath yourMainClassName
0
 
LVL 30

Accepted Solution

by:
mayankeagle earned 500 total points
ID: 18860895
There are various options, like adding it to the classpath environment variable, putting the JAR to your JRE\lib\ext, or specifying it as a command line switch option. See a classpath explanation here:

http://www.experts-exchange.com/Programming/Languages/Java/Q_22450095.html#18722480

(And on the link posted at the end of that comment: http://www.mindprod.com/jgloss/classpath.html)

The switch option is also explained in detail here:

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html

and here: http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
0
 

Author Comment

by:anup001
ID: 18860973
All these instructions are for java command. I need info for the javac.
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 18860985
You said compile and run. I gave it for run. The links contain the same for the compile command as well:

javac -classpath JARFilePath YourFileName.java

Also explained in detail: http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 18861126
>> java - cp. yourJARFilePath yourMainClassName

The . will not be there.... it came by mistake
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now