IkovPS

Thread: HOW TO FIX: Error. Click for details + Could not find the main class: client

Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1 HOW TO FIX: Error. Click for details + Could not find the main class: client 
    Donator


    Join Date
    Feb 2012
    Posts
    532
    Thanks given
    42
    Thanks received
    38
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    113
    Some as i seen VERY many Threads and Topics for "make me a .jar" "Help: Jarring" "Error when jarring" Etc, Since i know how to fix this as i normally get paid for doing so, I don't have the time to spend on making everyone a .jar file, so; Here is how you fix these problems.

    Web Client: Error. Click for details
    .Jar File: Could not find the main class: client. Program will exit.

    The problem: Your current version of JDK you are using is 1.7.0 or Higher.

    The fix: Steps
    1. Remove your current version of JDK.

    2. Download [Only registered and activated users can see links. ]

    3. Install JDK 6 Update 29.

    4. Change your compiler to the correct path for your signlink also your source compiler.

    4a. How to change your compliers: If you are using the suggested jdk do as i do,
    Right click on your compiler.bat or build.bat which ever you have: And click edit: Locate something that looks like this, "C:\Program Files\Java\jdk1.6.0_31\bin\javac.exe" Change the "jdk1.6.0_31" to "jdk1.6.0_29"

    5. Compile your signlink twice and compile your source twice. (Sometimes there are Bad complies; I've seen it happen.)

    6. Jar your client.
    6a. I do not own this youtube video
    Spoiler for Youtube Video using Jarmaker:



    I do own this: I am 'Java Programmer' From [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Spoiler for Using command lines with a .bat compiler:

    Index:

    1. PATH & CLASSPATH Environment Variables
    2. Making Code
    3. Compiling Your Code
    4. The Set Up
    5. Making A Jar File









    1. First You Need To Set You're PATH & CLASSPATH In your Environment Variables.

    [Only registered and activated users can see links. ]

    Notice: You Version Of Java jdk Might Not Be The Same, So Here's How To Find It:

    Start -> My Computer -> Local Disk -> Program Files -> Java

    You Should See A Folder Like jdk#.#.#_## Or Something In That Nature
    This is you version of jdk that needed to be in the PATH & CLASSPATH In your Environment Variables

    Example(s):

    User Variables For [user]
    PATH C:\Program Files\Java\jdk#.#.#_##\bin

    System Variables
    CLASSPATH C:\Program Files\Java\jdk#.#.#_##\bin



    Once you sent that your ready to go.










    2. Making Code:

    NOTICE: MAKE A NEW FOLDER ON YOUR DESKTOP TO CONTAIN EVERYTHING
    NOTICE: MY FOLDERS NAME IS "ExampleJar"

    This Is For A Jar Using 2 Classes:

    ExampleClass.java
    Code:
    import javax.swing.JFrame;
    
    public class ExampleClass{
    	public static void main(String[] args){
    		
    		ExampleClass2 JFrameclass = new ExampleClass2();
    		JFrameclass.setSize(200,50);
    		JFrameclass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    		JFrameclass.setVisible(true);
    	}
    }
    ExampleClass2.java
    Code:
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    
    public class ExampleClass2 extends JFrame{
    
    	private JLabel ExampleLabel;
    		public ExampleClass2(){
    		
    			super("Example");
    			
    			ExampleLabel = new JLabel("Example",10);
    			add(ExampleLabel);
    		
    	}
    
    }
    Save This As .Java Files Using Notepad


    MAIN-INF

    So now you need to tell your jar file which is the main class, This is called MANIFEST.
    For this tutorial The main class ExampleClass.

    Code:
    Main-Class: ExampleClass
    Save this a manifest.txt
    NOTICE: THIS IS SUPER IMPORTANT:
    AFTER TYPING "Main-Class: ExampleClass" PRESS ENTER OR YOU WILL GET A ERROR!













    3. Compiling Your Code

    Short & Sweet:

    Simple Batch Compiler: Type:
    Code:
    @echo off
    if exist "C:\Program Files (x86)\" set programfiles=C:\Program Files (x86)
    set pro=%programfiles%\Java\jdk1.7.0_02
    set pro2=%programfiles%\Java\jdk1.7.0_02
    set jac=\bin\javac.exe
    set jav=\bin\java.exe
    :co1
    set b=0
    set t=7
    goto co2
    :co2
    color %b%%t%
    :menu
    cls
    title The Perfect Compiler version 2.0
    echo Please choose an option below to do that function.
    echo.
    echo c - Compile your server.
    echo.
    echo.
    set /p c=Option:
    if %c%==c goto c
    if %c%==C goto c
    if %c%==* goto er
    goto er
    :color
    cls
    echo Would you like to change the backround color, change
    echo the text color, or reset it to default?
    echo.
    echo back - Change the backround color.
    echo text - Change the text color.
    echo def - Change all colors back to default.
    echo.
    echo.
    cls
    :c
    cls
    title Compiler
    goto cjc
    :c2
    if exist src (goto cl) else (goto c3)
    :c3
    if exist *.java (goto cl2) else (goto ce)
    :c4
    %javac% -cp . *.java
    echo Files Compiled Successfully!
    pause
    cls
    goto menu
    :c5
    %javac% -cp . .\src\*.java
    echo Files Compiled Successfully!
    pause
    move .\src\*.class .\classes\
    cls
    goto menu
    :ce
    cls
    echo You need to have Java files for this Compiler to Compile.
    pause
    cls
    goto menu
    :er
    cls
    title Error
    echo Invalid command. Please make sure the commands you type
    echo in are correct.
    pause
    cls
    goto menu
    :e
    cls
    exit
    :cjc
    if exist "%pro%_06%jac%" (goto sjc) else (goto cjc2)
    :cjc2
    if exist "%pro%_07%jac%" (goto sjc2) else (goto cjc3)
    :cjc3
    if exist "%pro%_08%jac%" (goto sjc3) else (goto cjc4)
    :cjc4
    if exist "%pro%_09%jac%" (goto sjc4) else (goto cjc5)
    :cjc5
    if exist "%pro%_10%jac%" (goto sjc5) else (goto cjc6)
    :cjc6
    if exist "%pro2%%jac%" (goto sjc6) else (goto cjc7)
    :cjc7
    if exist "%pro%%jac%" (goto sjc7) else (goto cjc8)
    :cjc8
    if exist "%pro%_01%jac%" (goto sjc8) else (goto cjc9)
    :cjc9
    if exist "%pro%_02%jac%" (goto sjc9) else (goto cjc10)
    :cjc10
    if exist "%pro%_03%jac%" (goto sjc10) else (goto cjc11)
    :cjc11
    if exist "%pro%_04%jac%" (goto sjc11) else (goto cjc12)
    :cjc12
    if exist "%pro%_05%jac%" (goto sjc12) else (goto je)
    :sjc
    set javac="%pro%_06%jac%"
    goto c2
    :sjc2
    set javac="%pro%_07%jac%"
    goto c2
    :sjc3
    set javac="%pro%_08%jac%"
    goto c2
    :sjc4
    set javac="%pro%_09%jac%"
    goto c2
    :sjc5
    set javac="%pro%_10%jac%"
    goto c2
    :sjc6
    set javac="%pro2%%jac%"
    goto c2
    :sjc7
    set javac="%pro%%jac%"
    goto c2
    :sjc8
    set javac="%pro%_01%jac%"
    goto c2
    :sjc9
    set javac="%pro%_02%jac%"
    goto c2
    :sjc10
    set javac="%pro%_03%jac%"
    goto c2
    :sjc11
    set javac="%pro%_04%jac%"
    goto c2
    :sjc12
    set javac="%pro%_05%jac%"
    goto c2
    :cj
    if exist "%pro%_06%jav%" (goto sj) else (goto cj2)
    :cj2
    if exist "%pro%_07%jav%" (goto sj2) else (goto cj3)
    :cj3
    if exist "%pro%_08%jav%" (goto sj3) else (goto cj4)
    :cj4
    if exist "%pro%_09%jav%" (goto sj4) else (goto cj5)
    :cj5
    if exist "%pro%_10%jav%" (goto sj5) else (goto cj6)
    :cj6
    if exist "%pro2%%jav%" (goto sj6) else (goto cj7)
    :cj7
    if exist "%pro%%jav%" (goto sj7) else (goto cj8)
    :cj8
    if exist "%pro%_01%jav%" (goto sj8) else (goto cj9)
    :cj9
    if exist "%pro%_02%jav%" (goto sj9) else (goto cj10)
    :cj10
    if exist "%pro%_03%jav%" (goto sj10) else (goto cj11)
    :cj11
    if exist "%pro%_04%jav%" (goto sj11) else (goto cj12)
    :cj12
    if exist "%pro%_05%jav%" (goto sj12) else (goto je)
    :sj
    set java="%pro%_06%jav%"
    goto r2
    :sj2
    set java="%pro%_07%jav%"
    goto r2
    :sj3
    set java="%pro%_08%jav%"
    goto r2
    :sj4
    set java="%pro%_09%jav%"
    goto r2
    :sj5
    set java="%pro%_10%jav%"
    goto r2
    :sj6
    set java="%pro2%%jav%"
    goto r2
    :sj7
    set java="%pro%%jav%"
    goto r2
    :sj8
    set java="%pro%_01%jav%"
    goto r2
    :sj9
    set java="%pro%_02%jav%"
    goto r2
    :sj10
    set java="%pro%_03%jav%"
    goto r2
    :sj11
    set java="%pro%_04%jav%"
    goto r2
    :sj12
    set java="%pro%_05%jav%"
    goto r2
    :je
    cls
    title Error
    echo You do not have JDK 5.0 or JDK 6.0. Go to od Taharok's tutorial
    echo on the moparscape Tuturoials section for step-by-step instructions
    echo link to download the newest JDK Update.
    pause
    cls
    goto menu
    :sl
    cls
    echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
    echo Server was run using %java%. >> "Compile Logs.txt"
    echo Thank-you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto r5
    :sl2
    cls
    echo Ran Server at %time% and on %date%. >> "Compile Logs.txt"
    echo Server was run using %java%. >> "Compile Logs.txt"
    echo Thank-you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto r6
    :cl
    cls
    echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
    echo Java files were compiled using %javac%. >> "Compile Logs.txt"
    echo Thank-you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto c5
    :cl2
    cls
    echo Compiled Java files at %time% and on %date%. >> "Compile Logs.txt"
    echo Java files were compiled using %javac%. >> "Compile Logs.txt"
    echo Thank-you for using Mod Taharok's 'Perfect' Compiler! >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto c4
    :reset
    cls
    echo Resetting the Compiler's Logs...
    pause
    del "Compile Logs.txt"
    echo ----------Compiler Logs---------- >> "Compile Logs.txt"
    echo. >> "Compile Logs.txt"
    goto menu
    Save As Compiler.bat

    NOTICE: THIS COMPILER DOES NOT BELONG TO ME!
    NOTICE: ADD THIS COMPILER TO ExampleJar/ OR THE NAME OF YOUR FOLDER!

    Owner Of Compiler:[Only registered and activated users can see links. ]








    4. The Set Up:

    This is what you should have so far:
    [Only registered and activated users can see links. ]


    5. COMPILING:

    Double-Click The Compiler
    Press "C"
    Press Enter

    If Done Correctly You Should See
    Code:
    Files Compiled Successfully!
    Press any key to continue . . .
    Also ExampleClass.class & ExampleClass2.class
    Also A Compile Logs: You Can Delete That, That Is Not Needed (its in the compiler)

    This Is What You Should Have Now:
    [Only registered and activated users can see links. ]






    5. Making A Jar File:

    Notice: Spelling Is Absolutely Importing, Make Sure Everything Is Correct Before Proceeding.

    First:

    Open ExampleJar/Your Folder on your desktop
    Right click ExampleClass.java
    Open Properties
    You Will See Location: This Is Very Important. (LEAVE PROPERTIES OPEN)


    Second:

    Start-> Run-> CMD

    We Need To Change Are Directory To Are Local Disk
    So In This Case My Local Disk Is C:

    So Type: cd C:\
    You should See C:\

    Now Remember The Location From Earlier?

    Type cd "*Location Form Earlier*"



    Example:

    I Typed Whats In Bold

    C:\>cd "Documents and Settings\Owner\Desktop\ExampleJar

    Now The New Directory Is:
    C:\Documents and Settings\Owner\Desktop\ExampleJar>



    Making The Jar File:

    Follow Closely (MOST IMPORTANT PART)

    Now In CMD Where It Says: C:\Documents and Settings\Owner\Desktop\ExampleJar>

    Type:

    C:\Documents and Settings\Owner\Desktop\ExampleJar>jar cfmv ExampleJar.jar MANIFEST.txt ExampleClass.class ExampleClass2.class

    You Should Then See:

    added manifest
    adding: ExampleClass.class(in = 438) (out= 319)(deflated 27%)
    adding: ExampleClass2.class(in = 453) (out= 300)(deflated 33%)

    C:\Documents and Settings\Owner\Desktop\ExampleJar>

    NOTICE: IF YOU SEE
    Code:
    java.io.FileNotFoundException: MAINFEST.txt (The system cannot find the file spe
    cified)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(FileInputStream.java:138)
            at java.io.FileInputStream.<init>(FileInputStream.java:97)
            at sun.tools.jar.Main.run(Main.java:171)
            at sun.tools.jar.Main.main(Main.java:1177)
    THE FILES IN NOT THERE YOU YOU HAD MADE A SPELLING ERROR


    Now there should be a jar file in ExampleJar On your desktop.

    You Have Created Your Very Own Executable Jar File




    Any questions or other problems let me know, I'd be happy to take a look at them and help you if i have the knowledge of the situation.
    Tutorial: [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Super Donator


    Join Date
    Sep 2011
    Posts
    1,413
    Thanks given
    135
    Thanks received
    271
    Time Online
    1 h 58 m
    Avg. Time Online
    6 m
    Rep Power
    263
    Ye i figured this out on my own but i wanted to know why :\
    Reply With Quote  
     

  3. #3  
    Registered Member rs r's Avatar
    Join Date
    Oct 2009
    Age
    18
    Posts
    268
    Thanks given
    32
    Thanks received
    6
    Time Online
    1 h 49 m
    Avg. Time Online
    5 m
    Rep Power
    6
    Quote Originally Posted by -Null Code- View Post
    Ye i figured this out on my own but i wanted to know why :\
    Because some of your players doesnt have java 7 i think?.
    Reply With Quote  
     

  4. #4  
    [style]Client God[/style]


    Join Date
    Dec 2007
    Age
    21
    Posts
    1,988
    Thanks given
    259
    Thanks received
    328
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    835
    The fact that we even need this thread shows that the community is way below rock bottem..

    [Only registered and activated users can see links. ]
    R-S Admin Response  Numbers
    I like man cocks!

    Reply With Quote  
     

  5. Thankful users:


  6. #5  
    Donator


    Join Date
    Feb 2012
    Posts
    532
    Thanks given
    42
    Thanks received
    38
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    113
    Quote Originally Posted by Clienthax View Post
    The fact that we even need this thread shows that the community is way below rock bottem..
    I don't count simple mistakes people make called rock bottom, Even 'moparscape' users are having this problem and this is the correct way to fix it.
    Tutorial: [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #6  
    Registered Member
    Enjoi's Avatar
    Join Date
    Sep 2008
    Age
    20
    Posts
    2,368
    Thanks given
    504
    Thanks received
    261
    Time Online
    32 m
    Avg. Time Online
    1 m
    Rep Power
    1288
    steps 4 and 6 are a bit vague for people who don't know about it. Mind expanding?
    Reply With Quote  
     

  8. #7  
    Donator


    Join Date
    Feb 2012
    Posts
    532
    Thanks given
    42
    Thanks received
    38
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    113
    Quote Originally Posted by Enjoi View Post
    steps 4 and 6 are a bit vague for people who don't know about it. Mind expanding?
    Done, Expanded to my best ability.
    Tutorial: [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. #8  
    [style]Client God[/style]


    Join Date
    Dec 2007
    Age
    21
    Posts
    1,988
    Thanks given
    259
    Thanks received
    328
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    835
    people should atleast know how to compile a java program before starting rsps..

    [Only registered and activated users can see links. ]
    R-S Admin Response  Numbers
    I like man cocks!

    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Registered Member
    packersfan84's Avatar
    Join Date
    Dec 2010
    Age
    13
    Posts
    2,845
    Thanks given
    475
    Thanks received
    1,588
    Time Online
    2 d 19 h 45 m
    Avg. Time Online
    3 h 39 m
    Rep Power
    3628
    Quote Originally Posted by Captain Price View Post
    I don't count simple mistakes people make called rock bottom, Even 'moparscape' users are having this problem and this is the correct way to fix it.
    >even moparscape users



    please leave and don't come back
    Signature Removed due to violation of rules

    Hey mods ( ͜ʖ͡)╭∩╮
    Reply With Quote  
     


  12. #10  
    Donator


    Join Date
    Feb 2012
    Posts
    532
    Thanks given
    42
    Thanks received
    38
    Time Online
    N/A
    Avg. Time Online
    N/A
    Rep Power
    113
    Quote Originally Posted by Thee End View Post
    >even moparscape users



    please leave and don't come back
    yes i use to help people until i noticed r-s is 200% better.
    Tutorial: [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 01-13-2013, 11:52 PM
  2. Replies: 6
    Last Post: 01-19-2012, 05:37 AM
  3. Replies: 2
    Last Post: 11-11-2011, 07:56 AM
  4. Replies: 3
    Last Post: 10-20-2011, 10:17 PM
  5. Replies: 0
    Last Post: 10-20-2011, 04:44 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •