Results 1 to 15 of 15
  1. #1
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Help!! Eclipse does not create runnable .jar

    Hello and congratulations for the forum.
    Given that I am not an expert, some days I have a problem with eclipse.
    I wanted to download the source code of a program to customize it and so I downloaded Java 1.8 and JDK8, Eclipse Moon, and the source code to work on.
    I do not know if you can make the program name?
    I followed the instructions I found on the support page.

    __________________________________________________ ______
    Prerequisites:

    Decide if you want to develop with 64-bit or 32-bit tools. Make sure you download all of one type. Try 64-bit if unsure.
    Make sure you have a Java Runtime Environment (JRE)
    Make sure you have a Java SE Development Kit (JDK)
    Installing/configuring Eclipse
    Note: Below instructions are the main points. There are several dialogs/options not discussed. If you see one you’re not sure what to do with, just accept the defaults.

    Download Eclipse IDE for Java Developers
    Extract the zip, put the eclipse directory where you like
    Run the eclipse application
    Update eclipse by: click Help then Check for Updates
    Update the Maven plugin by:
    Click Help then Eclipse Marketplace…
    Type Maven in the Find box and click the magnifying glass
    Disregard the results and click the Installed tab. [Note: This is an odd way of doing things because of a quirk in Eclipse. If you click Installed without first doing the search, Installed will erroneously show that no plugins are installed.]
    Click the Update button for Maven Integration for Eclipse (Luna) 1.5.0
    Install SVN support using the Subversive – SVN Team Provider 3.0.0 plugin by:
    Click the Popular tab
    Click the Install button for Subversive – SVN Team Provider 3.0.0
    Select the option to install Subversive SVN Integration for the M2E Project (Optional) and click Confirm
    Developing NameProgram

    File, Import, SVN, Project from SVN
    A dialog to choose SVN external connectors pops up. Pick the top two, Java connectors for 1.7 and 1.8
    Restart eclipse as prompted and import SVN again. Important: Make sure you notice the Check Out As dialog as you move through the import process (step 4 below.) URL is: svn://svn.code.sf.net/p/nameprogram/code. Note: When prompted aboutRevision, Head Revision is the most recent version of the repository.
    When you see the Check Out As dialog, select the second option, Find projects in the children of the selected resource
    Once import is complete, right click on the project, click Maven and Update Project…
    Right click on the project, Run As, and 2 Java Application. The Java Application is Main–com.nameprogram.main

    Instructions as of July 2015 based on Windows OS
    __________________________________________________ ______
    And 'it will see that the information is old, but when I tried to create the jar file bootable, I was successful

    The procedure was: (or at least I remember well)

    To create a new runnable JAR file in the workbench:

    1) From the menu bar's File menu, select Export.
    2) Expand the Java node and select Runnable JAR file. Click Next.
    3) In the Opens the Runnable JAR export wizard Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JAR.
    4) In the Export destination field, either type or click Browse to select a location for the JAR file.
    5) Select an appropriate library handling strategy.
    Optionally, you can also create an ANT script to quickly regenerate a previously created runnable JAR file.

    - - - - - - - --

    My problem is that now creates a file that does not start.

    thinking that i changed something, I uninstalled it, cleaned and reinstalled everything.

    Then I downloaded the source code again, without making any changes, I tried to compile it.

    It will create a .jar file but does not start.

    After the double click, eEclipse create a folder named "LOG" with a single text file inside, named "net.authorize.aim"

    I asked for help on the software forum but have not received any response.
    I hope that you can help me.

    Thank you

    Enrico
    Last edited by enricosarni; 08-25-2016 at 01:56 PM.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: Help!! Eclipse does not create runnable .jar

    Open the jar file (it's a simple zip file) and see if there's a manifest file in the META-INF directory.
    That file should mention the main class.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Help!! Eclipse does not create runnable .jar

    creates a file that does not start.
    Check if there are any error messages by opening a command prompt window, changing directories to the location of the jar file and entering:
    java -jar THEJARFILENAME.jar

    Any error messages should show in the window. Copy the full text of the messages and paste it here.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    @Tolls, @Norm

    Thank you for the answers. I want to know if I can do the program name.
    It is a freely editable Oper Source program.
    If you load a file here on the forum the name comes out for sure

  5. #5
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    @Norm

    Following your advice, from the command prompt comes out this:

    Error: Can not find or load the main class com.nameprogram.main

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Help!! Eclipse does not create runnable .jar

    Error: Can not find or load the main class com.nameprogram.main
    That says the manifest file has Main-Class: com.nameprogram.main
    However the jar file does not contain a main.class file in the com.nameprogram folder.
    Open the jar file with a zip file utility and check if there is a main.class file in the com.nameprogram folder.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    If I open with winrar, I find the "Main.class" file in the directory: com \ <nameprogram> \ main \ Main.class "

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: Help!! Eclipse does not create runnable .jar

    Compare that with the entry in the MANIFEST.
    Because the error you mention does not talk about Main.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    @Tolls

    At the end of Manifest file i find this line "Main-Class: com.nameprogram.main.Main"

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: Help!! Eclipse does not create runnable .jar

    And when you look at the code in Eclipse does Main.java actually have a proper "static void main()" method?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    Excuse me but i public all Main.java file. It is located in src> com.nameprogram.main> main.Java

    /**
    * ************************************************** **********************
    * * The contents of this file are subject to the MRPL 1.2
    * * (the "License"), being the Mozilla Public License
    * * Version 1.1 with a permitted attribution clause; you may not use this
    * * file except in compliance with the License. You may obtain a copy of
    * * the License at http://www.floreantpos.org/license.html
    * * Software distributed under the License is distributed on an "AS IS"
    * * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
    * * License for the specific language governing rights and limitations
    * * under the License.
    * * The Original Code is FLOREANT POS.
    * * The Initial Developer of the Original Code is OROCUBE LLC
    * * All portions are Copyright (C) 2015 OROCUBE LLC
    * * All Rights Reserved.
    * ************************************************** **********************
    */
    package com.floreantpos.main;

    import java.io.File;
    import java.io.IOException;
    import java.net.URISyntaxException;
    import java.util.ArrayList;

    import org.apache.commons.cli.BasicParser;
    import org.apache.commons.cli.CommandLine;
    import org.apache.commons.cli.CommandLineParser;
    import org.apache.commons.cli.Options;

    public class Main {

    private static final String DEVELOPMENT_MODE = "developmentMode"; //$NON-NLS-1$

    /**
    * @param args
    * @throws Exception
    */
    public static void main(String[] args) throws Exception {
    Options options = new Options();
    options.addOption(DEVELOPMENT_MODE, true, "State if this is developmentMode"); //$NON-NLS-1$
    CommandLineParser parser = new BasicParser();
    CommandLine commandLine = parser.parse(options, args);
    String optionValue = commandLine.getOptionValue(DEVELOPMENT_MODE);

    Application application = Application.getInstance();

    if (optionValue != null) {
    application.setDevelopmentMode(Boolean.valueOf(opt ionValue));
    }

    application.start();
    }

    public static void restart() throws IOException, InterruptedException, URISyntaxException {
    final String javaBin = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    final File currentJar = new File(Main.class.getProtectionDomain().getCodeSourc e().getLocation().toURI());

    /* is it a jar file? */
    if (!currentJar.getName().endsWith(".jar")) //$NON-NLS-1$
    return;

    /* Build command: java -jar application.jar */
    final ArrayList<String> command = new ArrayList<String>();
    command.add(javaBin);
    command.add("-jar"); //$NON-NLS-1$
    command.add(currentJar.getPath());

    final ProcessBuilder builder = new ProcessBuilder(command);
    builder.start();
    System.exit(0);
    }
    }

  12. #12
    enricosarni is offline Member
    Join Date
    Aug 2016
    Posts
    7
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    At the end I also published the name of the program. I'm sorry, I do not know if you can make.

  13. #13
    theunlockeRRR is offline Code Child
    Join Date
    Aug 2016
    Location
    Serbia
    Posts
    45
    Rep Power
    0

    Default Re: Help!! Eclipse does not create runnable .jar

    Try changing your package name.
    I have a dream, that one day, I will not rage quit every time I encounter an error I can't fix!

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Help!! Eclipse does not create runnable .jar

    The error message:
    Error: Can not find or load the main class com.nameprogram.main
    says it could not find the class named: main (note: spelled with lowercase m)
    in the package: com.nameprogram

    The manifest said the starting class was:
    "Main-Class: com.nameprogram.main.Main"
    The class would be Main (uppercase M)
    in package: com.nameprogram.main

    The source you posted had the line:
    package com.floreantpos.main;
    and the class was named: Main

    There is a problem with the different names and packages.
    There should be one class in one package that is referenced from the manifest file.

    I don't know how to make your IDE create a valid jar file. I create jar files using the editor for the manifest and the jar command to create the file.
    If you don't understand my response, don't ignore it, ask a question.

  15. #15
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    27

    Default Re: Help!! Eclipse does not create runnable .jar

    The package naming is because the OP was originally avoiding using the actual software name (for some reason I'm not too clear on).

    But they do seem to mix and match the case for the class name.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Using JarOutputStream to create a runnable jar file
    By madcrazydrumma in forum New To Java
    Replies: 4
    Last Post: 04-26-2014, 06:27 PM
  2. Replies: 4
    Last Post: 12-31-2013, 04:11 PM
  3. Make a runnable jar of my project in Eclipse
    By buggedup in forum Eclipse
    Replies: 6
    Last Post: 07-22-2013, 02:00 PM
  4. Including Recources into a runnable JAR using eclipse
    By Lucas_F98 in forum New To Java
    Replies: 16
    Last Post: 01-13-2012, 11:16 AM
  5. create gui using eclipse
    By uthpalaw in forum AWT / Swing
    Replies: 0
    Last Post: 03-12-2011, 11:23 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
  •