Beginner: Can't convert a hello.class file into a jar file: HELP PLEASE!!!

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 i did as you suggested, only with these exceptions:
jar -cvf hello.jar C:\JavaBuilder\hello.class
I did this and got the message: "adding : C:\JavaBuilder\hello.class (in=1150) (out=708) (deflated=38%)"
The problem is that when I tried to execute the jar file...by typing: " java -jar hello.jar" I received the error message: "Failed to load Main-Class Manifest attribute from hello.jar" Is there any way to correct this problem? please help, thank you.

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"

  • Conversion of a .class file into a .jar file

    Conversion of a .class file into a .jar file
    How Will I convert a .class file into a .jar file.
    Pls answer ASAP.

    You don't.
    You add a .class file into a .jar file. You don't convert anything.
    Read the help page for jar for details.

  • How can  I include my database file into my jar file?

    Hi,
    I am doing several tests for the jar command....
    I tried to put the database file into my jar file, but when the program run, it just couldn't find the database file, so how may I include the database file into the jar file? Not only that, it also can't find the policy file etc.

    sorry, I think I found the solution, I should have had read the API more carefully.

  • Problem in include library files into my jar file

    i am new to this jar archiving...I have created a GUI with java swings..and i also use mysql driver to connect my database now i want to make an executable jar file for my GUI..with coonector i have done the following
    I have compiled my program and placed all the .java and .class files in
    c:\ java\ bin\ jarexample
    next i created a manifest file called mainClass.txt which contains
    Main-Class: AppletMain (where AppletMain is my mainclass).. I placed this txt file also in c:\ java\ bin\ jarexample
    i m also set Class-path in manifest file Class-Path: mysql-connector-java-3.1.10-bin.jar
    next i ran jar cmf mainClass.txt example.jar *.class mysql-connector-java-3.1.10-bin
    With this line, I told jar to create a JAR file (option c) with modifications to the manifest file (option m) as specified within mainClass.txt, naming the JAR file (option f) as example.jar and including everything that matches the pattern *Class and mysql connector
    now my problem is ...my MYSQL connection need some Library files from a package called org and class Driver.class to generate connection I include this library files also in my example.jar....
    But when i execute this jar file using :java -jar example.jar
    this is executed BCOZ tha example.jar file use mysql-connector-java-3.1.10-bin.jar file from system.
    If i m this mysql-connector-java-3.1.10-bin.jar file from system from system then it is not run.
    Can anyone please tell me how can i include this library file to my jar file( ie example.jar)
    Thankyou

    Double post. Please post replies on the other thread.
    http://forum.java.sun.com/thread.jspa?threadID=656781&tstart=0

  • Including a rms file into a *.jar file

    Hi,
    I would like to know if it's possible to include a rms (RecordStore) into a jar file off a Midlet suite. I don't want to create the RecordStore everytime i need to install my application. I tryed to copy rms.db to the instalation dir and it worked but i have tools that allow me to do that. My possible clients don't, and i wish to include the rms in the instalation to jar in order to be transparent to them. Adding file to *.jar doesn't work, because the file remains inside the *.jar and isn't installed in the application dir.
    I appreciate some help
    Thank u and by the way
    MERRY CHRISTMAS

    Hi
    I'm not aware of any technique for directly loading an RMS via the JAR.
    Instead, have you considered using a resource file and initializing the RMS from that? Or initializing from a network connection? You could also use the optional properties in the JAD for key=value pairs.
    We have used all 3 techniques - including using the resource file as a default dataset and then relegating the RMS to holding any dataset updates.
    Happy New Year

  • Updating a specific file into a .jar file

    Hi,
    I have got a .jar file, if I want to update the specific file org/abc/try.class, with a new try.class, what command should I use?
    thanks a lot.

    Something like that, but remember you have to rebuild the entire jar file from scratch. You can't just update one file in it.

  • How to include third party .jar files into my jar file

    Hi,
    how do i include a open source third party jar file into an executable jar?
    i have a class called BlogBox.java and it uses org.apache.commons.net.ftp.FTPClient, i want to create an executable file, where do i put the .jar file containing FTPClient aka Apache Commons Net?
    currently i'm getting the following error from when executing my BlogBox.jar
    C:\MyJava\BlogBox>java -jar BlogBox.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
    at blogbox.BlogBox.<init>(BlogBox.java:27)
    at blogbox.BlogBox.main(BlogBox.java:103)
    Any suggestions? i have searched google and this forum but could not find the solution to my problem, thanks
    [edited msg] do i need to add the classpath at execution or something of the apache commons net library?
    Message was edited by:
    gekkokid

    When you use an executable jar the normal class path
    is ignored, but you can put a classpath inside the
    jar. The usual trick is to place the library jar
    files in a directory inside the application directory
    and direct the manifest file to it. The manifest file
    live in the jar inside the META-INF directory and
    it's called manifest.mf
    The two heavilly used entries are Main-class: and
    Class-path: lines. Class-path just has a
    comma-separated list of library paths.
    The jar utility has a special option to load it up.Thanks :) I created a "/lib" directory, placed in the packages in there and redirected the Class-Path: lib/commons-net-1.4.1.jar
    and it works,
    thank you everyone :)

  • Bundle classes automatically into a JAR

    By a single command line, how can I bundle several compiled java classes (*.class files) into a jar file? Say, for example, I want to do something like this:
    javac *.class -someoption myClasses.jar
    That is, in the end, all my *.class-files are bundles in myClasses.jar. Any idea?

    Have a look at the tutorial about JARs. It will tell you about the jar command.

  • How to load xsl-files out of jar-files

    Hi,
    I have included some xsl-files into a jar-file. I can access this files with the following code-snipped if the jar-file is local on my harddisk:
    ClassLoader.getSystemClassLoader().getResource("pcodeliste.xsl").openStream()
    But the problem is that I use this jar-file as a part of a j2ee-application (it's a ear-file). After deploying this ear-file to my application-server (oc4j) I get a null-pointer exception if I call the xsl-file with the code above.
    Can anybody help me how to change this code or how to change the j2ee-application to have access to this files??
    Thank you very much
    Tobias

    Hi Rykk!
    Thanks for the answer, but it does not work since the jar, containing my file is inside an ear.
    Greets,
    Jay

  • Can i convert AIFF audio file into an MP3 file please?

    Can i convert AIFF audio file into an MP3 file please? I will be doing this on an imac 2008 model. thank you for help!

    Since this is the Logic forum and you may be working in Logic, you dont even need iTunes. To convert Aiff to MP3:
    1 - Go to the Bin>Audio Files
    2 - Select the Audio File you want to convert ( and not a region or edit of it)
    3 - Go to Audio File next to the Link icon ( Audio - Edit - View ) and down the menu to Copy/Convert.. gives lots of options
    HTAH
    (hope that also helps)
    MS

  • How can I convert my Open Source document files into Word document files? I cannot download Pages since my Macbook Air does not have the most recent software.

    How can I convert my Open Source document files into Word document files? I cannot download Pages since my Macbook Air does not have the most recent software. I downloaded open office to my mac to try and save money. It worked well for a while. Now I get this pop-up message that asks me to "Reopen" and when I select the option, nothing happens. I cannot save my documents anymore and I cannot convert them to word. Help!

    dwb wrote:
    Does OpenOffice output Word documents by default or do you have to select it manually?
    You have 17 options to save as in Open Office, one of which is .doc  files,  yes it needs to be saved manually.
    You may be able to default to DOC, but have not tried same.
    Since Open Office is 99% same as Word, I use it, or Word, either one.  Open Office is a bit less buggy than Word 11'

  • How can I convert a PDF/A file into a PDF file with Acrobat Pro X?

    How can I convert a PDF/A file into a PDF file with Acrobat Pro X? I'd like to modifiy the file which I have only as a PDF/A.

    There's two answers if you want to modify the file:
    You can temporarily turn off PDF/A Mode in your preferences, so they don't open as read-only. The problem would be if you do something to the file that violated the PDF/A standard, so you should always run a Preflight check afterwards to make sure.
    If you want to remove the PDF/A header tag, use Preflight again - it's on the Print Production Panel in Acrobat X Pro (which may be hidden, use the options menu on the Tools Pane to show it). There's a profile called "Remove PDF/A information" - choose this and press Analyze and Fix. Nothing else about the file will be altered but when you save and reopen it all the editing tools will become active.

  • How can we convert .mov ( implemented by quicktime APi)  to .WAV file

    Hi,
    How can we convert one .MOV audio file (generated by quicktime API) to .WAV audio file ( need LINER - encoding format).
    Here I dont know the encoding format of .MOV audio input file.
    regards,
    Rams

    mfrasyid1 wrote:
    I wonder why this happens? The "unable to handle.." really does come out twice. Is it because the inputfile.mov which I wanna convert comes from the merging oftwo wave files? If so, then how can I convert this into single wave file? Thank you.That is a weird message, but yes, the .mov file probably stored the 2 original WAV files as 2 tracks of data, rather than 1 track. So whenever it's trying to transcode to a WAV file, it fails to transcode both tracks.
    As for fixing it... I dunno. I know that JavaSound can mix two WAV files at the sample-level, so it actually mixes the sound instead of adding 2 tracks to a file...but I don't know why that's giving you those error messages, unless perhaps it's trying to transcode the video track into an audio track (perhaps the code isn't smart enough to handle transcoding a video file into an audio file? You'd have to check the code to see if that's the case...)

  • How can  I access my java class file in a .jar file ...PLz Help anyone!!

    Hi Folks,
    I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program.
    Plz help ...I have tried all I know in vain.
    Thanks.

    temba wrote:
    Hi Folks,
    I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program. You are making little sense. You can't instantiate .java files.
    Plz help ...I have tried all I know in vain.
    Thanks.Could you post WHAT you have tried and also post what error messages you received?

