LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-14-2005, 10:38 PM   #1
phoenix_wolf
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 177

Rep: Reputation: 30
programing in java on linux


Greetings fellow linux users

I am now going to use linux to program so I need to know some things

first of all

java I want to know what I need to dl to program in it also in console or wherever I use how do I compile the programs I make.

I know that I can get java from http://java.sun.com but the problem is knowing what to get the names change form the books that are out.

so the more info you can give me the better

also a list of other programs like c++ if that is good and hex editors that you think would would be good for a programmer.

Also a list of books free and other wise that would help, and what programs I should try the hex editors on.

my linux is debian disro. sarge verson

Thank you for your help
 
Old 01-14-2005, 10:43 PM   #2
HenchmenResourc
Member
 
Registered: Mar 2004
Location: SLC, Utah
Distribution: OpenSUSE 12.2
Posts: 246

Rep: Reputation: 30
If your use to working in Sun One take a look at Netbeans looks, feels, and as far as I can tell works the same as Sun One and it's free for down load. I used it for a programing class I had las semester and it worked great, I used it at home and Sun One in class and I had no problems.
 
Old 01-14-2005, 10:56 PM   #3
student04
Member
 
Registered: Jan 2004
Location: Georgia
Distribution: OS X, CentOS
Posts: 669

Rep: Reputation: 34
Depending on what version of java you want, (2 or 5 - 5 being the VERY newest), you'll want one of the following:

java 1.4.2_05 (java2) here

(java5) here

