I have two class files, main.java and CreateUser.java which are both in the same directory, in the same xCode project. When I try to compile, main.java will work (Or pass; I don't know), but on Create user it says it can't import any of the frameworks. What is going on?
What is the error message exactly as it is displayed?
posted 14 years ago
Looking back at my post, Framework was a bad word to use there, Package would be more approprate. I'm fairly new to Java, so I'm totally clueless.
CreateUser.java:8: package com.webobjects.foundation does not exist CreateUser.java:9: package com.webobjects.appserver does not exist CreateUser.java:10: package com.webobjects.eocontrol does not exist CreateUser.java:11: package com.webobjects.eoaccess does not exist CreateUser.java:13: cannot resolve symbol symbol : class WOComponent CreateUser.java:15: cannot resolve symbol symbol : class WOContext
edit: I understand enough to know that the last two errors are caused by the error described in the first 4 [ December 02, 2005: Message edited by: Matt McKay ]
It looks like you need to specify a classpath to tell Java where to find these packages.
I'm not familiar with using xCode, so I don't know what functionality it might have for specifying classpaths in your projects. (You might try searching xCode's Help for "classpath". Also, since this is xCode, you might have better luck on the Mac OS forum.)
You could try simply using the classpath option (-cp) when compiling: javac -cp whereMyPackagesAre MyClass.java
If you decide to set your classpath on a system level, then here's a nice GUI for doing this on Mac...
This thread has been lingering in the beginner forum without much attention. It looks to me like the issue is realted to xCode, and since that's specific to Mac, I'm going to move this to the Mac forum in hopes of getting the attention of someone who knows xCode...
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
posted 14 years ago
Well I posted my question to a WO listserv and found my answer. xCode, by default, adds the new .java files to the wrong build target. To other xCode users: Add it to ApplicationServer, not the project name.