Solved

Creating a package in the .jar form

Posted on 2009-04-05
3
207 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
Comment Utility
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
Comment Utility
0
 
LVL 12

Assisted Solution

by:basav_com
basav_com earned 300 total points
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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 …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now