Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-05-2012
Registered User
 
Join Date: Dec 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
How to compile and run java in UNIX?

Hi

Im using MobaXterm Unix on my windows XP.I want to compile java in unix.I have installed java to the following path C:\Program Files\Java\jdk1.7.0_09\bin

In order to compile the java prog im typing the following command after entering into the bin directory:

Code:
C:\Program Files\Java\jdk1.7.0_09\bin 

$ javac Example.java

But im getting the following message:
Code:
 bash: javac: command not found


plz Help.
Thanks

Moderator's Comments:
Please use code tags next time for your code and data.

Last edited by vbe; 12-06-2012 at 04:37 AM..
Sponsored Links
    #2  
Old 12-06-2012
Yoda's Avatar
Jedi Master
 
Join Date: Jan 2012
Location: Galactic Empire
Posts: 2,323
Thanks: 155
Thanked 742 Times in 714 Posts
You have to add the absolute path of javac to PATH env variable.

Code:
export PATH="$PATH:/your_javac_path_here/"

Or try running like below once you are in bin directory:-

Code:
./javac Example.java

Sponsored Links
    #3  
Old 12-11-2012
rdcwayx rdcwayx is offline Forum Advisor  
Use nawk in Solaris
 
Join Date: Jun 2006
Posts: 2,700
Thanks: 43
Thanked 405 Times in 394 Posts
run the javac command as below:


Code:
JAVA_HOME=/your_javac_path_here
$JAVA_HOME/bin/javac Example.java

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
java compile and run program help cokedude UNIX for Advanced & Expert Users 1 10-09-2012 04:26 PM
Compile & Run Java Code tguillea UNIX for Dummies Questions & Answers 4 05-28-2010 04:59 PM
trying to compile and run java through the terminal killesk UNIX for Dummies Questions & Answers 2 05-06-2009 11:15 AM
how to compile and run java programs mayahari Solaris 3 03-03-2009 03:25 AM
compile java with GUI on unix system/putty finalight Programming 0 05-22-2008 04:41 AM



All times are GMT -4. The time now is 10:33 PM.