1

I've been working on porting a Java application from a Solaris Server to a Windows Server. I've finally gotten the calling scripts rewritten to supply the java launch command all of the appropriate information (I think). However, I continue to get

Could not find the main class: com.dir1.dir2.dir3.dir4.ManagementAgent. Program will exit.

This path and file do exist in one of the jar files (the first in the CLASSPATH) and it resides in the path shown (e.g. the absolute path to the class file if the jar were expanded would be c:\apps\ecs\bin\com\dir1\dir2\dir3\dir4\ManagementAgent.class)

I've been following the directions from this Q&A but continue to receive the error.

Obviously I've not fixed something but I can figure out what that might be.

%JAVA_HOME%\bin\javaw.exe -Xms512m -Xmx1024m -cp .\ecs.jar;.\ect.jar;.\jmxri.jar;.\jmxtools.jar;.\log4j.jar;.\xercesImp.jar;.\xalan.jar;.\weblogic81.jar;.\classes12_9i.zip;.\localEJB.jar;.\tct_ip1.1.jar com.dir1.dir2.dir3.dir4.ManagementAgent

I execute the command from the directory which contains all of the jars. I've tried several variations of the CLASSPATH (shown below):

  1. Relative paths; generically calling jars & class (e.g. .\*;.)
  2. Absolute path, generically calling jars & class (e.g. c:\apps\ecs\bin\*;c:\apps\ecs\bin)
  3. Relative paths, explicitly calling jars (shown above)
  4. Absolute paths, explicitly calling jars (how it was executed on Solaris Server)

But no combination seems to work.

Community
  • 1
  • 1
Jim2B
  • 167
  • 9
  • Follow-up to this. I eventually found the solution to this - it appears that the problem was either that the installed java was the 32 bit and code required the 64 bit install or that the java version was too low (though they were same point release, just different updates), or both. – Jim2B Jan 24 '16 at 18:52

1 Answers1

1

If you haven't already I'd recommend double checking the paths in your jar using this command:

jar tf .\ecs.jar

You should only see a relative path to your class file, i.e.:

com/dir1/dir2/dir3/dir4/ManagementAgent.class

I would also verify that ManagmentAgent's main method is static and takes a String[] as its only argument.

Edit: I would also verify that you are using a version of Java that is as high or higher than the version the app was compiled with. You can check this using:

java -version

Hope this helps, good luck!

Ian Lovejoy
  • 376
  • 4
  • 7