One class type compiles into many .class files

I have written a single large GUI file that is composed of a single class (FCTabGui class). When I run javac FCTabGui.java it generates around 190 classes with the same name (FCTabGui) but each one after the first is attached with $# at the end (ie FCTabGui$1.class, ..., FCTabGui$189.class) . I have never seen this before. Does anyone know why this is happening and how I can keep it to just one .class file instead of 190. Thanks.
Jason

What I meant by "standard to jar up files for a GUI"
is that if there are lots of buttons that create
anonymous classes then you HAVE to jar up the files
because there is no alternative to it. One cannot
preserve the single .class file setup with a GUI,
unless its really small and has no action listeners.I suppose you could contort your code so that the single class not only creates all the widgets but also acts as the single action listener for every single button. This way you could avoid creating anonymous inner classes. But anyone who needs to maintain your code will grow to hate you.
One can double click on a jar file and it will start
running automatically, (assuming the JRE is
installed), right?You can do that, but it's not automatic. You have to explicitly list what class has the main() method to invoke when the jar is double clicked. If you're using a wizard to create the jar, this may be easily specified. Otherwise you can do it by creating a jar manifest file with a "Main-class:" attribute.

Similar Messages

  • Do unused libraries get compiled into the binary file?

    So if I import all classes inside flash.display.* and only use Sprite, will everything get compiled?
    Or only Sprite?

    In general, only the classes you actually use are compiled in -- the import statement just tells the compiler where to look to try to find code to compile.
    However...
    Since flash.display.* are all native classes, none of them are ever included in your .air file (desktop) or .apk file (Android) or .swf file (Flash Player), because the flash.display.* classes are built into the AIR/Flash Player runtime and their definitions exist there.
    However...
    If you build an AIR for iOS app, the runtime has to be compiled in as part of your app. Currently the entire runtime is compiled into your app, regardless of whether you use certain parts of it or not. (The same is true if you use a captive runtime for your desktop or Android AIR app.)
    Paul

  • Execution of one CLASS file ( a compiled program)

    this is a ambiguse problem for me !!!!
    i working with jsdk1.4.1 .
    i can compile programs but can't perform them with "java" !!
    this is error of it :
    (( Exception in thread "main" java.lang.NoclassDefFoundError : file name ))
    anyone can lead & help me !!!
    Thank you for your responses .
    F.Heidary

    Set your classpath.

  • Setting JTree in one class file from another class file

    Hello,
    I'm new to java. I recently created a project in netbeans and here is one of the java files. I used the IDE to make a split pane, with a tree structure and panel in it.
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * AmplifierDesignGUI.java
    * Created on Jun 20, 2010, 1:18:52 PM
    package AmplifierDesign;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    * @author Bugz
    public class AmplifierDesignGUI extends javax.swing.JFrame {
    /** Creates new form AmplifierDesignGUI */
    public AmplifierDesignGUI() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jSplitPane1 = new javax.swing.JSplitPane();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTree1 = new javax.swing.JTree();
    jPanel1 = new javax.swing.JPanel();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    jMenu2 = new javax.swing.JMenu();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jScrollPane1.setViewportView(jTree1);
    jSplitPane1.setLeftComponent(jScrollPane1);
    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(0, 475, Short.MAX_VALUE)
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(0, 274, Short.MAX_VALUE)
    jSplitPane1.setRightComponent(jPanel1);
    jMenu1.setText("File");
    jMenuBar1.add(jMenu1);
    jMenu2.setText("Edit");
    jMenuBar1.add(jMenu2);
    setJMenuBar(jMenuBar1);
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(8, 8, 8)
    .add(jSplitPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 571, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(32, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(layout.createSequentialGroup()
    .add(8, 8, 8)
    .add(jSplitPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 278, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
    pack();
    }// </editor-fold>
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new AmplifierDesignGUI().setVisible(true);
    try {
    new JTreeStructure().setVisible(true);
    } catch (Exception ex) {
    Logger.getLogger(AmplifierDesignGUI.class.getName()).log(Level.SEVERE, null, ex);
    // Variables declaration - do not modify
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTree jTree1;
    // End of variables declaration
    So once this was done I wanted to link the JTree to a mysql database. So I found a sample .java file on the net:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package AmplifierDesign;
    import java.awt.*;
    import java.sql.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    public class JTreeStructure extends JFrame {
    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
    //public static void main(String args[]) throws Exception {
    // new JTreeStructure();
    public JTreeStructure() throws Exception {
    super("Retrieving data from database ");
    String driver = "com.mysql.jdbc.Driver";
    String url = "jdbc:mysql://localhost:8889/";
    String db = "icons";
    ArrayList list = new ArrayList();
    list.add("Laser Objects");
    Class.forName(driver);
    con = DriverManager.getConnection(url + db, "root", "root");
    try {
    String sql = "Select * from fiberComponents";
    st = con.createStatement();
    rs = st.executeQuery(sql);
    while (rs.next()) {
    Object value[] = {"Fiber Components",rs.getString(2) };
    list.add(value);
    } catch (Exception e) {
    System.out.println(e);
    rs.close();
    st.close();
    con.close();
    Object hierarchy[] = list.toArray();
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = getContentPane();
    DefaultMutableTreeNode root = processHierarchy(hierarchy);
    JTree tree = new JTree(root);
    content.add(new JScrollPane(tree), BorderLayout.CENTER);
    setSize(275, 300);
    setLocation(300, 100);
    setVisible(true);
    private DefaultMutableTreeNode processHierarchy(Object[] hierarchy) {
    DefaultMutableTreeNode node = new DefaultMutableTreeNode(hierarchy[0]);
    DefaultMutableTreeNode child;
    for (int i = 1; i < hierarchy.length; i++) {
    Object nodeSpecifier = hierarchy;
    if (nodeSpecifier instanceof Object[]) // Ie node with children
    child = processHierarchy((Object[]) nodeSpecifier);
    } else {
    child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf
    node.add(child);
    return (node);
    The problem is when I run my program two windows open up. The original one with JTree1, and the panel and horizontal splitplane and another window with a new tree component that did get its objects from the database. My question is how do I "replace" the JTree1 with the new tree created from the second java file?
    Or additionally, maybe I could set the data for JTree1 from within the second java file?

    zmoddynamics wrote:
    ....Please excuse my post as I am not sure what is meant by code tags?To use code tags, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.
    Another way to do this is to manually place the tags into your code by placing the tag [cod&#101;] above your pasted code and the tag [cod&#101;] below your pasted code like so:
    [cod&#101;]
      // your code goes here
      // notice how the top and bottom tags are different
    [/cod&#101;]Luck.

  • Importing the mxmlc compiler into Eclipse&missing files

    import flex2.compiler.mxml.Parser;
    import flex2.compiler.mxml.ParserConstants;
    import flex2.compiler.mxml.Token;
    import flex2.compiler.mxml.TokenManager;
    hello guys:
         I've tried to import the mxmlc compiler to my Eclipse IDE, but failed .
         and I found that the classes below seems to be missed,even in the http website   http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/
    import flex2.compiler.mxml.Parser;
    import flex2.compiler.mxml.ParserConstants;
    import flex2.compiler.mxml.Token;
    import flex2.compiler.mxml.TokenManager;
         do you have any ideas or suggestions ?
         any suggestions or references are appreciated.thx!

    hello :
          thanks James for reminding me about that.These files seems to be generated by Ant
         thanks for that

  • One music album fragments into many. How to prevent?

    (This is a problem that happens when I use my preferred method of viewing albums, "show items in a list, grid or with cover flow)
    When I import a single album which is a 2 or 3 CD set onto i-tunes, it shows each CD as a separate album, even though they're all part of the same album. When I try to drag the second or third album into the first, so as to merge them, I am unable. So, for example, I have three YES albums showing on itunes, which are in fact just one album consisting of three cds.
    Even more annoying is "Johnny Cash at Madison Square Garden." It's a single CD with only about 14 songs, but because some songs are listed as by "Johnny Cash," others by "Johnny Cash and the Carter Family," and etc., it has broken up one album into four little albums. Two of the "albums" only have one song each.
    Is there anyway to make iTunes understand that a double cd album, or a single album with a few variant performers, are in fact just one album? Can I merge them so each album really looks just like one album, not like many?
    Thanks

    check this post by TT2.

  • How to split one big master clip into many?

    Hi,
    This is probably a simple question for you pros. Thank you for reading.
    I have film that I've telecined onto a DV. However, FCP imported a one hour tape as one big master clip. Is there a way I can split this master clip into several small clips so I can organize my project?
    Does that make sense?
    Thank you in advance,
    Nik

    Since you telecined onto DV I guess there are no Date&Time gaps between scenes, so you cannot use DV Start/Stop Detect. Then the only way I can think of is to do it manually: open the clip in the viewer, select the first scene by setting its IN and OUT points, edit to the timeline, back to the viewer select the next scene setting a new pair of IN and OUT points, edit to the timeline, etc.
    If you prefer you can move each new clip to the browser, and collect them together into a bin, before editing them to the timeline.
    Piero

  • Conversion of one planned independent reuirements into many planned orders

    Hello all,
    The planned independent requirements are collected in a weekly bucket. But I want to have the planned orders in the following way:
    For some products five planned orders are to be generated in equal distribution in a week of 5 days.
    For some products one planned order to be generated on a specific day of week, say Tuesday of every week.
    So what are the settings required to achieve the above conditions.
    Request your expertise on this subject.
    Thank you.

    Dear ,
    I think you should create the PIR in daily spliting .If you enter a weekly period, you can split the planned quantity into the weeks of the period or into the days of the period.Select the planned independent requirement item, and choose Split per.online.You can follow the belwo steps to do this :
    The Period for Splitting dialog box appears.
    Enter the period indicator, and the start and the end of the requirements period.
    Enter the quantity to be split in the Planned quantity field.
    In the Splt field, enter the period indicator for the split.
    If you want to round up or down the schedule line quantity, enter the rounding value, and choose Continue.
    Select the item, and choose the Schedule lines tab title.
    Now Run MRP in MD02-NETCH , 2,1,3,3,3 and look up the result in MD04 .Now , convert the Planned Order to Production Order partially with your frist requirement .
    In the secodn requirement , you can make use of Individual /Collective Indicator -2  in MRP4 view  and generate one planned order .
    Try and wait for experts to comment
    Regards
    JH

  • Why can't I type text into a Photoshop file?

    No matter what I do, or where I've checked, I can't get text to show up on my either jpg or psd version of an image. The text box isn't too small (checked that), text is black on white background (check), even changed fonts to test that. Nothing! Any ideas? I'm working on a PC, Windows 7, CC and/or PSCS6 -- tried them both.

    What is the image size?  If you have a large pixel image with a low DPI, for instance, text can be too tiny to see.  In that case, open Image resize > turn off resampling > increase dpi from its probable 72 to something like 300.  Try using a linear size for text as opposed to points.  If your image is 10 inches high, set the text to 1 inch and you know the text should be 1/10th image hieght.

  • How to compile and register a Java CFX tag with multiple class files?

    All-
    If this is the wrong forum for CFX questions, please let me
    know.
    I need to determine how to compile and register a Java CFX
    tag that contains multiple class files. One class file implements
    the CustomTag interface and the other class files implement various
    supporting classes. All of the documentation that I have found
    talks about using a single class file. I am assuming that a JAR
    file will be involved, but I am not sure of the specifics.
    Thanks in advance for your help.
    -Josh

    Yes, it will involve a jar. Use your java IDE (eclipse,
    etcetera ..) to create a jar containing all of the classes. Check
    your ide's documentation for how to create jar files. After you
    have created the jar, place the jar in the CF class path so CF will
    recognize it. For example the {cf_root}/WEB-INF/lib directory. CF
    must be restarted before it will detect the new jar. After
    restarting CF, register the CFX tag in the ColdFusion Administrator
    using the name of the class that implements the CustomTag
    interface.
    Though it is worth noting you can also instantiate java
    classes directly from ColdFusion (ie without using a CFX
    tag).

  • Two class files with $ on compile

    Hello friends, I have a simple java program, that consists of two classes, coded in the the same java file.
    One of hte classes extends Thread.
    When I compile the source file, I get one class file for the base class, and two for the other one - ClassName.class and ClassName$1.class.
    Why is the second one created?

    The ClassName$1.class is a class file for an anonymous inner class. You create them with code likebutton.addActionListener(new ActionListener() {
         actionPerformed(ActionEvent ae) {
              System.out.println("button was pressed");
    });This particular example is from the GUI world where event listeners are commonly created using anonymous inner classes. There's a separate file for it just because there's always exactly one class file for each class.

  • VM crashes with big class files generated of JSPs

              Hi,
              When calling certain JSP pages with WebLogic Server 5.1 (SP 6) the HotSpot Virtual Machine (JDK1.3) crashes with a core dump.
              Using WebLogic as the JSP engine produces of every JSP page one java file which
              is compiled with javac to one class file. Each generated java file consists of
              just one method: _jspService(...){...}. One method is allowed to be of 64 K
              (the dynamic part 32 K as maximum). As we include other JSP pages and
              components and use taglibraries, the WebLogic JSP engine generates a very big
              java file (more than 1 MB). Javac compiles this to a class file which only
              method exceeds the 64 K limit. As the javac compiler does not reject the class
              file with the to big method the virtual machine crashes.
              Running the same JSP page on Windows NT 4 with WebLogic Server 5.1 (Service Pack 6)
              and JDK 1.3 BUT using the java option -classic works.
              Unfortunately it seems that there is no -classic option for java on Solaris for JDK1.3.
              Using JDK1.2 (JDK_1.2.2_05a) on Solaris or the jikes compiler of Jakarta
              causes an exception instead of a core dump but still does not work.
              Using solaris jdk1.2.2_05a the same page request results in the following exception:
              Tue Nov 21 09:08:16 CET 2000:<I> <WebAppServletContext-maxblue> Generated java file:
              /opt/tadevw/maxblue/weblogic/maxblue_cluster/maxblue_server/public_html/WEB-INF/_tmp_war/jsp_servlet/_portfolio/_PortfolioMyportfolio.java
              Tue Nov 21 09:08:24 CET 2000:<E> <WebAppServletContext-maxblue> Servlet failed with Exception
              java.lang.VerifyError: (class: jsp_servlet/_portfolio/_PortfolioMyportfolio, method:
              _jspService signature: (Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V) Illegal target of jump or branch
              Is there a way that the JSP engine of WebLogic creates/generates
              more than one function? (Without reengineering of the source code?)
              Regards,
              Boris
              

    Thank you! I had no idea. But what is a FAT32 drive? Is it the work bench in the Mac, that is used for the transfering between the external hard drives? Is there any way around this then?
    I thought in these HD home movie days, that this was an easy thing dealt with everyday. I still need to understand what practical solutions I can find. The files are .mov - quicktime files.
    It couldn't be the case that files larger than 4BG should be locked in the hard drive forever?
    Sverre

  • Problem creating package structure and where is my .class file??????

    Working on Tomcat I have my folder structure like this...
    webapps
    ->app_root
    ->WEB-INF
    ->classes
    ->src
    -> .java files
    ->META_INF
    In the command prompt i compile using this
    c:\Program Files\Apache Tomcat 4.0\webapps\Murthy\WEB-INF\classes>javac -d src\*.java
    and in my java files I have the package structure mentioned as
    package com.acme;
    after compiling i expected this to happen for me.
    webapps
    ->app_root
    ->WEB-INF
    ->classes (in WEB-INF)
    ->com (in classes)
    ->acme (in com)
    -> .class files (in acme)
    ->src (in WEB-INF)
    -> .java files(In src)
    ->META_INF
    The funiest part for me started he when i compiled the file
    c:\Program Files\Apache Tomcat 4.0\webapps\Murthy\WEB-INF\classes>javac -d src\one.java
    It compiled successfully without giving me any error but no package structure was created and THERE IS NO one.class file anywhere in my system.....Then how did it compile my file and where is the .class file.
    I think am worng somewhere but unable to locate it.
    Can somebody pull me out of thiss stuf??? Need to do it fast.
    Thanx.

    c:\Program Files\Apache Tomcat 4.0\webapps\Murthy\WEB-INF\classes>javac -d src\*.java
    The command you posted does not have a source file specification. You are telling the compiler to put the .class files in src\*.java but you are not specifying any .java files. It looks like your command should be javac -d . src\*.java

  • How to get *.class file path....

    how could find the executable file path at execution time..
    if there is one *.class file, then i will paste it to another location . next i will execute that .class file. how to find that path from execution program ....

    Try the following
    URL path = getClass().getProtectionDomain().getCodeSource().getLocation();

  • DrClap, schapel, jschell whats better architecture jar files or class files

    What would be a better architecture for deployment. Jar files or class files. We were recently having a debate at work as to generate installation scripts that put jar files on the system where the app is being installed or to make the script generate class files at the desired location.
    It would be good to know as to what you ppl think and what are the pros and cons of both.
    Some claimed with class files it would be easier to put in patches later on and I kinda agree with that. However your thoughts would be appreciated.
    Come on DrClap, schapel, jschell, jsalonen....... I am a fan of yours already

    This, of course, is why topics shouldn't be addressed to individuals - they are likely to never see it. Today is the first time I have seen this, and that is due solely to a search that I was running.
    Why would you use one over the other?
    ----Distribution costs
    It takes more time to send a bunch of class files down the wire than a single jar file. However, it takes more time to send a jar than a single class file. So there is a delicate trade off in a web application where one is using java. If you send the jar every time it is modified the entire jar must be moved. Class files take less time, but all of them must be moved for a new person.
    So in this case if you have a fixed based of users (internal use), and a majority of the files do not change then class files are better. If the user base is transitory and large (external use) then a jar file is probably better.
    ----Usage:
    You can use reflection to dynamically add functionality to an application. If you use a jar file then the application must be restarted for the changes to take effect. If you use class files then the application does not have to be restarted. Obviously the second only works if you have some way to dynamically notify the application that new classes are available - like a database.
    This becomes very relevant if you do not want to restart the application and you do not have a distributed application base in place.
    Also the older classes, even if not used, are still loaded in the application unless it is restarted (presuming a class loader is not used.) Most of the time this does not make difference.
    Since in the above it is likely that there is not a large distribution problem, when the usage is a concern then the best strategy is as class files. They allow the most flexibility and there is unlikely to be any concern at all how it is packaged.
    -------Misc
    Speed. Someone suggested speed. Guessing I would say that the jar file is going to be faster. Once the Sun jvm gets the file it doesn't let go. And as pointed out opening files is rather costly. However, I doubt this is going to be a significant cost on any system. Startup costs, although sometimes annoying, are seldom significant in terms of application performance.
    Security. The is a certain level of security with a jar file. You have one jar file and distribute it to the help desk people. And one of them deletes it accidently. It is going to be a lot easier to figure that out than if they deleted one class file. Additionally it is probably easier to encrypt/decrypt a jar file (if you really must) than class files.
    Dynamic class loading. If you are storing classes in non-traditional places, like a database rather than files, then it is probably going to be easier if you do it as class files.
    Testing. It is easier to replace a class file in a testing environment to fix a bug than a jar file. Particularily if the make process for the jar file rebuilds everything.

Maybe you are looking for

  • Need to change the sender of the workflow email using SPD 2010

    Hi, I got a requirement. I've created a SharePoint Designer 2010 workflow which will trigger an email. The sender of that email is default. I need to change the sender of email to some user's email address like [email protected] Can this be possible

  • Sender RFC adapter Error- request was null while trying to extract it.

    Hi All, I  have a scenario running in Production(PI 7.0 system) where SAP ECC sends RFC request through sender RFC adapter. The scenario was working fine but now I am getting the below error in default trace and I couldn't see any error in communicat

  • Do you want to allow changes from firefox software updater every time I attempt to connect to the internet

    Every time I attempt to connect to the internet I get a dialogue box that asks do you want to allow this programme to make changes? The publisher is Mozilla, and it also tells me that it relates to Firefox software updater. Never had this until about

  • Something about a fan.....

    When Ic start yup my laptop is says a screen appears that says something about continuing use of this laptop wil cause problems with it. It also says someting about a fan so I'm assuming that it needs a new fan or something.. I'm scaredv  it will shu

  • Putting a data point from answers on a map

    I have the dumbest report in the history of the world in obiee that shows 1 row - State, Measure and Amount.  Literally 1 row of data.  I want to show that row on a map instead of a grid.  The data is as follows. CA,REVENUE,1 I loaded the mvdemo data