PDA

View Full Version : Issues with Java




juhani
Feb 22, 2005, 05:08 PM
Ok, I'm just starting out with Java and even borrowed some books from the library and stuff and everything was all clear since I actually had to write the 'Hello Java' program. Namely, these books tell me that i should write the well-known 'hello java' script to some kind of text editor, then compile it, then run it and voila - enjoy. So I started to look what's inside my OS X and found developer tools. I intalled it, tried several programs to compile the stuff, failed and then found XCode. I chose new file, java (or something) and was pretty happy 'cause at last i could write the freakin' script. But when i finished, the 'compile' command was as inactive as it is possible to be! So why is it so :confused: ? Anyway I gave up, ran help and found out that new project would be much better choice to begin with a new program. But when i did it (chose a new project from the file menu) it showed me several options like Swing and many, many more that I can't recall at the moment. So what are they??? Which one should I choose and why :confused: ? And now the most disturbing matter. When i finally chose something that made absolutely no sense to me as none of those borrowed books had covered them (yet?), the computer created several files which already had scripts inside?!? Plus, there were many folders loaded with stuff inside that i did't expect to discover in the first place??? So here's my simple question: What the hell is going on??? Please help me, 'cause I'm really tired being such an ignorant fool and I don't want to ask those stupid questions any more.

Thanks in advance,
Juhani

PS. Maybe the problem is also with the books which (perhaps) expect me to use that freakin' Windows and don't tell me the stuff i need to know when using Mac. Isn't there any good Java book for beginners that also covers OS X? It was really strange and stupid that the library at Univerity of Glasgow didn't comprise almost any book related with Macs.



therevolution
Feb 22, 2005, 05:50 PM
Those books probably talk about compiling and running Java programs like this: (assuming you have a program saved to a file named HelloWorld.java)

javac HelloWorld.java
java HelloWorld

Is this similar to what your books say? If so, you can do this in OS X with Terminal. Go to /Applications/Utilities and open the "Terminal" program. Those commands will work there. You will need a basic understanding of how to operate in a UNIX environment. Many tutorials exist on the web; try Googling "unix tutorial" if you need this.

juhani
Feb 25, 2005, 01:18 PM
Right.. thanks for your many helpful replies indeed! At least I tried :( ... Anyway I'm back on the track now and not so much at sea any more. I got my 'Hello Java' working too :rolleyes: ...

therevolution
Feb 25, 2005, 02:04 PM
I tried my best. Your post was rambling almost to the point of incoherency.

Next time, keep your question short and to the point. Try spacing it out a little more to make it less intimidating to read.

Also, when programming, you're often faced with "why doesn't this work" situations. Showing a little more initiative to figure it out on your own and telling us the results, rather than "OMG why isn't this working?!!!111," would probably have earned you more responses as well.

juhani
Feb 28, 2005, 12:19 PM
yeah..

i guess you're right...

jeremy.king
Feb 28, 2005, 02:40 PM
Please help me, 'cause I'm really tired being such an ignorant fool and I don't want to ask those stupid questions any more.

Perhaps a class or college course might help.

As for a book, look for books with command line examples to start. This will help you understand the ideas of compiling into bytecode (javac) and then running it (java). Assuming you have the JDK installed on your mac, these will be available using Terminal.

Or if you want the "easy" way out, download and install Eclipse (http://www.eclipse.org) and use that to run programs. It may be above your head (right now), however.

kettle
Feb 28, 2005, 03:09 PM
Isn't Java going to get strangled to death quite soon? :confused:

jeremy.king
Feb 28, 2005, 03:09 PM
Isn't Java going to get strangled to death quite soon? :confused:

By?

Its more popular than one might think - especially in embedded systems and JVM on a chip...

kettle
Feb 28, 2005, 05:21 PM
By?

Its more popular than one might think - especially in embedded systems and JVM on a chip...

yeah, I wasn't meaning its usefulness, more the tit for tat Microsoft v Sun trying to trip each other up, generally making it a headache to use cross platform.

That was the last I was reading about it, some sort of legal crud messing things up for people.

jeremy.king
Feb 28, 2005, 09:09 PM
yeah, I wasn't meaning its usefulness, more the tit for tat Microsoft v Sun trying to trip each other up, generally making it a headache to use cross platform.

That was the last I was reading about it, some sort of legal crud messing things up for people.

We'll I'll assure you, disputes aside (which have been ongoing for years), Java isn't going anywhere. Sun will tank before Java, since it has quite the following and Big Blue waiting to gobble it up...That is, unless Ruby takes off...

juhani
Mar 3, 2005, 11:43 AM
Perhaps a class or college course might help.

As for a book, look for books with command line examples to start. This will help you understand the ideas of compiling into bytecode (javac) and then running it (java). Assuming you have the JDK installed on your mac, these will be available using Terminal.

Or if you want the "easy" way out, download and install Eclipse (http://www.eclipse.org) and use that to run programs. It may be above your head (right now), however.

Well actually I am planning to go to university next year to study IT and although they don't expect me to know Java or any other programming language I'm still very eager to get started by myself.

And I don't want an easy way out! I'd like to understand the core of the programming and for example why am I doing something when I'm doing it and so on. Not just enter the code and press buttons. So I think I'm going to work with Terminal for a while before taking up XCode or something else. It's just.. when, for example, I enter open Hello.java then the system still opens the file in XCode. Isn't it possible to do everything in Terminal?

jeremy.king
Mar 3, 2005, 12:05 PM
An uber geek might say use vi to edit your files.

I would suggest you change the application associated with .java files. You can do this in the Get Info window on the file.

SubEthaEdit (http://www.codingmonkeys.de/subethaedit/) is a good text editor amongst others.

juhani
Mar 4, 2005, 02:04 PM
An uber geek might say use vi to edit your files.

All right... although i don't know what the 'vi' is.. but i'm going to find out!

mwpeters8182
Mar 17, 2005, 11:38 PM
I wouldn't suggest VI for someone new to the programming game - unless you're the type that does everything in the terminal. Go for textwrangler, from the same folks who make BBEdit. It does syntax highlighting, and isn't a resource hog.

<MP>

netytan
Mar 18, 2005, 06:31 AM
We'll I'll assure you, disputes aside (which have been ongoing for years), Java isn't going anywhere. Sun will tank before Java, since it has quite the following and Big Blue waiting to gobble it up...That is, unless Ruby takes off...

I agree that Java isn't going anywhere just yet but it is loosing a lot of ground to M$.NET.

Personally I try to stay away from anything M$ has touched but since C# is becoming the first language taught in education it's getting harder to avoid.

Luckily there is an Open source alternative: Mono. But I'm not sure about the state of play when it comes to making Cocoa applications with C#. I'm sure there's a way.

Mark.

kettle
Mar 18, 2005, 07:15 AM
Is Java going to become open source?

DavidLeblond
Mar 18, 2005, 07:50 AM
Perhaps a class or college course might help.

As for a book, look for books with command line examples to start. This will help you understand the ideas of compiling into bytecode (javac) and then running it (java). Assuming you have the JDK installed on your mac, these will be available using Terminal.

Or if you want the "easy" way out, download and install Eclipse (http://www.eclipse.org) and use that to run programs. It may be above your head (right now), however.

I gotta support his plug for Eclipse. That is the only tool I ever use to do my Java coding in. I don't see it as being the "easy way out" though. When you get further along in your programming, you're going to want a debugger.