LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   java on linux (https://www.linuxquestions.org/questions/linux-newbie-8/java-on-linux-370980/)

amer_58 10-08-2005 01:14 PM

java on linux
 
I do have anjuta install on my machine and i had the impression that i could run and compile java programs, but it seems that i was wrong i get an error "javac cannot be found", so i went to http://java.sun.com/j2se/1.4/download.html in order to download the file, i couldnt find it, could someone help me out here... thanks

reddazz 10-08-2005 01:30 PM

Go to java.sun.com and download jdk 1.5.

btmiller 10-08-2005 01:31 PM

That site is for the Java development kit. You could install that and I believe it would work, but chances are you only want the runtime environment. You can download that from sun.com. I think Slack has a j2re package now, but I'm not sure -- you might want to check the CDs or a mirror.

spooon 10-08-2005 02:50 PM

Quote:

Originally posted by btmiller
That site is for the Java development kit. You could install that and I believe it would work, but chances are you only want the runtime environment. You can download that from sun.com. I think Slack has a j2re package now, but I'm not sure -- you might want to check the CDs or a mirror.
Didn't you read the OP's post? He/she wants to compile programs, and was complaining that "javac" doesn't work. I don't think your link is to the right place , and actually java.sun.com is precisely the site to download both the development kit and the runtime environment (download page here). You want to go to "JDK 5.0 Update xx", accept the license agreement, get the "Linux self-extracting file", then run it. Search for "Java" in the forums for more information.

dasy2k1 10-08-2005 02:53 PM

what distro are you using and did you install the D series (or developement pakages or whatever they are called on differnt distros?

mrcheeks 10-08-2005 03:30 PM

Downloading the jdk from http://blackdown.org is the easiest way to get javac recognized without hassle. Of course there are other methods...

amer_58 10-09-2005 09:12 AM

thanks guys, i did download and install the package..... i do use the NetBeans 4.1 for develping my projects now.... but i was wondering how could i compile the programs using my shell.... i tried java filename.java but it didnt work.... any help would be appreciated.

Thanks.

mrcheeks 10-09-2005 10:09 AM

you need to put java in the PATH variable in your path

PATH = /javadirectory/bin:$PATH
export PATH

amer_58 10-09-2005 11:41 AM

Quote:

Originally posted by mrcheeks
you need to put java in the PATH variable in your path

PATH = /javadirectory/bin:$PATH
export PATH

this is the path but i wasnt sure how to do it, i do know that i have to edit the /etc/profile but i didnt want to mess with it... never done it before... could you explain a bit more please. thanks

this is what i have done so far:

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/home/admin/jdk1.5.0_05/bin"

lozza1978 10-11-2005 11:43 AM

hiya

if you grab the jdk1.5.0_05 self extracting, save the file anywhere on your system, after extraction, the contents will be located in the /usr/java/jdk1.5.0_05/

the javac file you require is located in */usr/java/jdk1.5.0_05/bin* directory, also java is located in the same directory,

you need to add both these files to your path,

As root edit the /root/.bash_profile and include the path to the javac and java directory,

**example**


export CATALINA_HOME

JAVA_HOME="/usr/java/jdk1.5.0_05"
export JAVA_HOME

PATH=$PATH:$HOME/bin:/usr/java/jdk1.5.0_05/bin:$PATH
export PATH

export JAVA_HOME=/usr/java/jdk1.5.0_05
export CLASSPATH=/usr/java/jdk1.5.0_05/lib/tools.jar:/usr/java/jdk1.5.0_05/jre/lib/rt.jar
unset USERNAME


HTH


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