Maybe you are looking for

  • Printing web report by Excel

    Dear BW people, I tried to use the solution of Tobias Kaufmann to print web reports by means of Excel. When I apply this way of working to my report on BW 3.5, it works just fine. ut... when I do exactly the same on <b>BW 3.10</b> no Excel file is ge

  • Hi, my 120gb ipod classic is not showing up in itunes, and everything is gone. how do i format it on microsoft ' format portable audio player ' ?

    hi, my 120gb ipod classic is not showing up in itunes, and everything is gone. how do i format it on microsoft ' format portable audio player ' ? the device has just installed necessary drivers to microsoft upon plugging in like a say though, not sho

  • Hi abaper expert

    hello   i hv a problem .in transaction fk10n.i hv been copy its program.i hv to add one more field as a plant code .and the data should be fatch depend on plant code.because plant code may be vary. code is   report RFARBALANCE message-id FDBL. ...tab

  • Elements 11 startup problem

    I just purchased Elements 11 after having used Elements 6 for some time.  After installing, Elements 11 Editor seems to work just fine with one exception.  After opening it one time, using it, and then exiting, I cannot reopen it without rebooting th

  • Problem in updating material master using  FM 'MD_MRP_LEVEL_CHANGE_DATA'

    hi experts, i m using this FM 'MD_MRP_LEVEL_CHANGE_DATA' to update the material master for MRP Area related data. i m passing the fields in the FM according to the requirement. when i execute the program it gives a msg 000I : 000, i m not able to tra