Java : add package /set classpath

I'm new to Java, and I'm working through a course which provides a few class.-files for an easy command-line input and some other stuff.
I've read through a lot of posts and articles on the subject, but still couldn't solve the problem.

First, I want to set an environment variable so the setting will be permanent.

I tried to execute a setenv-command that I've found in ( set CLASSPATH = ($CLASSPATH ~/$HOME/Library/java), I've got an error.

After that, I tried to edit javaconfig.plist, but I got an error message stating I didn't have the privileges to edit this file. (I'm the administrator on my machine.

Someone in this forum posted you could just put the files in the Library/Extensions folder, but the compiler still gives me the package not found-Error.

Now I've put the folder in the same folder where I save my class.-files, that works, but that's hardly a solution.

Any help...please?

Powerbook G4 15" (&iBook clamshell tangerine 300MHz), Mac OS X (10.4.9)

Posted on May 2, 2007 7:56 AM

Reply
16 replies

May 20, 2007 3:30 PM in response to kurt hahn1

Hi Kurt

I don't know why you're having these difficulties. I've just downloaded Prog1Tools and built the jar file in Xcode. It took me about 5 minutes and it seems to work ok.

Here's what to do:
1) Go to http://www.aifb.uni-karlsruhe.de/JumpTo/ProgInJava/index.html?Prog1Tools/IOTools .html and download Prog1Tools_src.zip onto your Desktop. Unzip the zip file onto your desktop.

2) Using Finder, go to Macintosh HD/Library/Java/Extensions. Delete any previous attempts you might have made to create this library from the Extensions folder.

3) Start Xcode and create a new Java Tool project. Call it Prog1ToolsJar and put it on your Desktop. Once you've gone through all the preliminary stages, the Xcode main window should open up. Xcode will have created a new folder called Prog1ToolsJar

4) Leave Xcode for a while and go to Finder. Drag the Folder Prog1Tools from out of the unzipped folder and drop it the folder Prog1ToolsJar.

5) Still in Finder, open the Prog1ToolsJar folder and then Prog1Tools folder. You should see a load of java files, beginning with ChalkBoard.java and ending with UpOps.java.

6) Highlight/Select EVERY file in the Prog1Tools folder and then drag-and-drop them (in one operation) to the Xcode main window. Drop them on the right hand side just above the word "Manifest". A window pops up asking you to confirm the operation. The files are already in the right place, so make sure you don't select the Copy option.

7) In Xcode, select Project > Edit Active Target 'Prog1ToolsJar'. A new window opens. Select Java Compiler Settings and set Target VM Version to 1.5 and Source Version to 1.5. Close the window

8) In the Xcode main window, double click on Prog1Tools.java. Change the text in the System.out.println to something of your own choice. Save the changed file.

9) From the Xcode menu, select Build > Build. There should be no error messages.

10) Open a second Finder window and set it to Macintosh HD/Library/Java/Extensions.

11) Using Finder, drill down in the Xcode project folder to find build/Debug/Prog1ToolsJar.jar; drag this to Library/Java/Extensions

And that's it.

You should now be able to write Java programs which use Prog1Tools.

Good luck

Bob

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Java : add package /set classpath

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.