LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to set mail.jar(JavaMail) and mysql-connector-java.jar in Linux class path (http://www.linuxquestions.org/questions/linux-software-2/how-to-set-mail-jar-javamail-and-mysql-connector-java-jar-in-linux-class-path-782895/)

Terry56 01-18-2010 12:40 AM

How to set mail.jar(JavaMail) and mysql-connector-java.jar in Linux class path
 
Hi,
Hope you all are at good health.I want to ask how i set Linux class path for mail.jar and mysql-connector.jar. I have set the class path for java with the command.

Code:

export JAVA_HOME="/usr/java/jdk1.6.0_14;"
when i do java -version it's work fine.

Also if i want to know that what shell i am using how can i find it.Also what is the command for showing class path variables or how can i see my JAVA_HOME class path.Means after setting the class path for above two files how can i see that these files have added.

When i write echo $CLASSPATH or echo $JAVA_HOME it shows nothing no error but again shows the prompt.

One thing more i want to run a java program on Linux it is in a package (named asteriskproject). It consist of 10 java files. I have run this program on windows using netbeans IDE.For this program i need to set my Linux class path for the above mentioned files, and this is my first time that i am running any program on Linux. So i want to ask how can i run my program. Simply put this asteriskproject directory in any folder and run the main file using javac. Is it right way to run the program that consist of package ?

Thank you.

raju.mopidevi 01-19-2010 08:57 AM

I followed this type of class path ..
$vi .bashrc
JAVA_HOME= /usr/lib/jvm/jre
export PATH=$JAVA_HOME:$PATH

raju.mopidevi 01-19-2010 09:05 AM

If you have .jar file you can follow this.

compiling:

Code:

javac -classpath <full_path_to_jar_file>.jar:. <file_containing_main_method>.java
running:

Code:

java -classpath <full_path_to_jar_file>.jar:. <file_containing_main_method>

raju.mopidevi 01-19-2010 09:06 AM

I for got one instruction, when you are executing above commands, you must be in the directory of "file containing main method". You must have write permissions to that folder.


All times are GMT -5. The time now is 12:17 AM.