Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

John444

macrumors member
Original poster
Feb 10, 2011
90
0
Hey everyone, I have downloaded the HSA Console package for java programming, but I do not know were to put it. I do all my programming through terminal (this includes compiling using javac, and reading using java). I use hsa console methods in my programs. In order for my .java files to work, I need to put the hsa folder and the .jar file that runs the hsa console in the same directory as my programs.

However, I have lots of programs, were do I install hsa console on my mac so that it can be accessed using import.hsa.Console.*; without having to put the entire package in each directory of each one of my programs.

This is really bugging me, hope someone can help
 
Ah, you want the Java extensions folder. That's located at /Library/Java/Extensions/ (it's part of the default Java class path on Mac OS X).
 
Ah, you want the Java extensions folder. That's located at /Library/Java/Extensions/ (it's part of the default Java class path on Mac OS X).

That's the system-wide extensions folder. You're better off putting it in the per-user extensions folder.

Make a folder at YourHomeFolder/Library/Java/Extensions. Put your extension jars there.

Terminal command-line:
Code:
mkdir -p ~/Library/Java/Extensions/
 
I put the hsa files there and it still is saying error when I try to compile using terminal. (if it helps the hsa console has 1 jar file and a folder full of methods)
 
Copy and paste the following command-line into a Terminal.app window.
Code:
ls -la ~/Library/Java/Extensions /Library/Java/Extensions
Then copy and paste the entire output into a reply post here.

"A folder full of methods" doesn't make much sense. That's one reason I asked for the ls -la output: to see what's really in the extension folders.


Please identify what your OS version is. Apple Menu > About This Mac, then read the OS version from the window.


Please post the exact Terminal command you used to compile your program. Post the actual error output, too.


Please identify exactly where you obtained your HSA Console files. I'm not seeing a downloadable source for it in any google searches. Best I can find is some online docs for the hsa.Console class, and a reference that it's from a book "Introduction to Programming with Java" (exactly which edition(s) is unclear).
 
Copy and paste the following command-line into a Terminal.app window.
Code:
ls -la ~/Library/Java/Extensions /Library/Java/Extensions
Then copy and paste the entire output into a reply post here.

drwxr-xr-x 77 john admin 2618 11 Nov 17:09 hsa



"A folder full of methods" doesn't make much sense. That's one reason I asked for the ls -la output: to see what's really in the extension folders.

Turns out the .jar file means nothing for the hsa package (I copied the wrong thing from the program that downloaded hsa, my program compiles only if the hsa folder is in the same directory as my .java file). Its the hsa folder that does it all, inside the folder are a bunch of .class files that make the program run. This includes a class called "Console" which I use import hsa.Console;


Please identify what your OS version is. Apple Menu > About This Mac, then read the OS version from the window.

Mac OS X 10.6.8


Please post the exact Terminal command you used to compile your program. Post the actual error output, too.

compile:

javac -classpath . Example.java

error:

Example.java:3: package hsa does not exist
import hsa.Console;
^
Example.java:7: cannot find symbol
symbol : class Console
location: class Example
static Console c; // The output console
^
Example.java:11: cannot find symbol
symbol : class Console
location: class Example
c = new Console ();
^
3 errors



Please identify exactly where you obtained your HSA Console files. I'm not seeing a downloadable source for it in any google searches. Best I can find is some online docs for the hsa.Console class, and a reference that it's from a book "Introduction to Programming with Java" (exactly which edition(s) is unclear).

I use ready to program as a java ide at school (on Windows). I got the hsa folder from Ready to Program (when you download it, Ready also downloads the hsa package, I just copied the hsa package from the Ready to Program files at school) and I put it in the same directory as my .java files to see if it would compile and it does, but this means I have to copy the folder into all the directories that store my .java files, that I made using Ready at school. Am I able to just put the hsa folder somewhere so that my programs will compile without having the folder in the same directory?
 
drwxr-xr-x 77 john admin 2618 11 Nov 17:09 hsa
I don't think that's the entire output. The directories . and .. should be listed. Also, only one item is listed; there should be two, since I asked for the listing of two separate directories. I asked for two because I wanted to see where it was located.

The Extensions folder is for jar-files. Putting a sub-folder of separate class files in there has no effect.


Turns out the .jar file means nothing for the hsa package (I copied the wrong thing from the program that downloaded hsa, my program compiles only if the hsa folder is in the same directory as my .java file). Its the hsa folder that does it all, inside the folder are a bunch of .class files that make the program run. This includes a class called "Console" which I use import hsa.Console;
Is there a jar file or isn't there? It's significant.

The Ready To Program (RTP) downloadable is a Windows-only executable (.exe) file. That means it can't be installed on anything but Windows, so I'm unable to get the hsa folder or anything else, unless there's a separate non-executable download somewhere (I'm still looking for that).


I use ready to program as a java ide at school (on Windows). I got the hsa folder from Ready to Program (when you download it, Ready also downloads the hsa package, I just copied the hsa package from the Ready to Program files at school) and I put it in the same directory as my .java files to see if it would compile and it does, but this means I have to copy the folder into all the directories that store my .java files, that I made using Ready at school. Am I able to just put the hsa folder somewhere so that my programs will compile without having the folder in the same directory?

If there's a jar file, put that jar directly in the Extensions folder. If your hsa folder contains a jar file, move that jar so it's directly in the Extensions folder.

Then you can take the 'hsa' folder out of Extensions. It's not doing anything useful anyway.


If there's not a jar file, it will be necessary to make one from the 'hsa' folder. It's not hard to do (a single command line), but if there's already a jar file, it would probably be best to use it.
 
Last edited:
Ok thanks.

Ya sorry I just thought you wanted the hsa output the rest is


drwxrwxr-x 4 root admin 136 12 Nov 16:51 .
drwxrwxr-x 5 root admin 170 9 Jul 13:46 ..
drwxr-xr-x 77 john admin 2618 11 Nov 17:09 hsa

(this is the output for the system library, I deleted the one that I created in my user account)

I downloaded Ready to Program on windows, and they used a usb to bring the hsa to my mac.

There is no Jar file for my hsa package, can you please tell me how to make one? (the jar file I was writing about earlier had nothing to do with the hsa folder, I copied it by mistake)
 
You really should use a per-user Extensions dir. Trust me on this.


Step 1: go to the dir containing the hsa folder:
Code:
cd someDir
DO NOT go into the hsa folder itself. You should be able to 'ls -l' and see the hsa listed as a directory.

Step 2: create the jar from the hsa dir:
Code:
jar cvf hsa.jar hsa
The files added will be listed (the v option). The jar itself will be hsa.jar, located in the current directory.

Learn more abou the 'jar' command by reading its man page.
 
Thank you so much, it works great. You are a life saver, this was really bugging me,

thanks again!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.