You can find out where the executables are through "which javac", "which java" etc. although I'm not sure how that would help here. The rest of the JDK is someplace else, e.g. /Library/Java/Extensions is the extension library directory.
Ping & DNS - updated with new look and Ping home screen widget
Joined: Sep 20, 2006
The error is a Classpath error. Looks like it is not able to find the java to run the program I have created.
I tried to point the classpath to current directory to run it but still looks like some issue.
How do I point my classpath for running this program to current directory w/o changing the classpath permanently.
I am not able to echo my classpath.Is there any other command to know claspath variable value on MAC OS.
Ok, let's try something simple. Copy the following code - the entire lot - and just paste it into your Terminal
If you click on the "view plain" button you will be able to easily select, copy and paste everything.
What happened? Did you get the word "Hello" printed, or did you get a stack trace?
If you saw the word "Hello" printed, can you see what the difference is between how you are running your code and how I ran that example?
If you saw a stack trace, can you please copy the entire stack trace and paste it into this topic so we can better advise you?
Likewise, if my sample code worked, and you can't see what the difference is between what I did and what you are doing, can you please post your entire stack trace so we can advise you.
You shouldn't need to know where Java is installed - since you are getting an Exception, Java must be installed and must be running. But for completeness, this is how I find it on my computer:
Of course that tells me next to nothing, just that I am using whatever the default "current" version is. To see that, I would have to look at the version information:So right now, if I am working in a Terminal, I will be using JDK 1.5
Not sure why I would want to go to all that trouble though, since I can get the same information by typing java -version at the command line. Much simpler. I never need to look at what Apple have actually installed or where. Most of the time I work in Eclipse which I have set to default to JDK 6, which it found for me automagically.
Without knowing anything about your app/directory structure, library dependencies, etc. it's going to be very difficult to give you the command line necessary to run your program. If your code has no external dependencies then the -cp argument should get the name of the directory where your compiled output is.
Joined: Oct 13, 2005
I previously wrote:Tell us some details. Think how much easier it would be to help you if you told us which Exception you are suffering.
You see, people can't help because they haven't got enough details.