Click to See Complete Forum and Search --> : Java setup help


maccamlc
08-27-2002, 02:39 AM
I have just got Red Hat Linux 7.3 last night, and installed it. It is working, except the (win)modem, but thats no problem, as I didn't intend to use it for the Internet.

I have just begun studying Java at Uni, and got a CD, which says;

Steps for setting up Java on Unix with tsch
1.
in the ~/.cshrc file add the following lines
alias jc javac -d ~/Java/classes
setenv JAVA_COMPILER NONE
setenv CLASSPATH .:$HOME/Java/classes
2.
source ~/.cshrc
3.
mkdir Java
cd Java
mkdir classes
mkdir Source
cd Source

then try files, etc.

The cd also has a Linux, Javasoft and Blackdown JDK.

I entered the code and everything above, and got the files off the cd, but don't know how to install the JDK.

It would be appreciated if someone could advice me on how to set this up, as its obviously not as easy as clicking on it in gnome, lol! and also if the above would be all thats needed to run java files.

Also, with the required uni text book there is a keyboard class for us to put on the system. For windows it says to put it in classes/cs1, would this be the same with the above code (I really have no clue, but will hopefully later in the course.:)

I am also wondering, if like windows there are any programs such as JCreator or JGrasp to help with the coding, or is it just the text editor like pico?

Thanks for any help :)

X_console
08-27-2002, 03:48 AM
Download JDK for Linxu from Sun's website. It'll come as a .bin file. Then copy it to /usr/local and do:

chmod 755 filename.bin
./filename.bin


This will extract it into a directory. Let's say it extracts to /usr/local/jdk. Edit /etc/profile and append:


export PATH=$PATH:/usr/local/share/jdk/bin


Type source /etc/profile You should now have access to javac and java. If you need to set your CLASSPATH, just edit your ~/.bash_profile and add:


export CLASSPATH=.:/path/to/classes

That should be it.

maccamlc
08-28-2002, 12:53 AM
Thanks! I've got it installed, but when I type javac eg.java

It says that it needs an option, like -d.

In the notes for setting it up from uni, it says edit the ~/.cshrc file, and include the following.

alias jc javac -d ~/Java/classes

Should this work in RedHat 7.3, so that all I need to do is type

jc eg.java

Or is something else needed in the code, or should it be somewhere else, any help is appreciated to get this working.

JGooner
08-29-2002, 12:33 PM
The -d refers to the directory to which javac will produce its output files (i.e. .class files). Sun's documentation on the tools that come with the JDK (javac, jdb, javadoc and the like) are worth having and reading. Have not yet installed Java on a Linux box. Trust your experience will come in handy when the time comes :p

One other thing, if you haven't been to it yet, http://forum.java.sun.com is a pretty useful place for Java-related questions

alaskian
08-29-2002, 03:18 PM
i know you didn't ask for advice on the modem, but i thought i'd tell you which modem i bought when going to 7.2 to replace my winmodem as well. i bought the Creative Blaster ISA V.90 and it installed with no problems and works great. Just in case you ever wanted to hook to the internet. Happy java programming :)

byrner
08-31-2002, 08:30 AM
dont have linux yet(couple more weeks) but did you save your java files to the bin dir
if not you need a classpath
and also are you in the right dir when you execute your command

ie. ( for my windows machine ) c:\j2sdk1.4.0_01\bin javac eg.java

maccamlc
08-31-2002, 12:06 PM
I've got Java working, but only when in root.

It will work with the above CLASSPATH, but when I go into my other name of maccamlc, and setup the same cat structure, the programs will compile, but not run, displaying an error message.

Should I be able to run Java under that name, or only under root.

The jdk is installed under /usr/local/

Thanks