This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
Joined: Dec 02, 2005
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...
Joined: Dec 02, 2005
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.