user482594
user482594

Reputation: 17486

How can I install additional packages in Java?

I am very new to Java. I would like to use some features from package called daj

The tutorial code has the following lines.

import daj.*;
import java.util.*;
import java.lang.Math;
import Msg;

But first and fourth lines produce red underscore such that program cannot compiles.

How can I resolve this problem?

Upvotes: 2

Views: 1353

Answers (3)

SJuan76
SJuan76

Reputation: 24885

You have to add the packages to the classpath. If you are using an IDE as Eclipse or Netbeans, go to the project options and find the "Add library/jar" and they will take care of you.

You will need to add these libraries to the classpath both to compile and to run your program.

Also, the usual way of ordering imports is:

  • first, java. packages
  • second, javax. packagaes
  • third party packages
  • your packages

Upvotes: 4

bhagyas
bhagyas

Reputation: 3080

You need to have them in your build path.

Upvotes: 1

Umesh Kacha
Umesh Kacha

Reputation: 13676

That daj package or jar file should be in your package or current directory or in classpath.

Upvotes: 0

Related Questions