Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Could not find or load main class

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Could not find or load main class

    Hi everyone,

    I am trying to execute an sh file but I get the error:
    Could not find or load main class test.test
    The content of the sh file is:

    #! /bin/sh

    properties=....properties
    config=....xml
    classdir=..dir..
    servletlib=....

    java -Xmx1000m -Xss1024k -cp test.jar:$servletlib test.test $properties $config $classdir


    As the sh file is in the same directory as the test.jar, I even tried .. -cp ./test.jar .... but, it still did not work.
    If its important I'm using Win7 and Git bash in order to execute the file.

    Could anyone please guide me?

    Regards


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Could not find or load main class

    The command I would use to execute a jar file called MyJar.jar file would be:

    $ java -jar MyJar.jar

    ('$' is my prompt, not part of the command.)

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Could not find or load main class

    Thanks for the response.
    I agree with you but, this is the way I'm forced to use this shell script in order to execute a tool that I need for testing.
    The way of execution is as I mentioned and I can not change it.

    Could you guide me?

    Regards

Similar Threads

  1. Error: Could not find or load main class
    By lijepdan in forum Java Theory & Questions
    Replies: 8
    Last Post: March 22nd, 2013, 04:32 PM
  2. Can't find Main Class??
    By zlloyd1 in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 12th, 2013, 01:38 PM
  3. Replies: 4
    Last Post: September 3rd, 2012, 02:47 AM
  4. newbie question: Error: Could not find or load main class Java Result: 1
    By ideaman in forum What's Wrong With My Code?
    Replies: 6
    Last Post: January 1st, 2012, 11:40 PM
  5. could not find the main class
    By Tisofa in forum Object Oriented Programming
    Replies: 1
    Last Post: September 27th, 2009, 02:58 AM

Tags for this Thread