Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

Cannot find main class

Thread view: 
Ike - 30 Jan 2007 19:12 GMT
I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in a
directory on  WinXP machine. when he goes to that directory, and enters at a
DOS prompt:

javaw -cp Hydroline.jar;LiquidLnF.jar HydroLine.HydroLine

He gets a dialog box that says "Java Virtual Machine Loader.....Could not
find the main class. Program will exit."

The main class is HydroLine.HydroLine, as specified in the HydroLine.jar's
manifest file. Additionally, the class HydroLine.HydroLine is in that jar
file.

When I go to run this on my machine, it works fine. Anyone have any ideas
what might be the problem here? Thanks. -Ike
Manish Pandit - 30 Jan 2007 19:53 GMT
> I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in a
> directory on  WinXP machine. when he goes to that directory, and enters at a
[quoted text clipped - 11 lines]
> When I go to run this on my machine, it works fine. Anyone have any ideas
> what might be the problem here? Thanks. -Ike

Can you try:

java -jar HydroLine.jar ?

-cheers,
Manish
Oliver Wong - 30 Jan 2007 20:16 GMT
>I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in
>a directory on  WinXP machine. when he goes to that directory, and enters
[quoted text clipped - 11 lines]
> When I go to run this on my machine, it works fine. Anyone have any ideas
> what might be the problem here? Thanks. -Ike

   I think the recommended way of running an application in a jar is to use
the "-jar" flag, as in "java -jar Hydroline.jar". The Hydronline.jar's
manifest file would specify the main class, and any other jar it depends on
(i.e. the LiquidLnF.jar). See
http://java.sun.com/docs/books/tutorial/deployment/jar/run.html

   - Oliver
Knute Johnson - 31 Jan 2007 01:01 GMT
> I have a client who has two jar files, Hydroline.jar and LiquidLnF.jar, in a
> directory on  WinXP machine. when he goes to that directory, and enters at a
[quoted text clipped - 11 lines]
> When I go to run this on my machine, it works fine. Anyone have any ideas
> what might be the problem here? Thanks. -Ike

-cp and -jar are mutually exclusive and -jar has priority.  You cannot
specify a classpath with the -cp option if you specify the -jar option.
 All classpath arguments must be in the manifest file for jarred
applications.

Signature

Knute Johnson
email s/nospam/knute/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.