0

I'm trying to connect java to a Oracle database within terminal. I'm not very good at terminal and have been struggling with this for 3+ hours. Can someone explain to me how I can properly set my PATH so that java can see the necessary jar files, as well as how to configure my path so that I don't have to type in the path where java is installed everytime I want to compile and run. I undersatnd this is a question that can be googled, but I've been runninginto problem after problem. Please keep in mind that I'm doing this all through PuTTY as I am not on the machine itself. If someone could take the time to answer this question, I would really appreciate it.

2
  • It would be most helpful if we knew the OS you were using; different OSes have different environment variables that may be required. Commented Jan 11, 2012 at 17:30
  • I'm on a windows machine but using PuTTY to ssh into a Linux machine Commented Jan 11, 2012 at 18:19

1 Answer 1

2

Java doesn't find jar files using the PATH. It finds them using the classpath you pass to the java command (or using the CLASSPATH environment variable, but I wouldn't recommend using it outside of a local terminal session):

java -cp /path/to/jar1.jar:/path/to/jar2.jar com.foo.bar.Main

To have the JDK in your path, you need to add <JDK_PATH>/bin (or <JDK_PATH>\bin on Windows) to the PATH environment variable.

Read the following section of the Java tutorial.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.