LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2004, 10:18 AM   #1
rb3ng
LQ Newbie
 
Registered: Mar 2004
Posts: 28

Rep: Reputation: 15
java install


hello guys .i am trying to learn java but i have been confounded by my growing array of problems.i was trying to run the sourcecode for my book thinking in java ,but i could not ,after much ado i decided to try installing version 1.4.3 of the sdk instead of the present version 1.4.1 JRE presently installed on my system.well i did tha,t but so as not to effect a global change on other users of the system i decided to install only in my own home directory instead of in /usr/local. but suprisingly if i try to find out which java is installed it still shows the jre installed on the higher directory.and also when i query if the sdk has been succesfully installed it shows that it has.i want to know if there are any settings i need to tweak to ensure that the sdk i installed is the defaut java environment in this directory .thanks.
 
Old 04-08-2004, 11:05 AM   #2
pycoucou
Member
 
Registered: Apr 2004
Location: Edinburgh
Posts: 78

Rep: Reputation: 15
Not really clear but I remember that java installation create a directory with the number of version. As a consequence, you can have several version, and use the one you prefer. To change the version you want, just use the environment variable:

PATH=$PATH:/usr/java/j2sdk1.4.2_03/bin:~/bin
CLASSPATH=$CLASSPATH:~/java

For instance I may want to use 1.1 to try my code on old version: I just change the path
PATH=$PATH:/usr/java/j2sdk1.1.0/bin:~/bin
if /usr/java/j2sdk1.1.0 is the installation directory of Java 1.1

I hope this answer you question. Cheers, Pierre-Yves
 
Old 04-08-2004, 11:27 AM   #3
rb3ng
LQ Newbie
 
Registered: Mar 2004
Posts: 28

Original Poster
Rep: Reputation: 15
thanks okay i will be sure to try that out.but i derived some crude means of doing things but its still problematic.let me explain , i found out that my java sdk is installed in /us/java/j2sdk1.4.2_03,so i went into the directory and attempted to run my programs from there.i ued the classpath option and the program compiled but it would not run.here is a sample of what i did.
[tunji@DELTA divelog]$ pico DiveLog.java
[tunji@DELTA divelog]$ cd /usr/
[tunji@DELTA usr]$ cd java
[tunji@DELTA java]$ cd j2sdk1.4.2_03/
[tunji@DELTA j2sdk1.4.2_03]$ javac -classpath /home/tunji/divelog/DiveLog.java
[tunji@DELTA j2sdk1.4.2_03]$ java DiveLog.java
Exception in thread "main" java.lang.NoClassDefFoundError: DiveLog/java
[tunji@DELTA j2sdk1.4.2_03]$ java -classpath /home/tunji/divelog/DiveLog
Usage: java [-options] class [args...]
(to execute a cla
and thats what i got ,i believe i did not define the classpath properlyto the java virtual machine, how can i achieve this. please help me xray this code and give me astep by step guide on how to make my program run.
 
Old 04-08-2004, 11:38 AM   #4
pycoucou
Member
 
Registered: Apr 2004
Location: Edinburgh
Posts: 78

Rep: Reputation: 15
The classpath plays a role if your code use extra classes (your own for instance) that are not in the current directory. Even in j2sdk..., you use a the javac program that is found tks to your path. You must use the javac of j2sdk.../bin. To check that, just perform a java -version

Whatever the appropriate commands are:
javac DiveLog.java
java DiveLog

to launch the virtual machine.
 
Old 04-08-2004, 11:38 AM   #5
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
You are trying to run it wrongly. You've to type only "java DiveLog", without any extension
 
Old 04-08-2004, 11:40 AM   #6
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
oops We almost posted at the same time pycoucou
 
Old 04-08-2004, 12:34 PM   #7
pycoucou
Member
 
Registered: Apr 2004
Location: Edinburgh
Posts: 78

Rep: Reputation: 15
Sorry...

And thanks for the help the other day ! ...
 
Old 04-08-2004, 01:42 PM   #8
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
No no, I'm sorry. You've posted first, almost 30 seconds actually .

Quote:
And thanks for the help the other day ! ...
For the Arrays Dimension thread? You've already understood when I've posted . And hey, you are doing very well with Java!. It's always great to have one more Java programmer around
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
java does not install in opt but install in usr bbmak Linux - Software 6 10-02-2005 11:13 PM
what directory is java install? what CMD determined where java is install? Thks. suse2166 Linux - Newbie 2 09-04-2005 08:24 PM
Java Install marlaina1 Linux - Software 5 03-22-2004 11:58 AM
Java Install Please Help!!! unwrittenlaw Linux - Newbie 22 11-08-2003 11:42 PM
Help with java install (again...) MidgetmanUK Linux - Newbie 3 10-04-2003 08:36 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration