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.
It wouldn't hurt to maybe get familiar with it at least. There are alot of jobs out there for it and I think it is a very good programming language. Too bad I can't get myself to learn it, I only know a little Javascript and that is nothing close to Java.
I think most of the time it can be in a variety of ways like with the <applet> tags or <object> but I don't know of any tags that specify straight <java>
Java is its own program in its own, you can however use <Script Language="javascript"> to specify that type of scripting.
Right now, Java is a great language to learn. It's also a pretty forgiving language. That is , it tries to take away from the messy things involved with C++, such as pointers, garbage collection, memory allocation. But that's not to say C++ isn't a great language as well. A java source code file is saved as file.java, and then you compile that file in order to get another file called file.class. Java is much different than html, but you can use html like tags in java server pages, but you really need to grasp the language before you can start using those.
I'd also recommend Java. I learnt it around six months ago, having had a background in C/Pascal/assembler and some other extremely dubious mainframe-based languages.
I think Java is a great language for beginngers because insulates you from the operating system. There are extensive and on the whole well written ways of doing all kinds of complicated things without having to worry about exactly how they work. The syntax and language rules are consistent and stuctured (there are not a whole heap of "exceptions" to rules.. although there are exceptions... now I'm getting confusing).
But also consider what kind of programs you'd like to write. In my opinion, Java is extremely well suited to server-side programming. Servlets are a wonderful way of creating complicated server-side applications.
At present though I would not recommend Java if you want to write applications to run in KDE or Gnome (or god forbid Windows). It is agonisingly slow. Anyone who might dispute this should download the Netbeans Java IDE (which is written in Java), use it for an hour and try to tell me with a straight face they could write a complicated application using it without damaging their head banging it against the wall!
For these kind of applications, C++ is really the way to go on Linux. This won't be forever-- people who say Java will never be a serious desktop application language should remember that it's not so many years ago assembler programmers would scoff at anyone trying to write a fast responsive application in a compiled language. But Java on for large desktop applications (it's fine for applets) is not yet the way forward (unfortuately - it is so much easier to write and so much more cross-platform than C++).
Java is good for cross platform stuff, but if you're not familiar with 3rd generation languages, I'd recommend Python (named after Monty Python) to start off with. It too has been ported, you probably already have it with your distribution and it's open source. You can download the complete SDK free like Java from http://www.python.org and it even comes with a tutorial.
I hear you on the speed penalty with linux, jrockey. I tried just that and after 15 minutes waiting for the IDE to load, I waited another 3 minutes and gave up.
In Japan at the moment there is a lot of interest in java's new limited configuration APIs which are being used in third gen mobile phones to track stuff in real time and play space invaders and the like. There is an SDK for that too but you need Windoze Japanese OS :-(
I'm relatively new to programming and I've learnt Javascript, Python and some Java in just under a year (between holding down a 9 to 5).
I'm a recent graduate of a CS program in college. I'm going to tell you right now that your going to learn Java in the course of your studies. It appears that most people are progressing towards this language as the one of choice. I've also heard of a lot of programs teaching this as the fundamental class(I had a derivation of Unix/C and Visual C++ as my fundamentals).
Java is a great language if you learn it well, if you don't know it well you will have one hell of a time dealing with the strict structure of it. Contrary to popular belief, Java does have pointers, it just doesn't allow arithmatic on those pointers. Here's what you need to think about, Java is a programming language that has it's roots in the Internet and more recently in Internet appliances. This is about ALL it's good for(other than cross platform install programs).
When you get into college I would focus on learning HOW to program. When I say how to program, focus on the structures of learning how loops work, how control structures(if, while, do) work, and how the general methodology of programming works. I heard once that if you know how to implement an if statement and for loop, you can program anything anywhere, and to date I haven't been able to solve a problem using just these(however of course it's not efficient).
Bottom line, don't focus on one language or when the paradigm shifts again(and it will) you will be out of a job, focus on learning the theory behind the languages and you will be able to pick up ANY language in a matter of weeks.
Strongly agree with jrmann1999. The language is not important, per se. You will need skills with certain languages to pick up that first job, but the language you use in 2005 is not the language you will use in 2025. Take it from someone who started with Fortran and has a box of punch cards in his attic. Once you have learned a couple languages, and especially if you learn assembly code for one or more machines, you will be able to shift to teach yourself whatever language you need with a little time. It's a bit harder but still doable with paradigm shifts (I went through the linear code to object oriented code shift, and there are some unusual paradigms out there such as Forth, and those odd string based things like Snoball).
I've had to use Java on my CS course at Uni and thought it was OK. There does seem to be quite a demand for it, and it has some clear crossplatform advantages but I wouldn't fancy writing anything big in it! Having used Zends PHP IDE (integrated development environment not IDE disks!!) and one of the later versions of PVCS (source code control software) I've been on the recieving end of the time it takes to fire up a big Java app! Nice if you need a coffee though
But as everyone has said, if you are new to programming then its not so much the language you use but your understanding of programming as a whole... Mind you once you have a few languages you like you'll find yourself trying to stick with them where possible, sometimes even when you know you shouldn't!
Good luck... my current mission is C but I havn't touch my trusty O'Reilly book in a few weeks I would say that I havn't got time, but I'd by lying through my teeth! Here's to being a lazy student
Jamie...
PS - Just noticed that I didn't really address you question at all there... You write your Java file in the editor of you choice (trying to avoid the dreaded vi Vs emacs flames) then you use
Code:
javac myProgram.java
to compile the source code into a .class file (so called JavaByte code, this is the file that gets executed on the Java Virtual Machine [JVM] which you find on any platform that can run Java programs). To then execute this program from the command line you can run
Code:
java myProgram
I know you can get Linux to execute Java programs directly from the command line (without the java bit at the front) but haven't ever played with it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.