Two Laptop Bag
The moose likes Beginning Java and the fly likes import my package/class in Redhat9 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "import my package/class in Redhat9" Watch "import my package/class in Redhat9" New topic

import my package/class in Redhat9

may Lee
Ranch Hand

Joined: Nov 20, 2003
Posts: 68

I am using j2sdk1.4.2 at Redhat 9, it is at /usr/java/j2sdk.../, now how can I put my own class or package, so the applet and servlet can both use it?


import mypackage.myclass

public class ...{
int i;
myclass a;

How to compile after I import my package or class?
I can use "javac" directly? or I must first
compile like "javac -d /$javahome/j2sdk../jre/class

I am Not clear. Please give advise Sir or Madam

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

You can use javac directly, so long as javac is in the path, i.e. linux knows what program you are on about when you type "javac" and where to find it. You can put your own packages anywhere, so long as you add them to your classpath when you run javac.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: import my package/class in Redhat9
It's not a secret anymore!