Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Old Project New XCode: The Main Class Can Not Be Found



I found many other posts in the archives of people experiencing the same problem, but no solutions.

I think I have figured it out, and am posting my change.

The main class, Procession, was declared in a package.

package procession;
...
public class Procession
{
...

My Info.plist MainClass entry had been:

<key>MainClass</key>
<string>Procession</string>

I needed to change it to:

<key>MainClass</key>
<string>procession.Procession</string>

Then the app runs.

Why this hadn't been an issue for several years when I wrote an maintained the app? I don't know.
Something must have changed in XCode's expectations sometime in the recent past. Again, I haven't been working with java for a couple of years.


I hope this information can be of use to others. Especially to all the people new to java who are typing in example code, compiling, seeing runtime failures, and not getting responses on the list.

Thanks,

Xi

On Jul 1, 2007, at 1:32 AM, Xi Golom wrote:

I haven't done any Java development for a few years, and am needing to
make some changes to a Java app last compiled a few versions of XCode
ago.

The last time this app, Procession, was built there were no compile
errors and the app launches and runs as expected.

With a newer XCode, however, the app will not launch (neither from
debugger, nor Finder, nor command line).  Build process is OK.

A dialog is posed which reads 'Cannot launch Java application: the
main class "Procession" could not be loaded'.

Procession.java is compiled in the build process and targeted for the app.

The main class, Procession, is public.

Here's what is sent to the terminal using JAVA_LAUNCHER_VERBOSE

[DmG4Ti:~] dm% /CODE/Procession/build/Debug/Procession.app/Contents/MacOS/Procession
[JavaAppLauncher] adding to JNI library search path:
/CODE/Procession/build/Debug/Procession.app/Contents/Resources/Java:/ System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/ Resources
[JavaAppLauncher] changing current directory to:
/CODE/Procession/build/Debug/Procession.app/..
[JavaAppLauncher] Application specified it needs VM version: 1.4+
[JavaAppLauncher] Will use Java VM version: 1.5.0
[JavaAppLauncher] VM option:
-Xbootclasspath/a:/System/Library/PrivateFrameworks/ JavaApplicationLauncher.framework/Resources/LauncherSupport.jar
[JavaAppLauncher] VM option:
-Djava.class.path=/CODE/Procession/build/Debug/Procession.app/ Contents/Resources/Java/Procession.jar
[JavaAppLauncher] VM option: -Dapple.laf.useScreenMenuBar=true
[JavaAppLauncher] Starting Java VM
[JavaAppLauncher] Entering java
[LaunchRunner] Main class Procession found via 'MainClass' key of
sub-dictionary 'Java' of Info.plist key
[LaunchRunner Error] The main class "Procession" could not be found.
[JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
Exception in thread "main" java.lang.NullPointerException
at apple.launcher.LaunchRunner.run(LaunchRunner.java:85)
at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.j ava:52)


What are the Java app differences between older and newer XCode versions?

I tried starting a new project and copied the Procession source and
resources over to it with the same runtime error results.

What do I need to change to get a formerly working project to play
nicely with new XCode?

Stumped.

-Xi

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/ email@hidden


This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.