How do I make a jar of netbeans (or anything big)?

I was searching for a jar file of netbeans and instead found a different installation file per operating sytem. I am not complaining about this but I want to make a jar out of this (or another big problem) for the sake of learning how (a jar actually does have some benefits like bringing a program on a flash drive and making sure it works on all operating systems and CPU architectures). For small programs that I made myself, I basically have to make the class files in lets say directory "programDir" (without the quotes). I then make a file called x.mf and in it put "Main-class: MyClass" (without the quotes) followed by the "jar -cmf x.mf nameOfJarFile.jar *.class" command (without the quotes).
I think the process is made more difficult when involving packages? So apart from the package issue, I think all I need to do is *1)* find the source code of lets say netbeans *2)* figure out which is the class with the main method in it.
And yes, I have trouble finding the source code of netbeans! I downloaded the "OS-independent zip" and found a few .java files but it didn't seem to be the entire program!
Any input would be greatly appreciated!
Thanks in advance!

s3a wrote:
Why is it a bad example? To me it seems to be a very good one because like in Physics or ChemistryWell, we also do things in Poetry, but those have nothing to do with programming.
I tried with a "toy application off my own" and I am having problems so maybe you can help me there? I have two java files each of which get compiled to class files and then converted to a jar correctly but once I add the line package SudokuPackage; at the top then the class files still get compiled but the jar file made is not one that works.
When I remove package SudokuPackage; I have Main-class: SudokuDriverCode in the x.mf file but when I add package SudokuPackage; at the top of my java files and then compile (and use Main-class: SudokuPackage.SudokuDriverCode in the x.mf file), the jar does not work.
How would I make programs with packages work?So what's the error message?
Also package names are lowercase by tradition.
Also, doesn't Netbeans have an install wizard? It's not distributed around as a regular jar.
You need to get your basics straight before you start thinking of anything advanced.
Edited by: Kayaman on Nov 7, 2010 8:07 PM

