• Post Reply Bookmark Topic Watch Topic
  • New Topic

new to java and linux  RSS feed

 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help,
I am new to Java and also new to Linux.
I want to develop java programs.
I have Linux, (mandarake flavour) installed on my computer.
I know that there are diffent linux flavors.
I have been to the development kit download at:
http://java.sun.com/j2se/1.4/download.html
the page has downloads for
Windows (U.S. English only) N/A
Windows (all languages, including English)
Linux Red Hat shell script
Linux GNUZIP Tar shell script
SolarisTM SPARCTM 32-bit binary
...
Solaris Intel tar.Z N/A
Installation Instructions

Does this mean that I cannot use java development kit (now called j2se) for my Linux version???
If I can, I guess with the download it will tell me how to do installation for Linux? (I know sometimes only provide installation for windows).
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linux GNUZIP Tar shell script
The above download is what you will want. After you have downloaded this, you will need to run several commands.
You will get a file something like:
j2sdk1.4.0_01xxxx.tar.gz
so you need to go to the shell and type:
gzip -d j2sdk1.4.0_01xxxx.tar.gz
This will unzip the archive into:
j2sdk1.4.0_01xxxx.tar
Now you need to run:
tar xvf j2sdk1.4.0_01.tar
This will untar all the files. It will hold it's directory structure and place them in a folder in your current location. If you want to place the files in a different location, type:
man tar
and you will see what options you can use with tar.
After that you will need to set your enviornment variables accordingly.
Let me know if I can help more.
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, while the general-purpose tar file is OK, it's really better under RedHat to download the RPM. Download the file, execute it from the command prompt, then run rpm -ivh against the rpm file that was just unpacked.
Since the JDK all goes in one place (/var/java, it's not at big a deal as when you have executables, docs, config files, etc. being installed all over the place, but RPM makes packages easier to manage.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim, you are right in that the RPM would be easier for Redhat users. But if you look closely, he is using a "Mandrake Flavor", so it would be safer for him to use the tar file.
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help,
I have chosen to download: Linux GNUZIP Tar shell script.
The actual download is a bin extension:
Download j2sdk-1_4_0_01-linux-i586.bin.
so thus will the commands:
gzip -d j2s...gz
and
tar xvf j2sdk1.4.0_01.tar
work?
I have looked at the FAQ but it does not tell me what I should do?
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like you said you downloaded a shell script, which means it is an executable.
Just check if you have the permission to execute it otherwise enter
chmod 755 j2sdk-1_4_0_01-linux-i586.bin.
then execute it with
./j2sdk-1_4_0_01-linux-i586.bin.
[ August 13, 2002: Message edited by: Oliver Refle ]
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I use the development tools.
Under windows I had to set up an environment paths etc. What about under linux?
I have navigated to the bin directory and ran java and javac but nothing happens. Gives me message:
[root@localhost bin]# java
bash: java: command not found.
Also I cannot read the Readme.html (a bit mystified why this should happen)
So do not know what to do?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to add the path of your java/bin directory. It is going to depend on which shell you are running, but if it is bash, then you need to edit the .bashrc file and add the path to your bin directory there.
Also, you need to chanage your name to go along with Javaranches naming policy, but I will let a moderator enforce it. I just wanted to give you a heads up.
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Gregg Bolinger,
I have changed my avatar to suit the decree of the grange. I hope I have not been reprimanded.
>Also I cannot read the Readme.html (a bit mystified why this should happen)
This file (Readme.html) in the file viewer has a question mark attached to it. When I click on the file it brings up a open with dialog box. Here I have tried with Konqueror but it just shows the file as blank. As the file is important I need to read it.
I have checked the file to see if it really is an html file and also if it has any writing.
I opend the file with gedit and it does have writing. The writing is difficult to read, since it is interlaced with html brackets and chevrons. Also I would like to read it as a html since it has href links.

There are other files of type .html that was with the download, these fortunately have the "world globe" icon in the file viewer. So when I click on the file it results in the file being opened with Konqueror (I assume this is a browser under Linux)
What shall I do? Has this happened to anybody else?
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>Type "env" and look for the line "SHELL=______"
SHELL=/bin/bash/

I have done a search for the .bashrc file and found the file at two locations:
(1) etc/skel/.bashrc
(2) home/sid/.bashrc
Question:
(1) Do I make changes to the path on both files,
if the bin directory of the java development kit is at:
home/sid/j2sdk1.4.1/bin would I set up the path as:
PATH home/sid/j2sdk1.4.1/bin
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My bashrc has the following text:
#.bashrc
# user specific aliases and functions
# source global definations
if [-f /etc/bashrc]; then
. /etc/bashrc
fi

Where should I set the path???
Please helPPPPPPPPPPPPPPP
I have searched the web and read this URL: http://java.sun.com/products/jdk/1.2/install-linux.html and now TOTALY CONFUSED.
I just want to run java and javac commands. I have done this many times in windows???
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx guys for the help,
No need to respond to the last post.
However I do have a complaint to make about the download from Sun. Do you not think the download should come with an HowTo installation page? The Readme.html did not provide this.
How is one supposed to know, one should change the bashrc file depending on the shell you use?
I know I should perhaps read more on linux, and believe me, I am doing this also but none of the articles I came across provided this (so I should hunt more for article perhaps???)

A final word, my download for windows provided the installation instructions. Even though I have been using windows for a very long time, I still needed to read this, since I had never edited an autoexec.bat file.
Again, thanks.
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OH dear new problem :
My problem is I cannot log into computer with user sid, I can log into system under root.
Here is my:
#.bashrc
# user specific aliases and functions
# source global definations
if [-f /etc/bashrc]; then
. /etc/bashrc
fi
export PATH=/home/sid/j2sdk1.4.1/bin

I was able to run java programs and compile. Then I logged off the system and went for a break. I came back after 1 hour but I was unable to log back into the system under user name "sid"
Please help.
Question:
When I am logged into as root the command prompt is
[root@localhost ...]#
How can I go into user "sid" then I can run the java tools I think? Although this is not ideal since under root user I cannot see all my desktop icons
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim/Gregg,
Luckily the Mandrake flavour of Linux includes all the rpm tools that you need to unpack everything as if your box was red hat. It is 'redhat-compatible' if you will.
Cheers
- George
 
Tim Holloway
Saloon Keeper
Posts: 18789
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would have been better to leave .bashrc alone and edit .bash_profile, which invokes .bashrc, but according to my copy .bash_profile is the preferred place to put environmental info.
Regardless, you're wiping out your existing command path and thus losing the ability to execute systems commands implicitly.
Change to this:
PATH=$PATH:/usr/java/j2sdk1.4.0/bin (or wherever/bin)
export PATH
That will append your Java path to your paths for your regular apps.
[ August 15, 2002: Message edited by: Tim Holloway ]
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx the latter response works
 
Randy Motluck
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may opt to put the JDK stuff in the system's path for all users. You can find a copy of the .bash_rc in /etc/bashrc and edit that in the same fashion.
This can allow any user on the system to get to the java run time stuff. You may want another account to be able to use the JDK, like a database admin user or a 'Tomcat' user.
I also put the path to something like /opt/java/bin where the /opt/java is a 'symbolic link' to whatever current JDK I need - say /opt/jdk1.3.4.12.3.5 or whatever.
Run man on 'ln' to see about the links in the Linux terminal window.
-Randy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!