Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
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
Medium Priority
?
835 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
5 Comments
 
LVL 30

Expert Comment

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

Accepted Solution

by:
Mayank S earned 2000 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:Mayank S
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:Mayank S
ID: 18861126
>> java - cp. yourJARFilePath yourMainClassName

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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 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