Similar Messages

  • NetBeans 5.5. + layout - how can I make a jar?

    1. I try to build my application.
    2. I've developed it in NetBeans 5.5
    3. I ve used form as a base for my GUI
    4. I've made application with help of GUIBuilder+some swing components I create dynamically during program execution.
    The problem:
    I can't make runnable JAR.
    When I try to launch project.jar form folder /dist I get message:
    "No main class found"
    I need to have these jars (they are in my project's library section:
    1.swing-layout-1.0.1.jar
    2. AbsoluteLayout.jar
    I found a solution:
    How can I package the swing-layout-version.jar library
    into my application JAR?
    Having developed your Swing application in Matisse (using the "Free Design" layout) you can
    package the required swing-layout-version.jar library inside your application JAR file.
    Requirements:
    ● Standard Java project
    ● Swing Layout Extensions library included in your project's classpath
    Open your project's build.xml from the Files tab and insert this:
    <target name="-post-jar">
    <jar update="true" destfile="${dist.jar}">
    <zipfileset src="${libs.swing-layout.classpath}"/>
    </jar>
    </target>
    Just press F11 to build your project as usual. This Ant target will bundle swing-layout.jar
    inside your distribution JAR file.
    You can adapt this Ant target to different requirements.
    So I've inserted this code into my build.xml
    Size of built project jar file increased.
    I try to lauch it and I get no message. Nothing happens.
    What else I have to do if I want to get distributable jar....?

    So I found a problem.
    Jar with main class created using GUIBuilder (NetBeans) doesn't launch.
    I use netbeans 5.5. + jdk 1.6.
    If I launch jar with frame-based main class - everything works.
    If I try to launch form-based main class - it doesn't work.
    I do not get any error message or something like that.
    What it can be?

  • How do you make a jar file for your program?

    Title says it all - I don't have software that automatically does it for me.
    Using text pad :O

    Everything you always wanted to know about JAR files, but were afraid to ask:
    http://java.sun.com/docs/books/tutorial/deployment/jar/index.html

  • How can I make my source code with jar file?

    I use JDK1.6.0. I can open a class file from rt.jar and get its source code. Does this because open source JDK? I wander how I can make my jar file with source code.

    CeciNEstPasUnProgrammeur wrote:
    youhaodiyi wrote:
    But why I can read source code from rt.jar? I found there are only class files in it.I say it's highly likely that you can't and your IDE's settings rather automatically refer to the src.zip file in the JDK's directory.I see. That's true. I use eclipse as the source code reader. It may refer to the source code zip file automatically.
    Thanks all.

  • Mak a jar file

    hello,
    i've been working with java and java servlet for a while, but i've no clue about jar files. my question is, how do i make a jar file? is a jar file a compressed version of multiple class files or what? thanks for any advice.

    OK, here's a link to learning about JAR files - this should help you master all you'd need to know to work with jars.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/basics/
    Rather than provide you with a brief explanation here, i guess visiting the link and learning all thats there would be more helpful.
    Hope the above helps.
    John Morrison

  • How to make a jar file from a java file?

    how to make a jar file from a java file, is there any one tht can help me thank you;

    You can study this.
    http://java.sun.com/docs/books/tutorial/jar/basics/index.html

  • Java class uses another class in a Jar file (How do I make Java see it)?

    I am trying to figure out how do I make Javac see the thinlet.class in the thinlet.jar.
    I have developed an XUL xml interface and a java program that calls the interface shown below:
    //package thinlet.demo;
    import thinlet.*;
    public class UI extends Thinlet
    { public UI () throws Exception {add(parse("UI.xml"));}
    public static void main(String[] args) throws Exception
    { new FrameLauncher("UI", new UI(), 600, 600); }}
    when I do the normal compile, I get an error:
    UI.java:4: cannot find symbol
    symbol: class Thinlet
    public class UI extends Thinlet {
    ^
    UI.java:7: cannot find symbol
    symbol : method parse(java.lang.String)
    location: class thinlet.demo.UI
    add(parse("UI.xml"));
    ^
    UI.java:12: cannot find symbol
    symbol : class FrameLauncher
    location: class thinlet.demo.UI
    new FrameLauncher("UI", new UI(), 600, 600);
    ^
    3 errors
    This thinlet class should be in the thinlet.jar that I have added the directory to the path, the directory and jarfile name to the System CLASSPATH and it couldn't see it. So finally I tried putting the thinlet.jar in the same directory to no avail. I've searched the web for some time an cannot find anything that specifically speaks to compiling a program that has parent classes in a Jar.
    Any help is definitely appreciated.

    This thinlet class should be in the thinlet.jar that I have added the directory to the path, the directory and jarfile name to the System CLASSPATH and it couldn't see it. So finally I tried putting the thinlet.jar in the same directory to no avail. I've searched the web for some time an cannot find anything that specifically speaks to compiling a program that has parent classes in a Jar.
    Any help is definitely appreciated.You just still haven't provided the jar in the classpath, or you're not using the right class name. Is the class really named thinlet.Thinlet? Or are you thinking "import thinlet.*" means to import all classes in a jar named thinlet.jar? Because the latter is not true. You need to import classes, not jar file names.

  • Anyone knows how to make this code to netbeans??

    anyone knows how to make this code to netbeans?? i just want to convert it into netbeans... im not really advance with this software... anyway..just reply if you have any idea...or steps how to build it... etc.... thanks guys...
       import javax.swing.*;
       import javax.swing.table.*;
       import java.awt.*;
       import java.awt.event.*;
       import java.util.regex.*;
       public class FilterTable {
         public static void main(String args[]) {
           Runnable runner = new Runnable() {
             public void run() {
               JFrame frame = new JFrame("Sorting JTable");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               Object rows[][] = {
                 {"AMZN", "Amazon", 41.28},
                 {"EBAY", "eBay", 41.57},
                 {"GOOG", "Google", 388.33},
                 {"MSFT", "Microsoft", 26.56},
                 {"NOK", "Nokia Corp", 17.13},
                 {"ORCL", "Oracle Corp.", 12.52},
                 {"SUNW", "Sun Microsystems", 3.86},
                 {"TWX",  "Time Warner", 17.66},
                 {"VOD",  "Vodafone Group", 26.02},
                 {"YHOO", "Yahoo!", 37.69}
               Object columns[] = {"Symbol", "Name", "Price"};
               TableModel model =
                  new DefaultTableModel(rows, columns) {
                 public Class getColumnClass(int column) {
                   Class returnValue;
                   if ((column >= 0) && (column < getColumnCount())) {
                     returnValue = getValueAt(0, column).getClass();
                   } else {
                     returnValue = Object.class;
                   return returnValue;
               JTable table = new JTable(model);
               final TableRowSorter<TableModel> sorter =
                       new TableRowSorter<TableModel>(model);
               table.setRowSorter(sorter);
               JScrollPane pane = new JScrollPane(table);
               frame.add(pane, BorderLayout.CENTER);
               JPanel panel = new JPanel(new BorderLayout());
               JLabel label = new JLabel("Filter");
               panel.add(label, BorderLayout.WEST);
               final JTextField filterText =
                   new JTextField("SUN");
               panel.add(filterText, BorderLayout.CENTER);
               frame.add(panel, BorderLayout.NORTH);
               JButton button = new JButton("Filter");
               button.addActionListener(new ActionListener() {
                 public void actionPerformed(ActionEvent e) {
                   String text = filterText.getText();
                   if (text.length() == 0) {
                     sorter.setRowFilter(null);
                   } else {
                     try {
                       sorter.setRowFilter(
                           RowFilter.regexFilter(text));
                     } catch (PatternSyntaxException pse) {
                       System.err.println("Bad regex pattern");
               frame.add(button, BorderLayout.SOUTH);
               frame.setSize(300, 250);
               frame.setVisible(true);
           EventQueue.invokeLater(runner);
       }

    its okay onmosh.....what we need to
    this...forum....is to have a good......relationship
    of programmers......and to start with .....we need to
    have a good attitude........right.....???.....no
    matter how good you are in programming but if you did
    not posses the right kind of attitude....everything
    is useless.....in the first place....all we
    want....is just to ask...some....help....but
    conflicts......but unluckily......we did not expect
    that there are members in here which......not
    good...to follow.....just as suggestion for those
    people not having the right kind of attidude...why
    can't you do in a very nice message sharing in a very
    nice....way....why we need to put some
    stupid....stuff...words.....can't you live with out
    ******* ****....its not.....lastly especially you
    have your children right now and people around...that
    somehow......idiolize...you even me....is one of
    them......but showing but attitude....is not
    good......tnx....hope you'll take it this....in the
    positive side.....be optimistic...guys....the
    world..is not yours....all of us will just past
    away....always..remember that one.....treasure..our
    stay in this....temporary home.....which...is
    world....Whoa. That post seems to be killing my brain.
    URK
    Join........us..........do not be..........afraid.......

  • How to make accordion widget in netbeans

    As i am new to this field.Can anyone guide me how to make accordion widget in netbeans.I have downloaded the spry zip file.
    Thanks in Advanced

    You will not see them on the lock screen. Only on the notification screen (swipe down from the top AFTER unlocking the phone).

  • How to make a jar please help...this is urgent.

    hi guys, as you know i am a novice programer...I need to make a jar in order to reuse some of my servlet. but how I do that...please be kind to give me the instruction
    novice programer

    hi guys, as you know i am a novice programer...I need
    to make a jar in order to reuse some of my servlet.
    but how I do that...please be kind to give me the
    instruction
    novice programerTry these links:
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/jar.html
    http://java.sun.com/docs/books/tutorial/jar/

  • How to make a DefaultListModel on NetBeans?

    Hey guys, im trying to make a DefaultListModel for my JList in NetBeans but got no clue how to do it. Im new with both java and NetBeans so please be nice to me :P I cant just edit the code by hand so how do I make it by NetBeans? Thanks for all help.

    cwjrda wrote:
    If you want to ....help out with Netbeans problems on the Sun forums, here is [a few you can attend to|http://www.google.com.au/search?hl=en&client=firefox-a&hs=500&rls=com.ubuntu%3Aen-US%3Aunofficial&as_q=netbeans&as_epq=&as_oq=&as_eq=&num=10&lr=&as_filetype=&ft=i&as_sitesearch=forums.sun.com&as_qdr=all&as_rights=&as_occt=any&cr=&as_nlo=&as_nhi=&safe=images].
    OTOH most of us encourage the OP to either learn how to do it not using Netbeans (at which stage, F-1 and their further understanding puts them in good stead to do it using Netbeans), or suggest they post on the [Netbeans forums|http://www.netbeans.org/].

  • How to make new jars available globally on the portal to all projects?

    Hello,
    I have downloaded few jar files which are needed for few projects and aren't comming with the portal by default.
    I would like to make these jars available globally to every project I will write in the future. What is the exact procedure I need to do on the portal server in order to acheive this?
    Regards,
    Roy

    I've been playing around with this as well (in combination with NWDI).
    You need to consider what should happen if you ever have an update of the "common" jar-files that you are adding. They might break some of the portal apps that use them, so it's not a good solution to use a J2EE Library DC if you know there will be updates in the future. If you're sure there will be no updates, this is indeed the simplest way to implement this. All you need to do is to specify a PrivateSharingReference for the portal apps as explained here: http://help.sap.com/saphelp_nw04/helpdata/en/88/bdfc3f48ecc742e10000000a1550b0/content.htm
    The 2nd available option (based on NWDI) is to create an External Library DC and add your jars to that. Create an extra public part for assembly (next to the existing public part for compilation called ExternalLibs). Then, for each portal app DC add the External Library DC as a used DC, create an assembly public part and add an Entity Reference to the assembly public part of the External Library DC. This way the jars will be assembled in the PAR file for each portal app. The nice thing is that you are still maintaining the jar files in one central place, but that you have the option to update and test the portal apps individually.

  • How can i run a jar file as EXE on mouse click..

    *{color:#0000ff}how can i run a jar file as EXE on mouse click..is it possible in any way?????????{color}*

    amrit_j2ee wrote:
    *{color:#0000ff}how can i run a jar file as EXE on mouse click..is it possible in any way?????????{color}*Do you mean converting it from a jar file to an EXE file or do you mean that you would like to run the application by just double clicking it?
    If it's the latter then you need to make the jar file including a manifest.
    The manifest can be just a txt file with its content to be something like this:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: Somebody
    Main-Class: NameOfTheMainClass
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by buildTo make the jar file including the manifest, use something like this in your command prompt (of course you must have compiled your java file(s) first):
    jar cfm test.jar MANIFEST.txt NameOfTheMainClass.classAfter that you'd be able to run your application just by double clicking it.
    If you're a NetBeans user, you can build your standalone application by right-clicking your project and then going to properties => run => and choosing a Main class. After that right click on that project and "Clean and Build", locate the jar file in the "dist" folder and double click it =]
    Hope it helps,
    LD

  • How can i make the installer

    i hava allmost completed my project (Java Swing and Ms Access).
    but i dont know how to make the EXE & installer. in my computer i have dual OS. one have JVM and the other have not JVM. I am using NetBeans 5.5.1 as IDE. When i am trying to run application.jar for Dos Prompt. it is running but when i am trying to it on the other OS it is not running and give an error message something " Don't have the main class..." please help me.
    How can i make a installer of my project with which i can install the package any where.

    you can use install4j utility.. it is open source so u can have a free copy..

  • How to convert .class into .jar file

    Hi,
    How to convert .class into .jar file

    jsf_VWP5.5.1 wrote:
    Hi,
    How to convert .class into .jar fileFrom a command prompt, cd to the location of your .class file(s).
    If you want to create a simple jar, use: jar -cf Whatever.jar Whatever.class
    If you want to compile all .class files in a directory into a jar, use *.class instead.
    Now, I'm going to assume you want to create an executable jar... here's how to do that:
    1) Create a blank text file; for this example, lets call it main.txt.
    2) In the first line of main.txt, type: Main-class: Whatever ('Whatever' should be the name of the class in your program where the main() method is located)
    3) Press enter to go to the next line (someone please correct me if I'm wrong, but if you don't insert the line break/CR after the Main-class: statement, this will not work... in my experience, this is true)
    4) Make sure you save this file in the same directory as your .class file(s).
    5) Type: jar -cmf Whatever.jar main.txt Whatever.class
    ...and that's about it. For more information on the usage of the jar command and to understand the switches (such as -cmf), try jar --help.
    Hope that helps.

Maybe you are looking for