Wrox Programmer Forums
|
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2007, 02:21 AM
Registered User
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default JAR file

hi,

Is there anyone know how to make the classes of a package available to other classes? I did create a JAR file and put it in C:\Program Files\Java\jdk1.6.0_02\jre\lib\ext directory. I also created the classpath to that JAR file.

However, when I tried to import the jar file by using statement "import jarFile.*; ", it complains...say that " the jarFile cannot be resolved".

Anyone know how to fix this problem?!

Thanks

 
Old August 23rd, 2007, 08:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

First the import statement is used to import classes, it should never contain jar file names.
suppose your jar file contains a class package1.innerpackage.MyClass class; then the import statement should look like
import package1.innerpackage.MyClass;
OR
import package1.innerpackage.*;

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading xml file which is in a JAR file pradheepayyanar J2EE 2 December 26th, 2007 05:52 AM
import file from jar geek.shrek XSLT 3 November 9th, 2007 06:19 AM
cant use jar file SweeT EviL Java Basics 1 October 9th, 2007 11:48 AM
JAR File Obfuscate Anandharaj Struts 0 September 26th, 2007 07:43 AM
Accessing properties file outside jar file anand_indya J2EE 0 December 8th, 2004 06:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.