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 4 of 4

Thread: I need assistance ASAP with command "-classpath"

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I need assistance ASAP with command "-classpath"

    Hello,
    I am not familiar with Java but I am trying to apply for a job in testting the following java application.
    I have received a tool written in Java and I need to run it with the command line:

    java -classpath ./bin com.test.Main myinputfile.txt myoutputfile.txt sort

    Main class should receive 3 parameters: inputfile, outputfile, action.

    Of course I have installed Java on my computer (Windows env.).

    The problem is that I receive this error:
    "could not find or load main class com.test.Main"

    I searched over the Internet and I saw that I need to specify the path where "Main" class is located.
    Main class is located in my c:\rachel\FileManipulator\bin\com\test

    What should I type exactly in order to run this Main class please?

    Waiting for your kindly reply, please a.s.a.p.....

    Thansk you!!! Rachel


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: I need assistance ASAP with command "-classpath"

    With the command line:
    java -classpath ./bin com.test.Main myinputfile.txt myoutputfile.txt sort
    The bin directory needs to be in the current directory
    and the com directory needs to be in the bin folder

    What was the current directory where the java command was entered?

    It'd help if you'd copy and paste here the full contents of the command prompt window.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I need assistance ASAP with command "-classpath"

    Quote Originally Posted by Norm View Post
    With the command line:
    java -classpath ./bin com.test.Main myinputfile.txt myoutputfile.txt sort
    The bin directory needs to be in the current directory
    and the com directory needs to be in the bin folder

    What was the current directory where the java command was entered?

    It'd help if you'd copy and paste here the full contents of the command prompt window.
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

    Thanks for the fast response!

    I understand that I have to change the directory first and then run the command line I attached above.

    To which directory exactly should I change before I run this command line: to change directory to Bin or Com or FileManipulator?

    Thanks again,
    Rachel

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: I need assistance ASAP with command "-classpath"

    Change to the directory that contains the bin directory and enter:
    java -classpath ./bin com.test.Main myinputfile.txt myoutputfile.txt sort

    That directory should contain the myinputfile.txt file.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 2
    Last Post: May 22nd, 2014, 01:17 PM
  2. Where to place "openTo()" command to make the script work?
    By nachalnik in forum Other Programming Languages
    Replies: 1
    Last Post: April 15th, 2014, 06:11 AM
  3. Replies: 3
    Last Post: July 3rd, 2013, 08:25 AM
  4. Replies: 2
    Last Post: June 22nd, 2013, 10:30 AM
  5. "net use" command not working
    By java_techie in forum Java Networking
    Replies: 0
    Last Post: April 5th, 2012, 04:30 AM