Solved

Creating a package in the .jar form

Posted on 2009-04-05
3
209 Views
Last Modified: 2013-11-23
I would like to allow importing a few classes and package them in a single .jar file. How can I create such a package with the minimal number of steps?

Some of those classes use the names introduced in the "dependent" classes (used during the compilation). Do I need to include those "dependent classes" in the package to be imported?

When I compile a .java file using the classes packaged in a .jar, I attempted to use the statements
import <class_name>;
I receive an error saying that javac expects a dot ('.') in the imported name. However, it seems to reject the statements:
import <package name>.<class name>;
0
Comment
Question by:tatavolk
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 24074295
your import statement needs to specify the fully qualified class name

eg.

import java.io.InputStream;

you need to import any class directly used in your class

0
 
LVL 12

Assisted Solution

by:basav_com
basav_com earned 300 total points
ID: 24074559
0
 
LVL 12

Assisted Solution

by:basav_com
basav_com earned 300 total points
ID: 24074564
You can use fatjar if you want to include other dependent jars and package it into a single .jar
http://fjep.sourceforge.net/fjeptutorial.html
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from 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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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 tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

776 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