?
Solved

Creating a package in the .jar form

Posted on 2009-04-05
3
Medium Priority
?
224 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
[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
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 800 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 1200 total points
ID: 24074559
0
 
LVL 12

Assisted Solution

by:basav_com
basav_com earned 1200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 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