Help - Search - Members - Calendar
Full Version: How Do I Set The Path For Java?
Linuxhelp > Support > Technical Support
nvlramakanth
Hi,

There's a problem setting the PATH for java on my linux system.I have by default installed the gcj compiler.After which i installed the java version 1.3.1_02.and set the path as below in the file profile.

$JAVAHOME=/usr/java/jdk1.3.1_02;
$J2EEHOME=/usr/java/j2sdkee1.3.1;
$PATH=/usr/java/jdk1.3.1_02/bin:/usr/java/j2sdkee1.3.1/bin;
$CLASSPATH=/usr/java/jdk1.3.1_02/src.jar:/usr/java/j2sdkee1.3.1/lib/j2ee.jar;
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVAHOME J2EEHOME CLASSPATH


When I say "javac" at the prompt the usual output doesn't come but it shows "gcj:no input files." And when I input some file to "gcj" or "javac" they do not recognise the "Swing" package. I find that the "libgcj" that came with my RedHat9 distribution(kernel 2.4.20-8) doesn't contain the swing package.
I type javac and the command is processed by gcj!! which I don't want to happen.
Also if I set "PATH=/usr/java/jdk1.3.1_02/bin:/usr/java/j2sdkee1.3.1/bin;" it works, but only in that particular command window.

Is there an error in the way i have set the path to java. My java is installed in the path /usr/java.

********************************************************************************
******
Here's a sequence of steps where the error may be clear to your eyes...

[kanth@localhost kanth]$ su -
Password:
-bash: =/usr/java/jdk1.3.1_02: No such file or directory
-bash: =/usr/java/j2sdkee1.3.1: No such file or directory
-bash: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin/X11:/usr/X11R6/bin=/usr/java/jdk1.3.1_02/bin:/usr/java/j2sdkee1.3.1/bin: No such file or directory
-bash: =/usr/java/jdk1.3.1_02/src.jar:/usr/java/j2sdkee1.3.1/lib/j2ee.jar: No such file or directory
[root@localhost root]# javac
gcj: no input files
[root@localhost root]# j2ee
-bash: j2ee: command not found
[root@localhost root]# PATH=/usr/java/jdk1.3.1_02/bin:/usr/java/j2sdkee1.3.1/bin; export PATH
[root@localhost root]# javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-O Optimize; may hinder debugging or enlarge class file -nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-target <release> Generate class files for specific VM version

[root@localhost root]# j2ee
/usr/java/j2sdkee1.3.1/bin/j2ee: line 1: dirname: command not found
/usr/java/j2sdkee1.3.1/bin/j2ee: line 9: /setenv.sh: No such file or directory
[root@localhost root]#
********************************************************************************
***************

Thank you and regards.
hughesjr
Get rid of the $ in front of the and the ; ... so do this:

JAVAHOME=/usr/java/jdk1.3.1_02
J2EEHOME=/usr/java/j2sdkee1.3.1
PATH=/usr/java/jdk1.3.1_02/bin:/usr/java/j2sdkee1.3.1/bin:$PATH
CLASSPATH=/usr/java/jdk1.3.1_02/src.jar:/usr/java/j2sdkee1.3.1/lib/j2ee.jar

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVAHOME J2EEHOME CLASSPATH
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.