ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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:
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
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.
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.