-1

Unfortunately i'm stuck supporting a Java 8 application on Mac. The issue is i keep getting: Error: Could not find or load main class com.lionEdge.ranchManager.ui.main.RanchManagerApplication.java

When running the app. Here is the Config file:

    [Application]
    app.name=RanchManagerOSX
    app.mainjar=$APPDIR/Java/ranchManager.jar
    app.version=3.2.8
    app.preferences.id=com/lionEdge/ranchManager/ui/main
    app.mainclass=com/lionEdge/ranchManager/ui/main/RanchManagerApplication
    app.classpath=$APPDIR/Java/jhall.jar: $APPDIR/Java/ranchManager.jar:                $APPDIR/Java/rmHelp.jar
    app.runtime=$APPDIR/PlugIns/Java.runtime
    app.identifier=com.whitemountainslivestock.ranchmanager

    [JVMOptions]

    [JVMUserOptions]
    -Xmx=2048m

    [ArgOptions]

The application runs fine on windows and the path to the main method is correct. I've unpacked the jar and verified the path. Here is the directory structure

```
RanchManagerOSX.app
- Contents
 -- Info.plist
 -- PkgInfo
 --PlugIns (Directory)
  --- Java.runtime
 -- Java (Directory)
  --- jhall.jar
  --- ranchManager.jar
  ---rmHelp.jar
  --- RanchManagerOSX.cfg (contents listed above)
  --- jh.jar
 -- MacOS (Directory)
  --- RanchManagerOSX (executable)
  --- lib packager.dylib
```

Any assistance getting this application working would be greatly appreciated.
**Note: upgrading java versions isn't an option since the application is currently being rewritten in .NET MAUI with a release date (tentative) of Q3 2025.

I've changed the classpath multiple times as well as the order of items in the classpath, I can run the jar directly without issues but the launcher script (RanchManagerOSX) keeps throwing the error.

RESOLUTION: The spaces added to the classpath were causing the error. Once they were removed (i.e. $APPDIR/Java/jhall.jar:$APPDIR/Java/rmHelp.jar etc the issue was resolved.

Josh
  • 15
  • 1
  • 9

1 Answers1

0

Your classpath may be correct, but your main class is not. Instead of

app.mainclass=com/lionEdge/ranchManager/ui/main/RanchManagerApplication.java

use

app.mainclass=com/lionEdge/ranchManager/ui/main/RanchManagerApplication
Queeg
  • 7,748
  • 1
  • 16
  • 42
  • That is one of the things I tried with the same result. Adding the extension was actually a test I hadn’t removed from the cfg yet. I updated the question to reflect that current values. – Josh Aug 09 '23 at 18:51
  • If you checked all that it is unlikely the error message is correct now. Plus: What is the content of your jar? – Queeg Aug 09 '23 at 19:22
  • it's an application for tracking livestock. I pulled out the pdf files etc since they aren't referenced in the code anywhere and I've tried both a jar and runnable jar. The manifest is empty on both. – Josh Aug 09 '23 at 19:31