How to compile and run java in UNIX? | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

How to compile and run java in UNIX?

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-05-2012
ak3141 ak3141 is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 6 December 2012, 12:26 AM EST
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
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 22 August 2014, 1:40 PM EDT
Location: Galactic Empire
Posts: 3,362
Thanks: 230
Thanked 1,197 Times in 1,125 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
Last Activity: 22 March 2014, 12:27 PM EDT
Posts: 2,759
Thanks: 44
Thanked 418 Times in 406 Posts
run the javac command as below:


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

Sponsored Links
Closed Thread

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 09:34 PM.