LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 01-18-2010, 01:40 AM   #1
Terry56
Member
 
Registered: Oct 2009
Posts: 49

Rep: Reputation: 15
Question 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.
 
Old 01-19-2010, 09:57 AM   #2
raju.mopidevi
Senior Member
 
Registered: Jan 2009
Location: vijayawada, India
Distribution: openSUSE 11.2, Ubuntu 9.0.4
Posts: 1,155
Blog Entries: 12

Rep: Reputation: 92
I followed this type of class path ..
$vi .bashrc
JAVA_HOME= /usr/lib/jvm/jre
export PATH=$JAVA_HOME:$PATH
 
Old 01-19-2010, 10:05 AM   #3
raju.mopidevi
Senior Member
 
Registered: Jan 2009
Location: vijayawada, India
Distribution: openSUSE 11.2, Ubuntu 9.0.4
Posts: 1,155
Blog Entries: 12

Rep: Reputation: 92
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>

Last edited by raju.mopidevi; 01-19-2010 at 10:09 AM.
 
Old 01-19-2010, 10:06 AM   #4
raju.mopidevi
Senior Member
 
Registered: Jan 2009
Location: vijayawada, India
Distribution: openSUSE 11.2, Ubuntu 9.0.4
Posts: 1,155
Blog Entries: 12

Rep: Reputation: 92
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I got error with this command 'java -jar NodeView-v1.1.jar' mohdismiaswaly Linux - Software 3 04-23-2009 07:24 AM
to set class path of a jar file priyapratheep Programming 1 08-07-2008 04:12 AM
jar path on linux somsahi Linux - Software 1 10-19-2006 11:10 AM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 06:26 AM
Compile Java - .class, .java, .jar ? woranl Programming 2 11-09-2004 11:12 PM


All times are GMT -5. The time now is 04:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration