 |
 |
How to install java "libraries"?
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2002
Location: Boston, MA
Status:
Offline
|
|
Ok, I am a pretty new java programmer, and I want to install the relay-irc library (is that what it's called?) on OS X. I do not know where I should put it, and I have the source for it. The thing I do not get is where to put the folder with org.relayirc. The org.relayirc folder contains all sorts of .java files that I obviously can't compile because they import the classes or libraries I am trying to install. I hope I said that correctly...  That way I can use it to try and make my own IRC client in java 
|
|
Revenge is a meal best served cold.
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Oct 2001
Location: Sweden
Status:
Offline
|
|
Sounds to me like you're confused over some very basic things with Java. If you're planning to start programming I'd recommend you buy a good Java book (I'm sure you can find one from O'Reilly). That will give you a good and clear explaination on both the Java language and the Java libraries as well as how compiling works.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
For a well-packaged Java app of this nature, you shouldn't have to compile anything. Java bytecode runs on the Java Virtual machine. So any system with the required JVM should run it without a problem.
I took a quick look at the "relay08-1.zip" package (to see if I could lend you a hand) and it seems pretty rushed and non standard -in other words, annoying. What's so difficult about providing an executable jar (or a build.xml) and some release notes? If packaging is an indicator of quality, then find an alternative...

(Last edited by DaGuy; Sep 25, 2003 at 07:39 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2002
Location: Boston, MA
Status:
Offline
|
|
tobli - I have 2 books about java, and can program pretty well. But have never had to download a library and install it before. I understand how it compiles...just not how to install the library. Ok, DaGuy I'll look for an alternative to that java package. I am actually in an AP Computer Science course for Java programming right now, but the thing is the teacher is learning at the same speed...if not slower than the students so it's more like a you know java syntax and that's about it class.
|
|
Revenge is a meal best served cold.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
I see... Well, here's how to add libraries:
For .class files:
1. Create a folder where you will storing your class files.
2. Add the path to the folder in your environment classpath variable.
3. Repeat 1. and 2. for each folder
EXAMPLE (using the tcsh shell):
setenv CLASSPATH ${CLASSPATH}:/Users/macuser/Dev/framework/httpunit/
For .jar archives
1. For each jar, add the jar file's path to the classpath variable.
EXAMPLE (using the tcsh shell):
setenv CLASSPATH ${CLASSPATH}:/Users/macuser/Dev/framework/httpunit/tidy.jar
Anyway, It's basically the same idea, since a jar can, in some sense, be considered a folder.
Hope it helps.
(Last edited by DaGuy; Sep 25, 2003 at 09:40 PM.
)
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by Vash:
tobli - I have 2 books about java, and can program pretty well. But have never had to download a library and install it before. I understand how it compiles...just not how to install the library. Ok, DaGuy I'll look for an alternative to that java package. I am actually in an AP Computer Science course for Java programming right now, but the thing is the teacher is learning at the same speed...if not slower than the students so it's more like a you know java syntax and that's about it class.
If your goal is to use an existing jar file, just drop it into ~/Library/Java/Extensions/ (you may have to create these folders). This folder and its contents are already in your classpath, so you should be set.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Jan 2002
Location: NYC
Status:
Offline
|
|
I don't get it. you guys are the pros but why are you telling him to do all that. In order to use those LIbraries he shouldn't have to do more than put it in the same folder as his source and do a
#import "org.thing.*";
Those dots after all are folder seperators in the fs and package/class speicalizations for code.
As for compiling, why would he need to anymore, I was pretty sure that once you compiled your program with Java you don't need the original libraries be installed on the atarget machine, only the JVM.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status:
Offline
|
|
Originally posted by K++:
I don't get it. you guys are the pros but why are you telling him to do all that. In order to use those LIbraries he shouldn't have to do more than put it in the same folder as his source and do a
#import "org.thing.*";
Those dots after all are folder seperators in the fs and package/class speicalizations for code.
As for compiling, why would he need to anymore, I was pretty sure that once you compiled your program with Java you don't need the original libraries be installed on the atarget machine, only the JVM.
First, you're assuming that the CLASSPATH environment variable includes ".", the current directory, which is not always the case, and that he is compiling from within the directory containing his source, which is very often not the case when defining code within packages.
Second, it is false that you don't need libraries when code has been compiled against them. Typically in a case like this the relevant class files from the library are included within the application's jar file. There is no static linking in java.
|
|
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|