aspose file tools*
The moose likes Mac OS and the fly likes Where do I put these class (.class class, not class class) files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Where do I put these class (.class class, not class class) files?" Watch "Where do I put these class (.class class, not class class) files?" New topic
Author

Where do I put these class (.class class, not class class) files?

Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
I'm about to start my Java class in a week or so and the book we are using is making us use these premade "AVI" class files that as far as I know, act as an easy way to use AWT. Anyways, they include instructions on where to put them on a PC (in the root directory and then modify autoexec.bat) but I have absolutly no idea where to put them on my Mac running 10.2.6.
Any ideas?
Thanks,
Noah
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Well what exactly are the PC instructions?


Rob
SCJP 1.4
Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
The audio-visual interface [avi] Package
You are advised to store the avi package on your C drive (or equivalent), in the folder avi.
Set the class path of the autoexec file in a Microsoft Windows-based system to set CLASSPATH=.;c:\
The avi directory contains the following nine files that each represent a class.

It then goes on to give docs about these nine class files:
Audio.class
Window.class
Memo.class
RadioButtons.class
Timer.class
Slider.class
CheckBoxes.class
FilmStrip.class
DialogBox.class

Noah
Jonathan Hendry
Ranch Hand

Joined: Aug 16, 2003
Posts: 32
You can put the .class files in ~/Library/Java/Extensions
I believe java on OS X automatically looks in there, so you may not need to explicitly add it to a classpath.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

If you are going to manually add them to the classpath, then you can put them just about anywhere.
If adding to ~/Library/Java/Extensions as Jonathon suggested (for per-user), or /Library/Java/Extensions (for system-wide), I'd jar up the classes into a single file just to keep things tidy.
I'd also keep an archive copy handy since reinstalling the OS* may not preserve such files.
hth,
bear

* Never had to do this on a Mac, but I like to be prepared just in case.
[ August 28, 2003: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Btw, are the class files not in any package hierarchy?
bear
Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
I appologize that I am utterly new at this. They come in an "AVI" folder and code that uses them has an import statement that says "import avi.*"
I assume that's what you're speaking of.
I'll try putting them in ~/Library/Java/Extensions/ and see what happens.
Update:
Still no go. javac doesn't seem to see those files, based on the error code:

[ August 28, 2003: Message edited by: Noah Sager ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Did you include the avi folder?
bear
Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
Yeah. The classes are in /Library/Java/Extensions/avi/
Noah
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Where is the source code for those class files? Are you certain they are members of the avi package? This means they must all start with a statement that says:
package avi;
If they do not, they are not in the avi package; sticking them in a folder that is labled "avi" won't make them a member of that package. (It's necessary, but not sufficient)
Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
Yeah. They all start with that. Take Audio.class as an example:

If I have them in the right place, and it starts with "package avi", then why isn't it working? The example I'm trying to compile and run is directly off the included CD. As are those class files.
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Try moving the whole avi folder into the top-level Library/Java/Extensions, instead of the one in your home directory.
Then try to create a simple no-action app that just imports one of those classes.
ie,
//foo.java
import avi.*;
public class foo{ } //that's all she wrote folks
//end foo.java
and compile that with
javac foo.java
and copy your compiler errors here.
We'll figure this out by cracky!
Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
I did all you said, and the same thing happens:

Oh, and just to verify I have the files in the right place, here's an ls:

That's just truncated "/Library/Java/Extensions/avi"
[ August 28, 2003: Message edited by: Noah Sager ]
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Can't only JAR files be loaded into the Extensions directory? I would do the following to build JAR file containing those classes...
cd /Library/Java/Extensions/
jar cvf avi.jar avi
Give that a whirl.
Simon
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

That's what I've customarily done and never has any problems.
bear
Noah Sager
Greenhorn

Joined: Aug 27, 2003
Posts: 11
<evil laugh>IT'S ALIIIIIIIIIIIIIIIVE!!!</evil laugh>
Thank you so much Simon. That's been the problem all along. The book said NOTHING about jarring the classes, even for the PC.
Now I can code and run my assignments at home. Thanks so much, guys.
And thank you Rob and Bear for helping out.
Noah
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Glad to be of help. Good call on the Jar issue Simon. That totally slipped my mind.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where do I put these class (.class class, not class class) files?