Accept their license, and look under "Linux". They have two choices. The one you'll be wanting to download is the one that doesn't have the RPM in it ("self extracting file). It is a binary, and to install it you do the following:

chmod +x whatever_it's_name_is.bin
./whatever_it's_name_is.bin

and follow the instructions. It is good to install it into the /usr/java/ folder, and it should have that set as the default.

To make the binaries work globally on your system, you'll need to make links to them (as root) - i'll use my system as an example:
Code:
# ln -sf /usr/java/j2sdk1.4.2_06/bin/java /usr/bin/
# ln -sf /usr/java/j2sdk1.4..2_06/bin/javac /usr/bin/
And do that for whatever other command in that folder you wish to use globally.

The other option would be to add the bin/ folder to your path. Add the following to the end of /etc/bashrc if you use bash:
Code:
JAVA_HOME=/usr/java/YOURJAVAFOLDER
PATH=${JAVA_HOME}/bin:$PATH
export PATH
And this will include ALL of the binaries in that folder for global usage.

To compile java programs you use the javac command (you should know this already ) and to run them you use the java command.

As for editors, I prefer emacs, because it has nice coloring for the java language, and supports smart auto-indenting to line up my methods. It also supports rcs, compilation, and running of your programs.

*EDIT*
As for netbeans IDE.... that is nice to use, but has some set-backs. It is designed for larger, more professional programming (i'm still a student, so professional programming doens't apply to me, though it might for you - i don't know). The problem i have with it is that if you simply want to make one-file java programs (not a whole bunch of other files in a long large tree), and you wish to create many different programs, then don't use it, because you need to "mount" filesystems (folders to use) in the IDE, because it likes packages (which is the tree of .java files in many subfolders). You'd have to include 'package blabla.blabla' in the top of the file for everything.

Plus it takes long to load and has so many options that it gets confusing. If you're in to all of that, by all means use it. Remember, this is just my opinion based on past experience.

For simplicity, I'd recommend you use a simple text editor, such as vi/vim, emacs, kwrite, pico, whatever and compile them via the console. It's much faster and most simple.

Last edited by student04; 01-15-2005 at 01:19 AM.
 
Old 01-14-2005, 11:50 PM   #4
csfalcon
Member
 
Registered: Jun 2004
Location: MD
Distribution: Fedora Core
Posts: 269

Rep: Reputation: 31
Thinking in Java is a very good book, and you can read it for free online.

And the Java IDE I can't code without is Eclipse, give it a try and play around with it.
 
Old 01-15-2005, 05:03 PM   #5
phoenix_wolf
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 177

Original Poster
Rep: Reputation: 30
ok I got it installed and it is running javac when I tryed the old classic HelloWorld.java it compiled it however I dose not run it when I type java HelloWorld.class here is what it gives

Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld/class

how do I fix this

Thank you

Last edited by phoenix_wolf; 01-15-2005 at 05:42 PM.
 
Old 01-15-2005, 05:49 PM   #6
csfalcon
Member
 
Registered: Jun 2004
Location: MD
Distribution: Fedora Core
Posts: 269

Rep: Reputation: 31
when you run java you don't include the extension

Code:
java HelloWorld
 
Old 01-15-2005, 05:52 PM   #7
student04
Member
 
Registered: Jan 2004
Location: Georgia
Distribution: OS X, CentOS
Posts: 669

Rep: Reputation: 34
Quote:
Originally posted by csfalcon
when you run java you don't include the extension

Code:
java HelloWorld
Right, when you compile you do include the extension
Code:
javac file.java
but not when you run it. javac takes the text-based .java file and makes a binary, java-virtual-machine readable .class file, which it uses to read instructions from in order to perform whatever you specified while coding.

Last edited by student04; 01-15-2005 at 05:55 PM.
 
Old 01-18-2005, 04:26 AM   #8
phoenix_wolf
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 177

Original Poster
Rep: Reputation: 30
ok thank you all

now for the hex editors and other programing tools your think would be good to learn and the books or e-books that teach me how to turn them on (lol)

Now 2 questions:
1: Eclipse is it for linux and what is it (i cant seem to get it)

2: now I have this (Emacs) in fact there are 2 of them one is just Emacs and the other is Emacs 21 (X11) whats the dif and how in the world do I use them

Remember I am very new to programing (I do like the looks of it for what i can tell it seems that I can use it to wright the source code and then compile it right there) but I do not know how to do any thing in it heck I can't start a new blank text for entering my code is there a good book or tutorial that i can look at?)

Thank you

Last edited by phoenix_wolf; 01-19-2005 at 12:09 AM.
 
Old 01-19-2005, 08:24 AM   #9
milo36472
LQ Newbie
 
Registered: Jan 2005
Posts: 13

Rep: Reputation: 0
Help on Java>> error in running a java app in linux

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/j2sdk1.4.1_01/jre/lib/i386/libfontmanager.so: libstdc++-/ibc6.1-1.so.2: cannot open shared object file: No such file or directory
 
Old 01-19-2005, 09:52 AM   #10
csfalcon
Member
 
Registered: Jun 2004
Location: MD
Distribution: Fedora Core
Posts: 269

Rep: Reputation: 31
1.
Here is the instructions for installing eclipse

http://www.csfalcon.com/wiki/csfalcon/EclipseIDE

2.

emacs is an editor, you start it by typing the command "emacs" and you can start typing. when you want to save "ctrl + x then ctrl + s", when you want to quit "ctrl + x then ctrl + c".

Last edited by csfalcon; 06-09-2008 at 01:53 PM.
 
Old 01-19-2005, 10:56 AM   #11
student04
Member
 
Registered: Jan 2004
Location: Georgia
Distribution: OS X, CentOS
Posts: 669

Rep: Reputation: 34
Quote:
Originally posted by milo36472
Help on Java>> error in running a java app in linux

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/java/j2sdk1.4.1_01/jre/lib/i386/libfontmanager.so: libstdc++-/ibc6.1-1.so.2: cannot open shared object file: No such file or directory
Are you sure this isn't a typo in the java code? The error message is saying it cannot find that file. What program is it?
 
Old 01-19-2005, 12:47 PM   #12
JunctaJuvant
Member
 
Registered: May 2003
Location: Wageningen, the Netherlands
Distribution: OS X & FreeBSD
Posts: 488

Rep: Reputation: Disabled
Recommended reading: The Java Language Specification
Also the API Specifications are definitely worth bookmarking in your browser.
Good luck with it!

Last edited by JunctaJuvant; 01-19-2005 at 12:49 PM.
 
Old 01-19-2005, 02:34 PM   #13
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
if you're new to programming, I can recommend learning python rather than java. It's easier to learn, yet useful in the real world (say, google and nasa). An example code snippet would be:

print "hello, world"

def factorial(x):
if x == 0: return 1
return x * factorial(x-1)

see? No fuss about creating classes just to print stuff

recommended books: http://www.ibiblio.org/obp/thinkCSpy/; the python reference manual is also good, but thinkcspy is more newbie-friendly. quick-refence bookmark: http://www.cs.cofc.edu/~manaris/fall...QR/PQR2.3.html

I'm no teacher or academic, but for the future, I'd recommend that you learn other programming languages in roughly this order:
C, C++, java (you'll understand much more of how it works once you've grasped the first three, plus you'll miss all the features such as multiple inheritanc, operator overloading and first-class/pointers-to functions).

also, once you're down with the basics of whatever programming language you choose, I think it would be really insightful to program on some project with someone slightly better than yourself (I learned a lot through this).

jonas.add_cents(this.post, 2);
 
Old 01-20-2005, 03:20 PM   #14
phoenix_wolf
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 177

Original Poster
Rep: Reputation: 30
/usr/bin/perl -w
ok I get into it at least I think so when I execute the Pearl -w command it jumps to the next line which is blank like so

then I print this
print ("Hello, world!\n");
and then nothing happens what is wrong here is the Pearl list on in that dir

perl perl5.8.4 perlbug perlcc perldoc perlivp

and if I need to dl pearl then where do i dl it save pearl.com does not open
 
Old 01-20-2005, 05:00 PM   #15
jonaskoelker
Senior Member
 
Registered: Jul 2004
Location: Denmark
Distribution: Ubuntu, Debian
Posts: 1,524

Rep: Reputation: 47
not interactive

The problem of your approach (well, actually the problem of perl is that the interpreter isn't interactive (that is, it reads the whole file before evaluating whatever you type in).

a short example session would be:

$ perl
print ("hello, world\n");
print ("hello???\n");
^D # that is, press ctrl-d, the end-of-file character
hello, world
hello???
$

so, it does evaluate what you enter, but only when you're done.

about pearl.org: try perl.org and/or perl.com instead.

chances are that your distribution has a perl package. Since you don't mention your distro, I can't help with the specifics, but try man rpm or map apt-get for help on how to use the package-installers.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Programing in Linux sdat1333 Linux - Newbie 4 12-14-2004 11:23 PM
Programing in Linux jimbob1989 Programming 1 10-10-2004 10:53 AM
Java Programing Tutorial embalmedlenin Programming 2 08-23-2003 09:53 AM
Java programing VincentB Linux - Software 3 07-14-2003 07:17 PM
About Java Sound programing figadiablo Programming 4 03-20-2003 10:01 AM


All times are GMT -5. The time now is 02:34 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration