Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

stehfee

macrumors newbie
Original poster
Feb 11, 2011
4
0
NY
Okay, so I'm taking a Java course this semester cause for whatever reason, it's required as part of my major requirement (Math Ed.) The prerequisite was Visual Basic, which I took last semester and got an A. So I'm not necessarily stupid, but I DO need to be taught in order to do well. I don't have ANY background knowledge whatsoever.

Okay so here's the thing, in my class, we have Windows desktop computers that we use. We code the Java applications using notepad and save them as a .java file. Then we open up the command prompt, type in 'F:' to get to our USB drives, then type in 'javac FirstProgram.java' to compile our program. Then to run it we type 'java FirstProgram'.

Now here's my issue. I have a Macbook (clearly, hence my presence in this forum). Yet, I would like to do some of my work at home. Last semester sucked having to stay in the school library for various lengths at a time to use Windows for Visual Basic. Plus, these library computers for some reason can't compile the code. =(

Oh, and I don't want to partition my hard drive or anything like that so I can get Windows running cause I won't need it after this semester.

SO how would I do the equivalent of all of that on a Mac? Are there applications already included, or do I have to download something? And if I DO have to download something, what would it be, and is there a free version of it?

Thanks in advance to anyone who helps me. I'd REALLY appreciate it! =D

:apple:
 
Okay so here's the thing, in my class, we have Windows desktop computers that we use. We code the Java applications using notepad and save them as a .java file. Then we open up the command prompt, type in 'F:' to get to our USB drives, then type in 'javac FirstProgram.java' to compile our program. Then to run it we type 'java FirstProgram'.
:apple:

Your Mac already has everything you need to do that. You'll find a command prompt in the Terminal application in /Applications/Utilities. (The Utilities folder which is inside the Applications folder). Then you're good to go:

cd /Volumes/Your_USB_Drive
javac FirstProgram.java
java FirstProgram
 
Your Mac already has everything you need to do that. You'll find a command prompt in the Terminal application in /Applications/Utilities. (The Utilities folder which is inside the Applications folder). Then you're good to go:

cd /Volumes/Your_USB_Drive
javac FirstProgram.java
java FirstProgram

Thank you so much! So I need to type in exactly that? Like I knew about Terminal but I wasn't sure if it already had those capabilities. I also couldn't figure out how to navigate through different drives. xD
 
Thank you so much! So I need to type in exactly that? Like I knew about Terminal but I wasn't sure if it already had those capabilities. I also couldn't figure out how to navigate through different drives. xD
If your USB Drive name has spaces in it, they'll need to be escaped with backslashes. Fortunately, the Terminal will do this for you if you type cd, then a space, then drag the USB drive's icon into the Terminal window.
 
Last edited:
If your USB Drive name has spaces in it, they'll need to be escaped with backslashes. Fortunately, the Terminal will do this for you if you type cd, then a space, then drag the USB drive's icon into the Terminal window.

Okay, I haven't tried that yet cause my USB drive is temporarily misplaced. But I have the code (I typed it into a facebook message earlier so I could copy and paste it). What would I paste the code into? I just tried pasting it into TextEdit and saving it as CandyShop.java, but it says it has to be saved as a .rtf file. So now what?

I'm sorry this seems so elementary. I'm really not super computer illiterate, I swear. xD
 
Okay, I haven't tried that yet cause my USB drive is temporarily misplaced. But I have the code (I typed it into a facebook message earlier so I could copy and paste it). What would I paste the code into? I just tried pasting it into TextEdit and saving it as CandyShop.java, but it says it has to be saved as a .rtf file. So now what?

I'm sorry this seems so elementary. I'm really not super computer illiterate, I swear. xD
You have to convert to plain text in TextEdit first, in order to save files that the Java compiler understands. To do that... choose "Make Plain Text" from TextEdit's Format menu.
 
You have to convert to plain text in TextEdit first, in order to save files that the Java compiler understands. To do that... choose "Make Plain Text" from TextEdit's Format menu.

Oh, wow. I forgot TextEdit isn't plain text. xD THANK YOU SO MUCH! It works now. ^_^ I mean, my program doesn't work cause it hates me, but at least I can figure out my homework on my laptop. Thank you thank you thank youuu! :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.