Results 1 to 12 of 12
  1. #1
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default Create Executable Jar file

    Hello,

    I am using Eclipse IDE Helios version....

    I have built an applet that runs fine in the Eclipse environment....

    But when I try to Export a Runnable Jar file , I dont see any thing in the Eclipse Launch Configuration....

    Hence could not create a runnable jar file.....

    Any idea that whats wrong there.....

    Many Thanks for the cooperations...

    Best Regards,
    Sarwar

    Best Regards

  2. #2
    Alessio is offline Member
    Join Date
    Oct 2010
    Posts
    14
    Rep Power
    0

    Default

    Well, you have to create a Run Configuration first

    You can find the dialog under "Run \ Run Configurations ...". There is a small icon (a page with a plus sign, tool tip is "new launch configuration") in the top left corner.

    Regards,
    Alessio

  3. #3
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    Hi,

    Thanks for the reply....

    Actually I have the Run configuration, when I go in The Run >> Run Configuration....
    where I can see MyProject in the Project box and also MyApplet in the Applet box...

    and when I press Run, the applet runs in the same way as when I run it from the main work bench window...

    Any idea about how to add / setup the lauch configuration to create jar file....

    Many Thanks...

  4. #4
    Alessio is offline Member
    Join Date
    Oct 2010
    Posts
    14
    Rep Power
    0

    Default

    Sorry, my fault.
    Didn't read the bold part of your question ;)

    Anyway: you don't need to export a runnable JAR file if you want to export a Java Applet.
    Just export a "normal" JAR file and create a HTML with something similar to

    Java Code:
    <applet code="YourClassName.class" archive="YourJarFile.jar" width=100 height=100>
    	Your browser is not Java enabled.
    </applet>
    Regards,
    Alessio

  5. #5
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    Hello,

    When I try to export the normal Jar file.... I get confused on the 3rd page Jar Manifest Specification page....


    I select the option "Generate the manifest file:" and then I get the following file in a folder under my project folder:

    Java Code:
    Manifest-Version: 1.0
    But I dont get any thing when I press the browse button for the following option:

    Select the class of the application entry point



    A window "select the main class" apperas but empty... There is nothing in that window to select.....


    Any idea, what should I do??


    Many Thanks .... :)

  6. #6
    Alessio is offline Member
    Join Date
    Oct 2010
    Posts
    14
    Rep Power
    0

    Default

    maybe have a look at:
    Help - Eclipse SDK

  7. #7
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    Hello Alessio,

    Thats worked....

    Actually I was trying to open the jar file directly... double click and it was giving a fatal exception warning....

    Then I use the html technique to open it and it works now....

    Many Thanks.... :)

    One more thing, Actually my Applet prompts the user to input a file, So now I get the applet window but I get the following in the Java console when I try to press the input button on the applet....

    Java Code:
    Java Plug-in 1.6.0_20
    Using JRE version 1.6.0_20-b02 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Logic Energy
    ----------------------------------------------------
    c:   clear console window
    f:   finalize objects on finalization queue
    g:   garbage collect
    h:   display this help message
    l:   dump classloader list
    m:   print memory usage
    o:   trigger logging
    q:   hide console
    r:   reload policy configuration
    s:   dump system and deployment properties
    t:   dump thread list
    v:   dump thread stack
    x:   clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------
    
    
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Logic Energy\AppData\Roaming\Microsoft\Windows\Recent read)
    	at java.security.AccessControlContext.checkPermission(Unknown Source)
    	at java.security.AccessController.checkPermission(Unknown Source)
    	at java.lang.SecurityManager.checkPermission(Unknown Source)
    	at java.lang.SecurityManager.checkRead(Unknown Source)
    	at java.io.File.exists(Unknown Source)
    	at java.io.Win32FileSystem.canonicalize(Unknown Source)
    	at java.io.File.getCanonicalPath(Unknown Source)
    	at sun.awt.shell.Win32ShellFolderManager2.createShellFolder(Unknown Source)
    	at sun.awt.shell.Win32ShellFolderManager2.getRecent(Unknown Source)
    	at sun.awt.shell.Win32ShellFolderManager2.get(Unknown Source)
    	at sun.awt.shell.ShellFolder.get(Unknown Source)
    	at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
    	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFolder(Unknown Source)
    	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponents(Unknown Source)
    	at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
    	at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknown Source)
    	at javax.swing.JComponent.setUI(Unknown Source)
    	at javax.swing.JFileChooser.updateUI(Unknown Source)
    	at javax.swing.JFileChooser.setup(Unknown Source)
    	at javax.swing.JFileChooser.<init>(Unknown Source)
    	at javax.swing.JFileChooser.<init>(Unknown Source)
    	at com.logicEnergy.gui.OptionPanel$1.actionPerformed(OptionPanel.java:81)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)

    Looks like the security thing....

    Any idea about that... Because its entirely up to user to input the file... and there should be some way to allow the applet to take a file as input....


    Many Thanks for the cooperations....

  8. #8
    Alessio is offline Member
    Join Date
    Oct 2010
    Posts
    14
    Rep Power
    0

    Default

    yes, you need to sign your applet in order to be able to access the local file system

    there is a java file upload applet (called JUpload, see JUpload project on Sourceforge - About) that does exactly that.

    You can find a description at

    JUpload project on Sourceforge - JUpload - File Upload Applet - HowTo sign the applet ?

    regards,
    Alessio

  9. #9
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    Hello,

    I have gone thorugh the things and finally I have to use the command line to generate a certificate and sign the jar file with that certificate...


    But when I enter any Java relavent command on the DOS command prompt, I get
    Java Code:
    'command'  is not recognized as an internal or external command, operable program or batch file.

    Any idea, why the java commands are not working on my pc.... I am using windows Vista...

    Many Thanks...


    Best Regards...

  10. #10
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default signing the jar file

    Hello,

    I am using the jarsigner tool in the C:\Program Files\Java\jdk1.6.0_21\bin
    from the command prompt...

    First I have created the keys using the keytools command:

    Java Code:
    keytool -genkey -alias mykeys
    An I can see the keys in the keys list....

    Moreover I have created my applet in Eclipse, whose working directory is C:\Users\Logic Energy\workspace1 which is users home directory...
    And I can see all the class files, source files, manifest file and the external jar files in that directory under my project folder.

    Although I add the external jars in the project builf path of Eclipse, and also I refer to the manifest file while I create a jar file using Eclipse....

    Now In order to sign this jar file, I copy it to the jdk folder C:\Program Files\Java\jdk1.6.0_21\bin

    Then I use the following command to create the signed jar
    Java Code:
    jarsigner myfirstjar.jar mykeys
    So then CLI prompts for the key store password and also the keys password....

    But In the End, I get the message

    Java Code:
    jarsigner: unable to create : firstjar.jar.sig
    Any idea why It is happening....

    First the Installed JREs in the Eclipse was pointing to jre6... and the .classpath file was
    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
        <classpathentry kind="src" path=""/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" path="C:/Users/Logic Energy/workspace1/Wind1/external libs/activation-1.1.1.jar"/>
        <classpathentry kind="lib" path="C:/Users/Logic Energy/workspace1/Wind1/external libs/commons-csv-20070724.jar"/>
        <classpathentry kind="lib" path="C:/Users/Logic Energy/workspace1/Wind1/external libs/iText-5.0.4.jar"/>
        <classpathentry kind="lib" path="C:/Users/Logic Energy/workspace1/Wind1/external libs/krysalis-jCharts-1.0.0-alpha-1.jar"/>
        <classpathentry kind="lib" path="C:/Users/Logic Energy/workspace1/Wind1/external libs/mail-1.4.1.jar"/>
        <classpathentry kind="output" path=""/>
    </classpath>

    But Then I changed the library to jdk1.6.0_21 and compiled the code again... and craeted a jar file again....

    But still, I can get the created jar file to be signed....

    Many Thanks for the cooperations...

  11. #11
    Pen
    Pen is offline Member
    Join Date
    Jun 2010
    Posts
    4
    Rep Power
    0

    Default

    I'm having the same problem, but some of these comments are helping.

  12. #12
    sarwar1234 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default Application signing problem

    Hello,

    I have now rebuild the project....

    1- First of all, I signed all the three external jar files, the project is using.... before adding them into my project.

    2- Then I built my applet again, and I also signed its Jar file....

    3- Then I placed all the external jars + my applet jar along with their certificates in a folder.... There is also a resource folder containing images in that folder....

    4- Then I used the html file to start my applet....

    So now my applet can access the local file system and does all the job....

    The thing is, I am getting 2 warnings when I run the html of my applet.....

    Java Code:
    1-  The application's digital signature cannot be verified, Do you want to run the application ?     with 2 buttons    RUN   Cancel
    
    2-  Java has discovered application components that could indicate a security concern.  
    Block potentially unsafe components from being run? (recommended)  
    
    with 2 buttons       Yes   No
    Any idea, why I am still getting those warnings and how to get rid of those... or atleast they dont pop-up while some one tries to run that applet....

    Many Thanks for the cooperations....


    Best Regards..
    Attached Thumbnails Attached Thumbnails Create Executable Jar file-image1.jpg  

Similar Threads

  1. Create Executable Jar file
    By sarwar1234 in forum New To Java
    Replies: 3
    Last Post: 09-27-2010, 05:10 PM
  2. Executable jar file
    By franklyn@bellsouth.net in forum New To Java
    Replies: 12
    Last Post: 08-26-2010, 01:03 PM
  3. How to create java executable file through CMD
    By Riaz Ali in forum New To Java
    Replies: 4
    Last Post: 08-03-2010, 08:20 AM
  4. Executable File.
    By BeeGee in forum Advanced Java
    Replies: 13
    Last Post: 05-25-2010, 12:35 PM
  5. Create Executable problem
    By castiel in forum New To Java
    Replies: 13
    Last Post: 02-24-2010, 03:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •