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

Thread: can't open jar file

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

    Default can't open jar file

    I can't open this jar file:

    JLink - Flow Charts With Java | Free Home & Education software downloads at SourceForge.net

    first i double clicked ,but failed.
    then from cmd i set path and tried but the manifest main class error came.
    i tried to add main class :JLinkFeatures.class to manifest,but then it could not find class.
    i tried to add main class :JLink.class to manifest,but then lots of errors with no main class found error.

    please explain what is required.


  2. #2

    Default Re: can't open jar file

    Does the class JLinkFeatures belong to a package? I guess you didn't specify a fully qualify name, such as com.mypackage.JLinkFeature, so that Java couldn't find the class.

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

    Default Re: can't open jar file

    Manifest.mf :

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 1.6.0_03-b05 (Sun Microsystems Inc.)
    Main class : jlink.example.JLinkFeatures.class



    JLinkFeatures.class
    package jlink.example;
     
    import java.awt.*;
    import java.io.PrintStream;
    import javax.swing.*;
    import jlink.flowchart.*;
    import jlink.flowchart.graph.JLGraph;
    import jlink.icon.JLinkImageDistributor;
     
    // Referenced classes of package jlink.example:
    //            JLinkGraphModelExample
     
    public class JLinkFeatures
    {
     
        JFrame frame;
        String titleString;
        JLFlowchart flowchart1;
        JLFlowchart flowchart2;
        JLFlowchart flowchart3;
        JLFlowchart flowchart4;
        JLGraph graph;
        JLCanvas canvas;
        JLabel status;
     
        public JLinkFeatures()
        {
            frame = new JFrame();
            titleString = new String("Untitled Document");
            graph = new JLGraph();
            canvas = new JLCanvas();
            status = new JLabel("JLink Flowchart Authoring Tool v1.0");
            frame.setTitle(titleString);
            frame.setIconImage((new JLinkImageDistributor()).getJLinkWindowImage());
            flowchart1 = new JLFlowchart(graph, 3, Color.WHITE, Color.BLACK, Color.BLACK, new Dimension(500, 600));
            flowchart2 = new JLFlowchart(graph, 5, Color.WHITE, Color.BLACK, Color.BLACK, new Dimension(500, 600));
            flowchart3 = new JLFlowchart(graph, 4, Color.WHITE, Color.BLACK, Color.BLACK, new Dimension(500, 600));
            flowchart4 = new JLFlowchart(graph, 1, Color.WHITE, Color.BLACK, Color.BLACK, new Dimension(500, 600));
            flowchart4.setJLPageOrientation(10);
            JLWorksheet ws = new JLWorksheet();
            ws.setJLWorksheetType(1);
            ws.setAuthor("Jason Barraclough");
            ws.setProcessName("Cooking toast.");
            ws.setChartName("Making Jason Breakfast.");
            ws.setChartID(1);
            ws.setProcessNumber(13);
            ws.setDescription("Looking after Jason has its quirks.  Cooking him toast is no exception.");
            ws.setDate("10th Jan 2008");
            ws.setPage(1);
            canvas.addNewContainer(flowchart1);
            canvas.addNewContainer(flowchart2);
            canvas.addNewContainer(flowchart3);
            canvas.addNewContainer(flowchart4);
            canvas.addNewContainer(ws);
            frame.getContentPane().add(new JScrollPane(canvas), "Center");
            frame.getContentPane().add(status, "South");
            frame.setSize(600, 600);
            frame.setDefaultCloseOperation(3);
            frame.setExtendedState(6);
            frame.setVisible(true);
            JLinkGraphModelExample g1 = new JLinkGraphModelExample();
            System.out.println(g1.toast.toString());
        }
     
        public static void main(String args[])
        {
            new JLinkFeatures();
        }
    }




    CMD INPUT/OUTPUT:

    C:\Documents and Settings\dipak>cd desktop

    C:\Documents and Settings\dipak\Desktop>path= C:\Program Files\Java\jre6\bin

    C:\Documents and Settings\dipak\Desktop>java -jar JLink.jar
    Exception in thread "main" java.io.IOException: invalid header field name: Main
    class
    at java.util.jar.Attributes.read(Unknown Source)
    at java.util.jar.Manifest.read(Unknown Source)
    at java.util.jar.Manifest.<init>(Unknown Source)
    at java.util.jar.JarFile.getManifestFromReference(Unk nown Source)
    at java.util.jar.JarFile.getManifest(Unknown Source)

    C:\Documents and Settings\dipak\Desktop>

  4. #4
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default Re: can't open jar file

    It may not be a executable jar, If it's not. Then figure out the main class and run it via a sample html page.

    Also.. If the jar isnt signed it sometimes causes problems also. Other then that id contact the support of the project and ask..

  5. #5
    Junior Member
    Join Date
    Jun 2012
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: can't open jar file

    It is an application.

  6. #6

    Default Re: can't open jar file

    There is a typo: Main class : jlink.example.JLinkFeatures.class

    Instead, it must be: Main-Class: jlink.example.JLinkFeatures.class

Similar Threads

  1. Open JSON file with Jfilechooser
    By nautilusz in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: May 14th, 2012, 10:38 PM
  2. Open file from JAR
    By StevenTNorris in forum AWT / Java Swing
    Replies: 2
    Last Post: October 29th, 2011, 12:02 PM
  3. [SOLVED] file deletion/renaming not successful, don't think I have any streams open
    By Bottleskup in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 21st, 2011, 04:14 PM
  4. Replies: 1
    Last Post: March 24th, 2011, 08:22 PM
  5. Open Text file
    By java_kiddy in forum File I/O & Other I/O Streams
    Replies: 7
    Last Post: October 5th, 2010, 02:52 AM