Jar file question!!urgent help

i created a jar file and i can run it in the dos mode but when run it by double click some functions inside can work!!so what is the problem??
can anyone tell me??

I assume you mean "cannot work".
Did you create the jar file with the manifest file specifying the class (with a main() method) to use?

Similar Messages

  • Beginner: Can't convert a hello.class file into a jar file. Please Help!!!

    Hi, I created a hello.java file, converted into a hello.class file by using the java 2SDk compiler. The problem is that the hello.class file is in a directory I created: C:\JavaBuilder\hello.class
    I have a problem converting the hello class file into a jar file. I don't know which approach to take. I've looked at tutorials...but I keep getting more confused each time I view the tutorials on creating jar files. Please can someone help..by taking me through a step by step process. Please be explicit and do not leave or assume that I know any details because I'm a new born beginner. Thank you very much, I seriously appreciate it.

    Hi!
    first of all, you should use an upper-case character for the first letter of your classes...
    To answer your question :
    1) you must create a directory named "meta-inf" in your directory "C:\JavaBuilder"
    2) then,you must create a file named "manifest.mf" in this directory
    it's like a property file and it must contain this :
    Main-Class: hello
    (don't forget to type <enter> after "hello")
    3) in the directory "C:\JavaBuilder", you can enter the following command :
    "jar cvfM hello.jar meta-inf\manifest.mf hello.class"
    (check jar.exe is in your path)
    4) you can run your jar by the command :
    "java -jar hello.jar"

  • Classpath and jar file question

    my application need to use few jar files i downloaded from the internet
    so i need to set the classpath so that i can import the packages in the jar file rite?
    let say set classpath=.;c:\somedir\bin;
    the ".;" after the "=" means that i search the current directory first then search the directory i have specified after that rite?
    if so, can i put all the needed jar files in the current directory so that my application can use them??
    Another question is if all the jar files in located in the same directory how can i set the class path to refer to them without sepecifying each of the jar file name??can i just put the directory path and will it locate them automatically when my application start??
    can anyone tell me about it??thanks

    No, you need to include each and every jar file in your classpath.
    Or put them all in your <jdk_installation_dir>\jre\lib\ext directory, so that they will get included in your classpath automatically.
    Sudha

  • Jar file problem , please help

    Hi guys , i am not sure if i am in the right place to have this post in so i'll give it a try
    i know my explanation might be a shot in the dark but i'll try my best
    i have made a program using eclips , to send emails using my email , on certain conditions
    so when that codition happenes on some class in my program
    this class will call the email class and send an email to someone
    now the problem is not in the program , because as along as this program is in eclips and i run the program in eclips , everything goes fine , No errors what so ever
    but , if i make jar file , using eclips "export"
    once i run the program , the program would run , but once the same condition that ihave specified previously happenes , the current class never calls the email class , and no emails would be sent
    i am very confused wether
    1) it throws a class not found for some wierd reason
    2) or the external library that i used to send emails , is not exported
    i tried to check the CLASSPATH file and i think everything seems to be fine , so i dont know what the problem is
    so in short
    if the program is in eclips , every thign goes fine
    if the program is a jar file , then it would work fine but once it needs to send an email , it never does and i can still work on the program , but no emails will be sent
    thanks please some one help me out with this

    for more information here is the senario
    because i see that you guys are some how lost because i am not providing enough information
    so this is a detailed info of the problem
    i have 3 classes
    1) mybankmain (jframe)
    2) mybankbody (all labels and buttons and events included here)
    now: within some events in my program ,
    it calls a class called.....
    3) myEmail
    this class imports two things that are comming from an external jar file , so in short , if the external jar file is not available the program would complain
    i run this on windows xp (SP2)
    now: if this program runs on eclips , it would do everything it is supposed to do and all kind of calculations will be done and emails will be sent on the conditions that i have specified within the program
    if i make a jar file on windows , and i run the jar file , the file would work , all functionalities will work
    EXCEPT: sending an email
    - either my class is not found
    - or external jar file is not found which causes my class not to be able to perform its tasks
    i did only one test
    which is that i switched the main and i made myEmail as a main and i tried to export the jar file
    Result: jar file doesnt work
    the way i view whatever inside my jar file , i use Winrar and it would view everythign in the jar file and i see that all my classes are included there
    if i open my CLASSPATH , i see that there is a pointer to the external jar file
    if i open my manifest : i DO NOT see the exrernal jar file in there but i do see that its pointing to my main class
    class main : mybankmain
    and there is only the version and signiture
    i hope all these additional details would help in determining the problem that ihave been trying to solve for 2 weeks now

  • Jar file question.

    if i unjar a jar file, how do i let java
    know where the classes are?
    thanks for any help
    owen

    Considering your .jar file is in the desktop folder,
    c:\Windows\desktop>jar -xf abc.jar
    This will cause the class files in the jar file copied in the desktop.
    Hope it helps
    Uma
    Java Developer
    http://www.javagalaxy.com

  • Eclipse, Apache POI, compiling jar file. Please help =(

    Hello =) I have written a program in Eclipse using the apache POI library. I have added the POI JAR to my build path and the program runs as it should within Eclipse. Once I export my program to a JAR file, I run it from the command line. Each time I do i get the following error:
    {C:\Documents and Settings\Koneko>java -jar "C:\Documents and Settings\Koneko\Desktop\review.jar"
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/poifs/filesystem/POIFSFileSystem" }
    I have no idea why this is happening and have searched the internet for hours looking for an answer =\
    please help.
    -Matt

    I usually put them in WEB-INF. But I thought it doesn't matter where they are if you define them correctly in the web.xml file.

  • MANIFEST file question pls help

    Hi,
    i have a JAR file on my ftp server. and i want to only read Manifest file informations in this jar file without downloading file on my pc.
    is it possible to do this ?
    Please help,
    Regards,
    Musa YILMAZ

    thanks,
    yes i use zip classes but it always want to cache file to temp directory in windows, i must wait until caching finishes
    but my jar file is 5mb so i wait so long,
    also caching is as same as downloading file.
    but if not necessary i wont download file.
    but i think it is not possible.
    Regards,
    Musa YILMAZ

  • Execution from JAR files and Classpaths -- Help

    I am confused about how classes are resolved when running from within a JAR file, and why this is different than running a class that is not inside a JAR file.
    I have an application that uses classes from a third party library stored in a JAR file (biojava.jar) . If I run the app from the class file it works as expected and is capable of finding the external classes when the path to the biojava.jar is on my classpath. It also works if biojava.jar is instead placed in the extensions folder jre/lib/ext folder without an explicit path entry in my classpath.
    However when I package all my application classes up in a JAR file and try to execute the application from the JAR file it will ONLY work if I add a manifest entry to myApp.jar ... Class-Path: biojava.jar AND I place the file biojava.jar in the SAME directory as the Packaged JAR application. I would like to find a way to make this JAR file work for anyone who has biojava.jar in their classpath or ext directory. In other words I don't want my user community to have to copy the biojava.jar file when I email them myApp.jar. This community will already have biojava.jar on their CLASSPATH.
    How can I make my app within a JAR recognize either the user's CLASSPATH or ext folder? I have tried reading the documentation and many experiments but the only way it works is as described above.
    I am running Running Windows 2000.
    java version "1.4.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
    Here are the results of my experimentations:
    The following Works:
    Manifest: Main-Class: org/biojava/app/SequenceSpiral
    Manifest: Class-Path: biojava.jar
    Place biojava.jar in the same directory as SequenceSpiral.jar
    java -jar SequenceSpiral.jar
    This works perfectly
    NONE of the following work
    0) Placing biojava.jar in my jre/lib/ext directory instead of the same dir as SequenceSpiral.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/biojava/bio/seq/FeatureFilter
    (this is the first class referenced from biojava.jar)
    1) Just see if it will find the proper jar on my classpath
    Manifest: Main-Class: org/biojava/app/SequenceSpiral
    I have biojava.jar on my classpath but not in same directory as SequenceSprial.jar
    java -jar SequenceSpiral.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/biojava/bio/seq/FeatureFilter
    2) Specify the name if the jar in the Manifest Classpath and see if it will find the proper jar on my classpath
    Manifest: Main-Class: org/biojava/app/SequenceSpiral
    Manifest: Class-Path: biojava.jar
    I have biojava.jar on my classpath but not in same directory as SequenceSprial.jar
    java -jar SequenceSpiral.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/biojava/bio/seq/FeatureFilter
    3) Specify the path of the jar in the Manifest Classpath
    Manifest: Main-Class: org/biojava/app/SequenceSpiral
    Manifest: Class-Path: d:/biojava/biojava.jar
    I have biojava.jar on my classpath (D;\biojava\biojava.jar) but not in same directory as SequenceSprial.jar
    java -jar SequenceSpiral.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/biojava/bio/seq/FeatureFilter
    (note that in this case it is not fnding my main even though the Main-Class is specified)
    4) Specify current directory and biojava.jar in the Manifest Class-Path
    Manifest: Main-Class: org/biojava/app/SequenceSpiral
    Manifest: Class-Path: .;biojava.jar
    I have biojava.jar on my classpath (D;\biojava\biojava.jar) but not in same directory as SequenceSprial.jar
    java -jar SequenceSpiral.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/biojava/bio/seq/FeatureFilter
    5)Specify current directory and the URL of biojava.jar in the Manifest Class-Path
    Manifest: Main-Class: org/biojava/app/SequenceSpiral
    Manifest: Class-Path: . d:/biojava/biojava.jar
    I have biojava.jar on my classpath (D;\biojava\biojava.jar) but not in same directory as SequenceSprial.jar
    java -jar SequenceSpiral.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/biojava/bio/seq/FeatureFilter.
    Thank you very much for any help or suggestions,
    David Maynard

    I did some more testing and I think I now understand what is going on.
    I don't like it, but at least I understand it.
    The problem: I have an app packaged into a JAR file, myApp.jar. It has a dependancy upon an external JAR file extern.jar.
    extern.jar is on my Classpath (and also in jre/lib/ext)
    1) For some reason (bug?) java -jar myApp.jar does NOT use the classpath or the jre/lib/ext mechanisms to find .jar files needed to resolve references to external classes. This seems to be true even if you add an explicit -classpath argument on the command line!
    thus
    java -jar -cp c:\\absolutePathToMy\extern.jar myApp.jar
    also fails as does
    java -cp c:\\absolutePathToMy\extern.jar -jar myApp.jar
    2) Inside the myApp Jar file you can specify a URL to an jar extension jar file but the URL IS RELATIVE TO THE PATH WHERE THE myApp.Jar is executed from! If I add the Manifest item Class-Path: ..\..\..\myexterndir\extern.jar then
    java -jar myApp.jar
    works correctly and resolves the external references.
    This is why several people have reported that this class-path mechanism works ONLY when the extern.jar file is in the SAME DIRECTORY as the myApp.jar file when they had added a Class-Path: extern.jar to the Manifest.
    However together these two items make it IMPOSSIBLE to distribute myApp.jar to others and have it work since the path names statically encoded inside the jar are relative to where the jar gets executed from. If I move myApp.jar to a different location on my hard drive it may also fail.
    In my case I know all my customers already have extern.jar (5MB) installed on their classpaths and I would like to just send them the myApp.jar ( .5MB ).
    However I don't see how to do this given the current specification of a JAR file, and the bug that makes all -jar file act like they have the Sealed=true property.
    I tried explicity setting Sealed=false in the manifest but this didn't seem to have any effect.
    I hope that this will save others the many hours of time it has taken be to determine that JARS are not well suited for deploying apps with dependenncies on external libs.
    I also hope that someone can show me how execute a JAR and specify a classpath that doesn't get IGNORED my the classloader used in loading the jar classes.
    This is using java version:
    java version "1.4.1_01"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
    Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
    Does any one know this bug is fixed in a later release?
    David Maynard

  • Signing a jar file question

    Hello folks
    Have a tough one here.  We have a Legacy System that uses some 3rd party software called Reflections For Web (RWeb) from Attachmate in order to allow the Legacy System to interface with a mainframe system.  One of the files needed by this RWeb software is a jar file called KeyToolsPro_jce1-2-1_signed.jar which itself was created by another company.  The problem we are having is that due to the security changes in Java 7u51 this file is blocked due to not having the appropriate manifest entries and due to being signed by an unknown certificate CA.  This problem is compounded by the fact that the company that created the file is no longer in business and as such cannot make the changes needed to the manifest file.  Also the problem with the signature it seems is due to it being a cryptographic file it needs to be signed by a JCA code signing CA which is not recognized by the AF.  This page talks about signing it with either a Sun or IBM JCA code signing CA:
    http://docs.oracle.com/javase/7/docs/technotes/guides/security/crypto/HowToImplAProvider.html#integritycheck
    My question would be is this still the only way to do this?  Or is it possible that another type of CA could be considered "trusted" for the purposes of signing this type of jar file?  Since it talks about a Sun certificate it does seem like the documentation might be a bit outdated and that perhaps any trusted code signing CA could be used to sign the file.
    Thanks in advance.

    You can add a manifest to a jar file like this:
    jar ufm MyJar.jar manifest.txt
    You'll then need to resign the JAR.  You'll need a code-signing certificate for this.  You can obtain a real one from a provider, or generate your own CA and use it to sign a code-signing certificate yourself.
    You can add a CA to the trusted list like this:
    C:\Program Files (x86)\Java\jre7\lib\security>keytool -importcert -alias MyCA -file c:\cacert.cer -keystore cacerts -storepass changeit -noprompt
    where c:\cacert.cer is the certificate for the CA. 
    However, it may be easier to add your internal server to the exceptions list using the Java control panel.

  • ADF faces jar files needed (urgent)

    Hi,
    I have downloaded one sample adf faces application from oracle site, but it does not have the jar files. They are saying that you can download the neccassary jar files from the Oracle Technology Network (OTN) Web site as a .zip archive that contains the tag libraries, documentation, and a Web application example.
    But i was not able to locate the specified zip file in OTN web site. If someone knows please tell me from where should i download the specfied jar file.
    I have downloaded the sample appl from the following link..
    http://www.oracle.com/technology/pub/articles/cioroianu_jsfadf_v4.html
    Thanks in advance..
    Regards,
    Saravanam

    Hi,
    This is a very old how-to that was released during JDeveloper preview. If you go to otn.oracle.com/proucts/jdev --> JSF then you can find the download reference.
    The newer - production class - ADF Faces jar files are not for download separately but are part of Oracle JDeveloper and available in its jlib directory. So you could go download JDeveloper and get adf-faces.jar
    Frank

  • How can i set the dos can compile and excute the jar file?please help?

    How can i set the dos prompt can compile my .java file and execute my jar file.

    Go to where you downloaded your Java SDK. Look around for a button labled "Installation." Click the button. Download the installation instructions. Read them. Then read them again.

  • ITunes corrupt file message - urgent help needed please

    I have an iPod video 30GB, i downloded the latest iTunes & Quicktime version, and updated my iPod also to the latest update. When i connect my iPod and start downloading music from the library in iTunes, the iPod keeps on disconnecting and restarting by itself, and i get a message that the file iTunes.exe is corrupt. I tried Apple support and did all what they said by downloading the latest updates and versions, and also did the Chkdsk utility on Windows, but still it did not work, the iPod keep on restarting and i cannot download anything on it, i had it now for a week and did not use it at all because of this problem, can somebody with a technical background help me please, i use Windows XP.

    I have an iPod video 30GB, i downloded the latest iTunes & Quicktime version, and updated my iPod also to the latest update. When i connect my iPod and start downloading music from the library in iTunes, the iPod keeps on disconnecting and restarting by itself, and i get a message that the file iTunes.exe is corrupt. I tried Apple support and did all what they said by downloading the latest updates and versions, and also did the Chkdsk utility on Windows, but still it did not work, the iPod keep on restarting and i cannot download anything on it, i had it now for a week and did not use it at all because of this problem, can somebody with a technical background help me please, i use Windows XP.

  • Syncing question Urgent Help Needed!

    Hey guys.
    I'm going to be getting a new iTouch tomorrow cuz mine is broken (I LOVE APPLE! Much better customer support and help than PC!)
    I've emailed all my notes and screen cap pics to myself, and synced the iTouch.
    Will this save my bookmarks in safari?
    is there anything else I should make sure i have a copy of?
    Thanks so much guys!!!

    When you connect your new iPod to iTunes, it will offer to restore from the backup of your old one. When you do that and let it sync, it will be a clone of your original iPod. See these for info:
    Backup: http://support.apple.com/kb/HT1766
    Restore: http://support.apple.com/kb/HT1414

  • Simple question, Urgent help needed.(Session Related)

    I am new in Java and i want help in the following query:
    When there is no session already defined and no values assigned to the session and i run the
    String session_loginName = (String) session.getAttribute("username");
    command in a doGet method
    What is the result to the string?
    null? or something else?
    My intensions are:
    To have restricted areas in my web app and when a user clicks on a link which includes restricted content, to first call a servlet which will test if there is a session already and if not it will redirect to the Login page.
    I am thinking to use the following code.
    Will this work ok?
    package mypackage;
    import javax.servlet.*;
    import java.io.*;
    import java.sql.*;
    import javax.servlet.http.*;
    public class EntGroupRegistration extends HttpServlet{
    private String url = "jdbc:odbc:test";
    * Standard Post Method for Processing the HTML Variables
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
    String session_loginName;
    * Obtain username from session object
    session_loginName = (String) session.getAttribute("username");
    if (session_loginName.equals(null)) {
    response.sendRedirect(
    "http://localhost/se/Resources/changepassS.htm"); }else{
    response.sendRedirect(
    "http://localhost/se/Activities/GroupRegistration.htm");
    Any suggestions upon the code?
    Thank you for your time.

    if session_loginName is null then how can you call equals method on it???? Always give it a little thought first before typing code...
    try something like
    if(session_loginName != null)
    // you code as before
    }

  • Position Class...- Simple question - urgent help needed

    I am only having problems with Position parameters....what the hell does a Position refer
    to? A number? Do you supply a number for Position parameter to find a node in a
    doubly linked list? It seems that it goes by that way, but how the heck do you located it
    with a Position parameter p (Postion p)? Doubly /singly linked lists have no reference this
    with numbers....I am only confused when you have instances like:
    public Object remove (Position p) {.....}
    How do you instantenously locate the appropriate node in a Linked list via Position p
    parameter?
    Everything else I understand!!!! It's just that Positioning is bugging the hell out of me...Do
    I supply number 3 for a third node in a linked list? or what?

    i can not see a Object remove(Position p) in LinkedList , and the only Position class I can think of is in javax.swing.text - which is to do with marking positions in text documents. ?
    can you explain your problem better ?

Maybe you are looking for

  • Virtual Interface IP address

    Hi, In all Cisco documentation 1.1.1.1 is always specified as Virtual Interface IP address. Here is my concern. When wireless client gets an IP address (through DHCP), 1.1.1.1 is entered as DHCP server which means that at 50% lease time client will a

  • Hard disk icon not on desktop after reinstall of 10.6.8

    how do I get Mac HD icon back on desktop?

  • Doubt in bean-urgent

    Hi to all, i am using tomcat server.i have a simple jsp file which is using bean to display hello message.could anybody please tell me where to store bean class and jsp files since i am quite new to bean a detail description would be useful. regards,

  • BT Voyager 1055 with Windows 7

    I was really disappointed with Broadband support when I tried to locate drivers for my 2 BT Voyager 1055 wireless access devices for Windows 7 64 bit I was told that there are no 64 bit W7 drivers, and that I would have to buy another wireless dongal

  • Physical Inventory Tag Generation Sort Selection

    Hello, Is there anyone that has dealt with Physical Inventory Tag Generation and sorting of the generation to match the Bin Locator sequence. Currently under 10.7 SC with our Physical Inventory at the end of Oct. Current process is to print Tags in n