Xcode Classpath

Discussion in 'Mac Apps and Mac App Store' started by crhardnett, Feb 19, 2004.

  1. crhardnett macrumors newbie

    Feb 19, 2004
    Atlanta, GA (EST)

    I am using Xcode to do some java development. I have some JAR files that I need to add to the classpath. I tried changing the project target to add the JAR files. However, this does not seem to update the classpath.

    The detailed build output shows:

    ...stuff deleted...
    classpath="/Users/hardnett/Research/Executive Asst/JudgeApp/build/JudgeApp.build/JudgeApp.build/JavaClasses$frameworkjars:"`/usr/bin/javaconfig DefaultClasspath`
    ...stuff deleted...

    As you can the new classpath is developed from the projects framework jars adn the default classpath. The additional class path found in the Info.plist is not part of the classpath.

    I would like to know if anyone has fixed/workaround this?

    If not, does anyone know where this script exist that performs the compilation and what utility is used to read the Info.plist


  2. gcogar macrumors newbie

    Feb 22, 2004
    Sydney, AU
    Same problem accessing .class files

    I have the same 'problem' accessing .class files rather than .jar files

    how do I tell xcode to find them for compile and run time env's in Java

    at the moment I am developing in pure java (tools)
  3. crhardnett thread starter macrumors newbie

    Feb 19, 2004
    Atlanta, GA (EST)
    A solution


    I did some poking around and developed a solution. I will also send a bug report to Apple about this, and see what happens. There may be something that is undocumented or something that I am completely missing.

    In either case, the solution I have come up with is to check for/create a ~/Library/Java directory. Of course, the ~ is your home directory. This directory was not on my machine so I created it. It turns out that this directory is in the DefaultClasspath for java. This can be confirmed by the following at the prompt:

    % javaconfig DefaultClasspath

    Or you can look in the plist file /System/Library/Java/JavaConfig.plist for the same information.

    In Either case, you can unpack your jar files into the ~/Library/Java directory:

    % cd ~/Library/Java
    % jar xf <jar-file>

    This will of course use more disk space because the compression is lost, but it works. Now your new jar files will be part of the default path. Of course you could also use symbolic links to accomplish the same thing.

    So until I learn of a better way to do this, I am using this method and it works great. Now if I could figure out how to make the Indexing feature index these added classes, then I'd be real happy.

    I hope this helps.

  4. bbosmith macrumors newbie

    Jul 3, 2004
    XCode (Java) Classpath problems continue

    Dear all,

    A previous post said that XCode defaults to finding .class files (and .jars also?) in paths returned with:

    javaconfig DefaultClasspath

    I am currently using XCode 1.1 and it would appear that these other paths are only be used by javac (the compiling arm) and not the java runtime. I have created a package and saved it to /Library/Java. The build/compile process finds this OK, but when I run the project the java.lang.NoClassDefFoundError error is returned.

    I can still run the command-line version but it of course uses CLASSPATH. I set my CLASSPATH to include `javaconfig DefaultClasspath`. If I use javac to compile and then change the CLASSPATH to be something that doesn't include /Library/Java, the same java.lang.NoClassDefFoundError error is returned (thus why I'm saying that the runtime doesn't use the DefaultClasspaths).

    I will upgrade to XCode 1.2 to see if the issue is fixed in that version, however I have read the release notes and it doesn't mention anything about this (mind you any fix could have come in a dot release). If this doesn't fix the problem I will submit a bug report through the means mentioned in the release notes.

    If anyone has any input to this situation I'd appreciate the discussion.


    Brooke :(
  5. bbosmith macrumors newbie

    Jul 3, 2004
    OK, found it!

    I had to subscribe to the http://lists.apple.com xcode-users mailing list to ask the question. I did, received a reply and here is my reply that has the answer.

    Note that my classes are in /Library/Java.

    For complete information, David replied:


Share This Page