Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 13th, 2003, 02:22 AM
collins23 collins23 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: kampala uganda
Posts: 19 collins23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
javac gives command not found on linux

i have the javac compiler installed on linux.i get command not found when i try to use javac.
i found out the javac compiler is in the path /usr/lib/Sun....1.4.1/bin/javac so i have to type the whole path for it to compile.

wat i did was to create a symbolic link to that directory in /usr/bin
now javac works fine. all i want to know is that is there a proper way it is supposed to be done.

Reply With Quote
  #2  
Old August 13th, 2003, 02:51 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 785 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 17
Method #1 - In your .<shellname>rc file add
javac /usr/lib/Sun....1.4.1/bin/javac

Method #2 - In that same file add
set path = ( /usr/lib/Sun....1.4.1/bin/javac )
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old August 15th, 2003, 02:43 AM
collins23 collins23 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: kampala uganda
Posts: 19 collins23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
javac in ".bashrc" did not work

i get bash:javac:command not found

Reply With Quote
  #4  
Old August 15th, 2003, 03:40 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 785 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 17
Ah... there is a difference in bash. I set you up for csh... for bash you set variables like this:

PATH=/usr/lib/Sun....1.4.1/bin/javac
export PATH

Reply With Quote
  #5  
Old August 15th, 2003, 03:42 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 785 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 17
You can also accomplish the same thing on one line:
export PATH="$PATH:/usr/lib/Sun....1.4.1/bin/javac"

This goes in your ~/.bash_profile or /etc/bashrc

Reply With Quote
  #6  
Old July 27th, 2006, 05:15 PM
jack_sparrow jack_sparrow is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 2 jack_sparrow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 12 sec
Reputation Power: 0
begineer..so facin the same problem

hey guys...i just started to use the linux platform(ubuntu)
well i installed jdk in my home directory and gave the followin path..
-----------------------------------------------------------------------------------
root@raveesh:~ # PATH=/home/raveesh/setups/jdk1.5.0_03/bin:$PATH:$HOME/BIN:./root@raveesh:~ # export PATH
root@raveesh:~ # export JAVA_HOME=/home/raveesh/setups/jdk1.5.0_03
root@raveesh:~ # export CLASSPATH=/home/raveesh/setups/jdk1.5.0_03/lib/tools.jar:/home/raveesh/setups/jdk1.5.0_03/jre/lib/rt.jar./
root@raveesh:/home/raveesh/setups/jdk1.5.0_03/bin # java -version
java version "1.5.0_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07)
Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
--------------------------------------------------------------------------
now wen i gave the command...
--------------------------------------------------------

root@raveesh:/home/raveesh/setups/jdk1.5.0_03/bin # javac Test.java
root@raveesh:/home/raveesh/setups/jdk1.5.0_03/bin # java Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test
---------------------------------------------------------
NE SUGGESTIONS....

Reply With Quote
  #7  
Old July 28th, 2006, 02:52 AM
Icon's Avatar
Icon Icon is offline
Command Line Warrior
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Sep 2005
Posts: 1,021 Icon User rank is Private First Class (20 - 50 Reputation Level)Icon User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Weeks 8 h 12 m 36 sec
Reputation Power: 15
java -cp . Test

Reply With Quote
  #8  
Old July 28th, 2006, 04:32 AM
jack_sparrow jack_sparrow is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2006
Posts: 2 jack_sparrow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 m 12 sec
Reputation Power: 0
thks dude...i also hv one more query...do we hv to repetedly gv the path wen we have to start java after every reboot??

Reply With Quote
  #9  
Old July 28th, 2006, 05:42 AM
Icon's Avatar
Icon Icon is offline
Command Line Warrior
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Sep 2005
Posts: 1,021 Icon User rank is Private First Class (20 - 50 Reputation Level)Icon User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Weeks 8 h 12 m 36 sec
Reputation Power: 15
Well.. You could put those environment variables in your startup scripts (.bashrc or something). For specific projects (i.e. specific classpath or java version) you could make a shell script you run once before you start developing.
You could use ANT to compile your projects, you only need to configure your makefile once then.
Or offcourse switch to an IDE which handles this for you, after doing quite some stuff with java on the command line, I moved to Eclipse. (Used ant for a short while too). Eclipse is heavy but I do not want to be bothered by project-compile-issues, I want to code like a monkey With eclipse you can specify your paths/java version per project.

Hope that answers your question, good luck

Reply With Quote
  #10  
Old July 28th, 2006, 05:44 AM
Icon's Avatar
Icon Icon is offline
Command Line Warrior
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Sep 2005
Posts: 1,021 Icon User rank is Private First Class (20 - 50 Reputation Level)Icon User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Weeks 8 h 12 m 36 sec
Reputation Power: 15
Btw, I see the answer to your last question was already answered further up in this (necromanced? is that what it's called?) thread..

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > javac gives command not found on linux


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap