Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating a package in the .jar form

Posted on 2009-04-05
3
Medium Priority
?
226 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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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:
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

610 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