Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > ahhh can't run java programs

ahhh can't run java programs
Thread Tools
Junior Member
Join Date: Apr 2004
Location: Winnipeg
Status: Offline
Reply With Quote
May 27, 2004, 03:20 PM
 
Hey there

I just got a mac about a month ago and I want to get java all set up with it using xcode. I installed xcode fine...never chagned anything. I went to the terminal to compile my little java program and that went fine but when I go to run it I get this annoying error "Exception in thread "main" java.lang.NoClassDefFoundError: A5Q1/java"

The java file was A5Q1.java and to run it I typed "java A5Q1.java" and its located on my desktop. It also shouldn't have even have mattered whether or not xcode was installed for me to run or compile this right?

If you can help solve that problem it would be great, so I don't have to use my PC to run my java programs once school starts again in the fall

Also are there any other good coding programs out there for the mac that have a compile now button built in or something like that so I can just avoid the terminal?

Thanks
     
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
May 27, 2004, 03:31 PM
 
The command to run java programs is java <classname> without the brackets. You don't need the file extension.

There are a lot of Java IDEs for Mac OS X, I'd recommend searching this forum for past threads, I know it's been a common discussion topic. I've been using Eclipse lately.
     
Junior Member
Join Date: Apr 2004
Location: Winnipeg
Status: Offline
Reply With Quote
May 27, 2004, 03:34 PM
 
sweet. thanks for hte help...I really should have caught on to that
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
May 27, 2004, 03:56 PM
 
uh.....you compile first like so:

javac A5Q1.java

then you run like so:

java A5Q1


this is the same regardless of platform (windows, solaris, linux, OS X, etc)

Also, get NetBeans.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Forum Regular
Join Date: Sep 2002
Location: The land of evil: Redmond
Status: Offline
Reply With Quote
May 28, 2004, 02:31 PM
 
Another good ide for java is eclipse. I used it for my class last semester and it saved me lots of time.
12" PB 867 *Retired :( *
2.2 Ghz 15" Macbook Pro
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:33 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2