About importing class libraries?

I want to develop a webmail project,so I must use the javax.mail.*,but when I build a new project by J Bulider 5,I can not import those class,why?the same project is when I develop an common project,I can import javax.servlet.*, but when I build a web project,it do.why????thanks

Presumably you mean you can't compile it.
There is some obscure way that you have to include the jar in the IDE that you are using. You can wait until someone provides that or search in the forums for JBuilder and find one of the previous posts that explains how to do it.

Similar Messages

  • Confused about import iPhoto Libraries Aperture 3.2

    When I first purchase Aperture 3.2.3 back in May I had many iPhoto librarys split out by year. I wanted an integrated view so when I imported them to Aperture I chose the "leave iPhoto library in place" option. That may not be the exact wording. I was under the impression that this meant that Aperture would point to those libraries, but not duplicate them. I'm not so sure of that now. My Aperture library is around 25GB. My iPhoto libraries add up to at least 120GB.
    I have upgraded to Aperture 3.4.2. I know about the library switching option, but I still want an integrated look at all my photos in one place. I got Aperture so I didn't have to do the iPhoto library switching I was doing.
    Yesterday I spent a good amount of time deleting a bunch of extraneous photos I had from a project I did throughout 2011. My Aperture library shrunk 1GB. The iPhoto library didn't change size. That makes me think that the import actually put the files in the Aperture Library.
    So, now I'm not sure what's going on. Is there a way to see which libraries are pointed to the original iPhoto libraries?

    Is there a way to see which libraries are pointed to the original iPhoto libraries?
    When you select an image in the Aperture library and use the command "File > Show in Finder" you can see the location of the original image file. If this points into a folder inside an iPhoto Library, you are really referencing the iPhoto Library. But if the command "Show in Finder" is disabled for an image, it is managed inside the Aperture library.
    But frankly, I do not think it is a good idea to use Aperture to delete images inside your iPhoto libraries. Ypur iPhoto Libraries may be corrupted this way.

  • Problem about importing class

    Hello,
    i have this code.
    <!-- NameProject.mxml -->
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:my="components.*" width="100%" height="100%">
    <mx:Script>
    <![CDATA[
    import lib.User;
    public var u:User = new User();
    trace(u.say("hello world"));
    ]]>
    </mx:Script>
    </mx:Application>
    <!-- /lib/User.as -->
    package lib{
    public class User{
    public function say(s:String):String{
    return s;
    i get this error:
    1120 Access of undefined property
    Why??
    thanks so much

    You have this Script block in your code:
    <mx:Script>
    <![CDATA[
    import lib.User;
    public var u:User = new User();
    trace(u.say("hello world"));
    ]]>
    </mx:Script>
    The trace statement is just "floating" in there - it must be
    in a function. When do you want this trace executed? For example,
    if you want to display it when the Application dispatches its
    creationComplete event, then add a creationComplete event handler
    to the Application tag and then write the function to handle the
    event in the Script block:
    <mx:Application ... creationComplete="initApp()">
    <mx:Script>
    <![CDATA[
    import lib.User;
    public var u:User = new User();
    private function initApp() : void {
    trace(u.say("hello world"));
    ]]>
    </mx:Script>
    Now the trace statement appears in a function so you will not
    get the error.

  • Importing classes in Jsdk 1.4.2

    Hi,
    I have two swing applications that run perfectly well when compiled and run. But then I am trying to include these two programs as two tabbed panes in a third program.
    I try to import classes from the other two programs using a simple import statement. But when I compile it the compiler return an error statement.
    I tried putting a package line in both the programs and tried importing it as a package in the third one and it says invalid package name.
    Can anybody help.
    Thanks in advance.

    OK here is the code. This is a example code from the book Java2 from scratch
    First file
    PortfoilioTotalsPanel.java
    // Import the packages used by this class
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    // PortfolioTotalsPanel Class
    public class PortfolioTotalsPanel extends JPanel
    // Define the dark green color
    public final static Color darkGreen = new Color( 0, 150, 40 );
    // Create our labels
    JLabel lblDollarChange = new JLabel( "Dollar Change:", JLabel.CENTER );
    JLabel lblPercentChange = new JLabel( "Percent Change:", JLabel.CENTER );
    // Constructor
    public PortfolioTotalsPanel()
    // Set the layout manager
    setLayout( new GridLayout( 2, 1 ) );
    // Add the labels to the JPanel
    add( lblDollarChange );
    add( lblPercentChange );
    // setDollarChange( fDollarChange )
    // Set the Dollar Change label to the dollar amount in fDollarChange
    public void setDollarChange( Float fDollarChange )
    // Set color based off of value
    if( fDollarChange.floatValue() > 0 )
    // Green for positive
    lblDollarChange.setForeground( darkGreen );
    else if( fDollarChange.floatValue() < 0 )
    // Red for negative
    lblDollarChange.setForeground( Color.red );
    else
    // Black for no change
    lblDollarChange.setForeground( Color.black );
    // Set the label text
    lblDollarChange.setText( "Dollar Change: $" + fDollarChange.toString() );
    // setPercentChange( fPercentChange )
    // Set the Percent Change label to the percent in fDollarChange
    public void setPercentChange( Float fPercentChange )
    // Set color based off of value
    if( fPercentChange.floatValue() > 0 )
    // Green for positive
    lblPercentChange.setForeground( darkGreen );
    else if( fPercentChange.floatValue() < 0 )
    // Red for negative
    lblPercentChange.setForeground( Color.red );
    else
    // Black for no change
    lblPercentChange.setForeground( Color.black );
    // Set the label text
    lblPercentChange.setText( "Percent Change: " + fPercentChange.toString() + "%" );
    // Main application entry point into this class
    public static void main( String[] args )
    // Create a JFrame object
    JFrame frame = new JFrame( "Portfolio Totals" );
    // Create an PortfolioTotalsPanel Object
    PortfolioTotalsPanel app = new PortfolioTotalsPanel();
    // Set the values of the labels
    app.setDollarChange( new Float( "-150.50" ) );
    app.setPercentChange( new Float( "15" ) );
    // Add our PortfolioTotalsPanel Object to the JFrame
    frame.getContentPane().add( app, BorderLayout.CENTER );
    // Resize our JFrame
    frame.setSize( 600, 100 );
    // Make our JFrame visible
    frame.setVisible( true );
    // Create a window listener to close our application when we
    // close our application
    frame.addWindowListener
         new WindowAdapter()
    public void windowClosing( WindowEvent e )
    System.exit( 0 );
    Second Program
    // ===========================================================================
    // File: StockTablePanel.java
    // Description: Sample file for Java 2 From Scratch
    // ===========================================================================
    // Import the libraries this application will use
    import javax.swing.JTable;
    import javax.swing.table.*;
    import javax.swing.JScrollPane;
    import javax.swing.JFrame;
    import javax.swing.SwingUtilities;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    // Main application class: StockTablePanel
    public class StockTablePanel extends JPanel
    // Create a new Stock Table Model object
    StockTableModel stockTableModel = new StockTableModel();
    // Create a new JTable and associate it with the StockTableModel
    JTable stockTable = new JTable( stockTableModel );
    // Constructor
    public StockTablePanel()
    // Set the size of the table
    stockTable.setPreferredScrollableViewportSize( new Dimension(620, 350) );
    // Set the column widths for the table
    TableColumn column = null;
    for (int i = 0; i < 5; i++)
    column = stockTable.getColumnModel().getColumn( i );
    column.setPreferredWidth( stockTableModel.getColumnWidth( i ) );
    // Create a scroll pane and add the stock table to it
    JScrollPane scrollPane = new JScrollPane( stockTable );
    // Add the scroll pane to our panel
    add( scrollPane, BorderLayout.CENTER );
    // float getDollarChange()
    // Computes the total dollar change for the current portfolio
    public float getDollarChange()
    // Create a variable to hold the total change for all stocks
    float fTotal = 0;
    // Loop through all rows in the table
    for( int i=0; i<stockTable.getRowCount(); i++ )
    // Retrieve the dollar change for this stock
    Float f = ( Float )stockTable.getValueAt( i, 10 );
    // Add that value to our total
    fTotal = fTotal + f.floatValue();
    // Return the total value
    return fTotal;
    // float getPercentChange()
    // Computes the total percentage change for the current portfolio
    public float getPercentChange()
    // Create a couple variables to hold the total the user spent
    // on the stocks and the current value of those stocks
    float fMoneySpent = 0;
    float fMoneyWorth = 0;
    // Loop through all rows in the table
    for( int i=0; i<stockTable.getRowCount(); i++ )
    // Extract some pertinent information for the computations
    Float fLastSale = ( Float )stockTable.getValueAt( i, 2 );
    Float fNumberOfShares = ( Float )stockTable.getValueAt( i, 6 );
    Float fPricePaidPerShare = ( Float )stockTable.getValueAt( i, 7 );
    // Add the amount of money the user spent on this stock
    // to the total spent
    fMoneySpent += fNumberOfShares.floatValue() * fPricePaidPerShare.floatValue();
    // Add the value of this stock to the total value of the
    // stock
    fMoneyWorth += fNumberOfShares.floatValue() * fLastSale.floatValue();
    // Compute the percentage change:
    // TotalValue/TotalSpent * 100% - 100%
    float fPercentChange = ( (fMoneyWorth / fMoneySpent) * 100 ) - 100;
    // Return the percentage change
    return fPercentChange;
    // Main entry point into the StockTableApplication class
    public static void main( String[] args )
    // Create a frame to hold us and set its title
    JFrame frame = new JFrame( "StockTablePanel Application" );
    // Create an instance of our stock table panel
    StockTablePanel stockTablePanel = new StockTablePanel();
    // Add our tab panel to the frame
    frame.getContentPane().add( stockTablePanel, BorderLayout.CENTER );
    // Resize the frame
    frame.setSize(640, 480);
    // Make the windows visible
    frame.setVisible( true );
    // Set up a window listener to close the application window as soon as
    // the application window closes
    frame.addWindowListener
         new WindowAdapter()
    public void windowClosing( WindowEvent e )
    System.exit( 0 );
    // Table Model Class - holds all of our row and column information
    class StockTableModel extends AbstractTableModel
    // Create the columns for the table
    final String[] strArrayColumnNames =
    "Sym",
    "Company Name",
    "Last",
    "Hi",
    "Lo",
    "Vol",
    "#Shares",
    "$Shares",
    "Total",
    "%Change",
    "$Change"
    // Create the rows for the table - hard coded for now!!
    final Object[][] obArrayData =
    // Row One
    "SAMS", // Symbol
    "Sams Publishing", // Company Name
    new Float( 10 ), // Last Sale
    new Float( 12 ), // High
    new Float( 8 ), // Low
    new Double( 2000000 ), // Volume
    new Float( 100 ), // Number of Shares Owned
    new Float( 7.5 ), // Purchase price per share
    new Float( 1000 ), // Total Holdings
    new Float( 33 ), // Percent change (increase!)
    new Float( 250 ) // Dollar change
    // Row Two
    "Good", // Symbol
    "Good Company", // Company Name
    new Float( 50 ), // Last Sale
    new Float( 52 ), // High
    new Float( 45 ), // Low
    new Double( 4000000 ), // Volume
    new Float( 100 ), // Number of Shares Owned
    new Float( 30 ), // Purchase price per share
    new Float( 5000 ), // Total Holdings
    new Float( 33 ), // Percent change (increase!)
    new Float( 250 ) // Dollar change
    // Row Three
    "BAD", // Symbol
    "Bad Company", // Company Name
    new Float( 20 ), // Last Sale
    new Float( 22 ), // High
    new Float( 18 ), // Low
    new Double( 2000000 ), // Volume
    new Float( 500 ), // Number of Shares Owned
    new Float( 50 ), // Purchase price per share
    new Float( 10000 ), // Total Holdings
    new Float( -60 ), // Percent change (increase!)
    new Float( -25000 ) // Dollar change
    // Return the number of columns in the table
    public int getColumnCount()
    return strArrayColumnNames.length;
    // Return the number of rows in the table
    public int getRowCount()
    return obArrayData.length;
    // Get the column name from the strArrayColumnNames array for the "col"-th
    // item
    public String getColumnName( int col )
    return strArrayColumnNames[col];
    // Return the value, in the form of an Object, from the obArrayData object
    // array at position (row, col)
    public Object getValueAt( int row, int col )
         // We will compute columns 8, 9, and 10, so if the column number is
         // below eight, we can just return it without computing or retrieving
         // anything.
         if( col < 8 )
         return obArrayData[row][col];
         // Retrive the necessary values from the object array to compute all
         // of the remaining columns
         Float fLastSale = ( Float )obArrayData[row][2];
         Float fNumberOfShares = ( Float )obArrayData[row][6];
         Float fPurchasePrice = ( Float )obArrayData[row][7];
         switch( col )
         // Total Holdings = Last Sale(2) * Number of Shares Owned(6)
         case 8:
         // Build a new Float object with the product of the two
         Float fTotal = new Float
         // Note, these have to be converted to type "float" to
         // perform the multiplication
         fLastSale.floatValue() * fNumberOfShares.floatValue()
         // Return the result
         return( fTotal );
         // Percent change =
         // (Last Sale Price (2) / Purchase Price (7)) * 100% - 100 %
         case 9:
         Float fPercentChange = new Float
         ((fLastSale.floatValue() / fPurchasePrice.floatValue ()) * 100) - 100
         return fPercentChange;
         // Dollar Change =
         // LastSale*NumberOfShares - PurchasePrice * NumberOfShares
         case 10:
         Float fDollarChange = new Float
         ( fLastSale.floatValue() * fNumberOfShares.floatValue() )
         ( fPurchasePrice.floatValue() * fNumberOfShares.floatValue() )
         return fDollarChange;
         // We have included every case so far, but in case we add another
         // column and forget about it, let's just return its value
         default:
         return obArrayData[row][col];
    // Return the class type, in the form of a Class, for the c-th column in
    // the first (0-th indexed) element of the obArrayData object array
    public Class getColumnClass( int c )
    return getValueAt(0, c).getClass();
    // Return true if the "col"-th column of the table is editable, false
    // otherwise. The following columns are editable:
    // Cell Description
    // 0 Symbol
         // 6 Number of Shares Owned
         // 7 Purchase Price per Share
    public boolean isCellEditable(int row, int col)
         // Check the column number
         if( col == 0 || col == 6 || col == 7 )
         return true;
         else
         return false;
    // Set the value of the (row, col) element of the obArrayData to value
    public void setValueAt(Object value, int row, int col)
         // Symbol
         if( col == 0 )
         // We need a string value - we can convert any
         // value to a string, so just assign it
         obArrayData[row][col] = value;
         // Number of Shares owned
         else if( col == 6 )
         // We need a number - either float or int
         obArrayData[row][col] = new Float( getNumberString( value.toString() ) );
         // Purchase Price per share
         else if( col == 7 )
         // We need a float
         obArrayData[row][col] = new Float( getNumberString( value.toString() ) );
         // Cell is not editable
         else
         return;
         // Notify our parent of the change
         fireTableCellUpdated(row, col);
    // String getNumberString( String str )
    // Read through str and return a new string with the numbers and decimal
    // points contained in str
    public String getNumberString( String str )
    // Get str as a character array
    char[] strSource = str.toCharArray();
    // Create a buffer to copy the results into
    char[] strNumbers = new char[strSource.length];
    int nNumbersIndex = 0;
    // Boolean to ensure we only have one decimal value
    // in our number
    boolean bFoundDecimal = false;
    // Loop through all values of str
    for( int i=0; i<strSource.length; i++ )
    // Check for a digit or decimal point
    if( Character.isDigit( strSource[i] ) )
    strNumbers[nNumbersIndex++] = strSource;
    else if( strSource[i] == '.' && !bFoundDecimal )
    // Append the character to the String
    strNumbers[nNumbersIndex++] = strSource[i];
    // Note that we found the decimal value
    bFoundDecimal = true;
    // Build a new string to return to our caller
    String strReturn = new String( strNumbers, 0, nNumbersIndex );
    // Return our string
    return strReturn;
    // Return the column width of the column at index nCol
    public int getColumnWidth( int nCol )
    switch( nCol )
    case 0:
    case 2:
    case 3:
    case 4:
    case 6:
    case 7:
    case 9:
    return 50;
    case 1:
    return 125;
    default:
    return 75;
    Third one that imports the previous two programs Classes
    // Import the packages used by this class
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    // Import our other components
    import StockTablePanel;
    import PortfolioTotalsPanel;
    // StockTableTabPanel
    public class StockTableTabPanel extends JPanel implements TableModelListener
    // Create our panels
    StockTablePanel stockTablePanel = new StockTablePanel();
    PortfolioTotalsPanel portfolioTotalsPanel = new PortfolioTotalsPanel();
    // Constructor
    public StockTableTabPanel()
    // Set our layout
    setLayout( new BorderLayout() );
    // Initialize the portfolio panel
    updatePortfolioTotals();
    // Add the child panels to our JPanel
    add( stockTablePanel );
    add( portfolioTotalsPanel, BorderLayout.SOUTH );
    // Add our class as a table model listener for the stock table
    // model so that we can update the portfolio totals panel
    // whenever the table changes.
    stockTablePanel.stockTableModel.addTableModelListener( this );
    // TableModelListener: tableChanged
    public void tableChanged(TableModelEvent e)
    // Make sure it is our table that changed
    if( e.getSource() == stockTablePanel.stockTableModel )
    // Call our method to update the portfolio totals
    updatePortfolioTotals();
    // public updatePortfolioTotals
    // Updates the portfolio totals panel labels based off of the values
    // in the stockTablePanel
    public void updatePortfolioTotals()
    // Get the values from the stockTablePanel and send them
    // to the portfolioTotalsPanel
    portfolioTotalsPanel.setDollarChange( new Float( stockTablePanel.getDollarChange() ) );
    portfolioTotalsPanel.setPercentChange( new Float( stockTablePanel.getPercentChange() ) );
    // Main application entry point into this class
    public static void main( String[] args )
    // Create a JFrame object
    JFrame frame = new JFrame( "Stock Table Tab" );
    // Create an StockTableTabPanel Object
    StockTableTabPanel app = new StockTableTabPanel();
    // Add our StockTableTabPanel Object to the JFrame
    frame.getContentPane().add( app, BorderLayout.CENTER );
    // Resize our JFrame
    frame.setSize( 640, 440 );
    // Make our JFrame visible
    frame.setVisible( true );
    // Create a window listener to close our application when we
    // close our application
    frame.addWindowListener
         new WindowAdapter()
    public void windowClosing( WindowEvent e )
    System.exit( 0 );

  • Importing Class

    I was reading the tutorial on importing class's. This is what
    I read
    Importing classes
    To reference a class in another script, you must prefix the
    class name with the class's package path. The combination of a
    class's name and its package path is the class's fully qualified
    class name. If a class resides in a top-level classpath
    directory--not in a subdirectory in the classpath directory--then
    its fully qualified class name is its class name.
    To specify package paths, use dot (.) notation to separate
    package directory names. Package paths are hierarchical, where each
    dot represents a nested directory. For example, suppose you create
    a class named Data that resides in a com/xyzzycorporation/ package
    in your classpath. To create an instance of that class, you could
    specify the fully qualified class name, as shown in the following
    example:
    var dataInstance = new com.xyzzycorporation.Data();
    My Question is about com/xyzzycorporation/ . would the full
    class parth be c:/com/xyzzycorporation/ . Why do they never state
    the drive letter when teaching about directories.

    Because there is no need. you don't need to reference the
    drive letter.
    Here's the basic jist of what they are saying....
    Single Class File...
    If you create your own custom class and want to use it in
    your flash file, save it into the same directory as the fla file
    and call the classes constructor. By default flash will look inside
    the folder where the fla resides in for the class files if it
    cannot find it inside the default directory.
    Multiple Class Files - 1 Project (often referred to as
    packages)
    Use your qualified domain name but backwards.....
    my domain is www.sd-dezign.com so if I was going to include a
    package of utility class files in my document I would do the
    following
    Create a folder in the same folder with my fla name it com
    and inside that a folder called sddezign and inside that utils and
    all my as files would be in there...the folder structure might look
    like this....
    myfile.fla
    com
    >sddezign
    >>utils
    >>>box.as
    >>>circle.as
    To call the constructor for each class, I have two options.
    The first which is by far the easiest looks like this
    In whatever frame you need to call that class constructor
    include "com.sddezign.utils.*";
    var myBox:Box = new Box();
    The second method requires more typing and can get tedious
    var myBox = new com.sddezign.utils.Box();
    Hope this helps you a bit better.

  • To ragnic and other about Singleton class

    Hi ragnic. Thanks for your reply. I posted the code wrong. Heres' my correct one.
    I have a GUI first loaded information and the information is stored in a databse, I have some EJB classes..and my singleton class ABC has some method to access to the EJB..
    so my first GUI will gather info using singleton class and later if I click on
    a button in my first GUI class, will pop up another frame of another class , this class also need to class setPassword in my Singleton..
    are my followign codes correctly??
    iS my Class ABC a SINgleton class? thanks
    Is my class ABC use as single correctly. And It is called from other classes is also correct?
    I'm new to java and like to learn about Singleton class.
    But I really dont' understand it clearly after reading many examples of it.
    I have a project to convert my class abc to a singleton.
    But I dont know how to do it.
    In my class(soon will become a singleton) will have few methods that later I need to use it from another class A and class B.
    I have a GUI application that first load my class A..and my class will call
    class abc(singleton) to get some information from it.
    and then in class A has a button, if I click on that button I will call SIngleton class again to update my password, in the singleton class has method calls updatePassword. But I dont know how to call a singleton from other class.
    I have my code for them below:
    1)public class ABC //attempt using a singleton
    private static ABC theABC = null;
    private ABC(){}
    public synchronized static ABC getABC()
    if(theABC == null)
    theABC= new ABC();
    return the ABC;
    public void updateUserInfo(SimpleUser user)
    throws UserNotFoundException, DelegateException
    try
    UserCollectionHome userCollectionHome = (UserCollectionHome)
    EJBHomeFactory.getFactory().lookupHome("vista/UserCollection",
    UserCollectionHome.class);
    UserHome userHome = (UserHome)
    EJBHomeFactory.getFactory().lookupHome("vista/User",UserHome.class);
    UserCollection uc = userCollectionHome.create();
    uc.updateUserInfo(user, userHome);
    } catch(HomeFactoryException hfe) {
    hfe.printStackTrace();
    throw new DelegateException(hfe);
    } catch(RemoteException re) {
    re.printStackTrace();
    throw new DelegateException(re);
    } catch(CreateException ce) {
    ce.printStackTrace();
    throw new DelegateException(ce);
    } catch(FinderException fe) {
    fe.printStackTrace();
    throw new UserNotFoundException();
    public SimpleUser getID(String id)
    throws UserNotFoundException, DelegateException
    try
    UserCollectionHome userCollectionHome = (UserCollectionHome)
    EJBHomeFactory.getFactory().lookupHome("vista/UserCollection",
    UserCollectionHome.class);
    UserHome userHome = (UserHome)
    EJBHomeFactory.getFactory().lookupHome("vista/User",UserHome.class);
    UserCollection uc = userCollectionHome.create();
    SimpleUser su = uc.getID(id, userHome);
    return su;
    } catch(HomeFactoryException hfe) {
    throw new DelegateException(hfe);
    } catch(RemoteException re) {
    throw new DelegateException(re);
    } catch(CreateException ce) {
    throw new DelegateException(ce);
    } catch(FinderException fe) {
    throw new UserNotFoundException();
    public void setPassword(String lname,String pw)
    throws UserNotFoundException, DelegateException
    try
    UserCollectionHome userCollectionHome = (UserCollectionHome)
    EJBHomeFactory.getFactory().lookupHome("vista/UserCollection",
    UserCollectionHome.class);
    UserHome userHome = (UserHome)
    EJBHomeFactory.getFactory().lookupHome("vista/User",UserHome.class);
    UserCollection uc = userCollectionHome.create();
    uc.setPassword(lname,pw, userHome);//assume that all lname are differents.
    } catch(HomeFactoryException hfe) {
    hfe.printStackTrace();
    throw new DelegateException(hfe);
    } catch(RemoteException re) {
    re.printStackTrace();
    throw new DelegateException(re);
    } catch(CreateException ce) {
    ce.printStackTrace();
    throw new DelegateException(ce);
    } catch(FinderException fe) {
    fe.printStackTrace();
    throw new UserNotFoundException();
    }//Do I have my class as a Singleton correctly???
    2)//Here is my First Frame that will call a Singleton to gather user information
    public A(Frame owner)
    super(owner, "User Personal Information",true);
    initScreen();
    loadPersonalInfo();
    * This method instantiates all the GUI widgets and places them into panels and
    * onto the frame.
    private void initScreen()
    txtFname = new JTextField(20);
    txtLname=new JTextField(20);
    btnsave =new JButton("Save");
    btnChange= new JButton("Click here to change PW");//when you click this button there will be a frame pop up for you to enter informaton..this iwll call class B
    JPanel pnlMain=new JPanel();
    JPanel pnlFname= new JPanel();
    pnlFname.setLayout(new BoxLayout(pnlFname, BoxLayout.X_AXIS));
    pnlFname.setBorder(BorderFactory.createEmptyBorder(0,87,0,90));
    pnlFname.add(new JLabel("First Name:"));
    pnlFname.add(Box.createRigidArea(new Dimension(5,0)));
    pnlFname.add(txtFname);
    JPanel pnlLname= new JPanel();
    pnlLname.setLayout(new BoxLayout(pnlLname, BoxLayout.X_AXIS));
    pnlLname.setBorder(BorderFactory.createEmptyBorder(0,87,0,90));
    pnlLname.add(new JLabel("Last Name:"));
    pnlLname.add(Box.createRigidArea(new Dimension(5,0)));
    pnlLname.add(txtLname);
    pnlMain.add(pnlFname);
    pnlMain.add(pnlLname);
    pnlMain.add(btnsave);
    pnlMain.add(btnChange");
    btnSave = new JButton("Save");
    btnSave.setActionCommand("SAVE");
    btnSave.addActionListener(this);
    btnCancel = new JButton("Cancel");
    btnCancel.setActionCommand("CANCEL");
    btnCancel.addActionListener(this);
    JPanel pnlBottom = new JPanel();
    pnlBottom.setLayout(new BoxLayout(pnlBottom, BoxLayout.X_AXIS));
    pnlBottom.setBorder(BorderFactory.createEmptyBorder(25,55,0,0));
    pnlBottom.add(btnSave);
    pnlBottom.add(Box.createRigidArea(new Dimension(25,0)));
    pnlBottom.add(btnCancel);
    pnlMain.add(pnlBottom);
    this.setContentPane( pnlMain);
    setSize(500,500);
    GraphicUtilities.center(this);
    theABC=ABC.getABC();
    //Do I call my ABC singleton class correctly??
    private void loadPersonalInfo()
    String ID= System.getProperty("user.name");
    SimpleUser user = null;
    try {
    user = ABC.getID(ID);
    //I tried to use method in ABC singleton class. IS this correctly call?
    } catch(UserNotFoundException nfe)
    JOptionPane.showMessageDialog(new JDialog(),"You have not yet registered.",
    "User Not Found",JOptionPane.WARNING_MESSAGE);
    System.exit(0);
    } catch(DelegateException de) {
    JOptionPane.showMessageDialog(new JDialog(),"You have not yet registered",JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    currentUser = user;
    txtFname.setText(currentUser.getFirstName());
    txtLname.setText(currentUser.getLastName());
    //This information will be display in my textfields Fname and Lname
    //I can change my first and last name and hit button SAVE to save
    public void actionPerformed(ActionEvent e)
    if(e.getActionCommand().equals("SAVE")) submitChanges();
    if(e.getActionCommand().equals("CHANGE_PASSWORD")) {
    changepassword=new ChangePassword(new Frame(),name,badgeid);
    public void submitChanges(){
    String currentNTUsername = System.getProperty("user.name");
    SimpleUser user =null;
    try {
    user = theABC.getID(ID);
    user.setFirstName(txtFname.getText().trim());
    user.setLastName(txtLname.getText().trim());
    currentUser = user;
    theABC.updateUserInfo(currentUser);
    //IS this correctly if I want to use this method in singleton class ABC??
    } catch(UserNotFoundException nfe)
    JOptionPane.showMessageDialog(new JDialog(),"You have not yet registered",
    "User Not Found",JOptionPane.WARNING_MESSAGE);
    } catch(DelegateException de) {
    JOptionPane.showMessageDialog(new JDialog(),"You have not yet registered",JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    this.setVisible(false);
    3) click on ChangePassword in my above GUI class A..will call this class B..and in this class B
    I need to access method in a Singleton class- ABC class,,DO i need to inititates it agian, if not what should I do? thanks
    package com.lockheed.vista.userinfo;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import javax.swing.tree.*;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import java.io.*;
    import javax.swing.text.*;
    import javax.swing.text.html.*;
    import javax.swing.colorchooser.*;
    import javax.swing.filechooser.*;
    import javax.accessibility.*;
    import java.beans.*;
    import java.applet.*;
    import java.net.*;
    import org.apache.log4j.*;
    import com.lockheed.common.gui.GraphicUtilities;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import vista.user.UserServicesDelegate;
    import vista.user.SimpleUser;
    import vista.user.UserNotFoundException;
    import vista.user.*;
    import com.lockheed.common.ejb.*;
    import com.lockheed.common.gui.*;
    import com.lockheed.vista.publish.*;
    * This program allow users to change their Vista Web Center's password
    public class ChangePassword extends JDialog
    implements ActionListener{
    protected final Logger log = Logger.getLogger(getClass().getName());
    private UserServicesDelegate userServicesDelegate;
    private User currentUser = null;
    private JPasswordField txtPasswd, txtVerifyPW;
    private JButton btnSubmit,btnCancel;
    private JLabel lblName,lblBadgeID;
    private String strBadgeID="";
    * This is the constructor. It creates an instance of the ChangePassword
    * and calls the method to create and build the GUI.
    public ChangePassword(Frame owner,String name,String badgeid)
    super(owner, "Change Password",true);
    initScreen(name,badgeid);//build the GUI
    * This method instantiates all the GUI widgets and places them into panels and
    * onto the frame.
    private void initScreen(String strname,String strBadgeid)
    txtPasswd = new JPasswordField(20);
    txtVerifyPW=new JPasswordField(20);
    txtPasswd.setEchoChar('*');
    txtVerifyPW.setEchoChar('*');
    JPanel pnlMain=new JPanel();
    pnlMain.setLayout(new BoxLayout(pnlMain, BoxLayout.Y_AXIS));
    pnlMain.setBorder(BorderFactory.createEmptyBorder(20,0,20,0));
    JPanel pnlPW=new JPanel();
    pnlPW.setLayout(new BoxLayout(pnlPW, BoxLayout.X_AXIS));
    pnlPW.setBorder(BorderFactory.createEmptyBorder(0,96,0,30));
    pnlPW.add(new JLabel("Password:"));
    pnlPW.add(Box.createRigidArea(new Dimension(5,0)));
    pnlPW.add(txtPasswd);
    JPanel pnlVerifyPW=new JPanel();
    pnlVerifyPW.setLayout(new BoxLayout(pnlVerifyPW, BoxLayout.X_AXIS));
    pnlVerifyPW.setBorder(BorderFactory.createEmptyBorder(0,63,0,30));
    pnlVerifyPW.add(new JLabel("Verify Password:"));
    pnlVerifyPW.add(Box.createRigidArea(new Dimension(5,0)));
    pnlVerifyPW.add(txtVerifyPW);
    JPanel pnlTop= new JPanel();
    pnlTop.add(pnlPW);
    pnlTop.add(Box.createRigidArea(new Dimension(0,10)));
    pnlTop.add(pnlVerifyPW);
    pnlMain.add(pnlTop);
    btnSubmit = new JButton("Submit");
    btnSubmit.setActionCommand("SUBMIT");
    btnSubmit.addActionListener(this);
    btnCancel = new JButton("Cancel");
    btnCancel.setActionCommand("CANCEL");
    btnCancel.addActionListener(this);
    JPanel pnlBottom = new JPanel();
    pnlBottom.setLayout(new BoxLayout(pnlBottom, BoxLayout.X_AXIS));
    pnlBottom.setBorder(BorderFactory.createEmptyBorder(25,55,20,30));
    pnlBottom.add(btnSubmit);
    pnlBottom.add(Box.createRigidArea(new Dimension(25,0)));
    pnlBottom.add(btnCancel);
    pnlMain.add(pnlBottom);
    this.setContentPane( pnlMain);
    setSize(350,230);
    setVisible(true);
    public void actionPerformed(ActionEvent e)
    if(e.getActionCommand().equals("CANCEL")) this.setVisible(false);
    if(e.getActionCommand().equals("SUBMIT")) submitPW();
    * This method is called when the submit button is clicked. It allows user to change
    * their password.
    public void submitPW(){
    myABC= ABC.getABC();//Is this correct?
    char[] pw =txtPasswd.getPassword();
    String strPasswd="";
    for(int i=0;i<pw.length;i++){
    strPasswd=strPasswd+pw;
    char[] vpw =txtVerifyPW.getPassword();
    String strVerifyPW="";
    for(int i=0;i<vpw.length;i++){
    strVerifyPW=strVerifyPW+pw;
    if((strPasswd==null)||(strPasswd.length()==0)) {
    JOptionPane.showMessageDialog(new JDialog(),"You have not enter a password. Please try again.",
    "Invalid Password",JOptionPane.ERROR_MESSAGE);
    if((!strPasswd.equals(strVerifyPW)))
    //password and verify password do not match.
    JOptionPane.showMessageDialog(new JDialog(),"Your passwords do not match. Reenter and try again.",
    "Invalid Password",JOptionPane.ERROR_MESSAGE);
    try
    myABC.setUserPassword(strPasswd);//try to use a method in Singleton class
    txtPasswd.setText("");
    txtVerifyPW.setText("");
    this.setVisible(false);
    } catch(DelegateException e) {
    JOptionPane.showMessageDialog(new Frame(),
    "Error.",
    "Unable to change password information.",JOptionPane.WARNING_MESSAGE);
    } catch(UserNotFoundException e) {
    JOptionPane.showMessageDialog(new Frame(),
    "Error.",
    "Unable to change password information.",JOptionPane.WARNING_MESSAGE);
    And ofcourse I have other EJB classes to work with these classes.
    ***It compiles okey but when I ran, it say "NullPointerException"
    I think I call my Singleton wrong.
    Please help me.thanks

    1. When replying, use <reply>, don't post a new topic.
    2. Implementing a singleton is a frequently asked question. Search before you post.
    3. This is not a question about Swing. A more appropriate forum would be "New To Java Technology" or perhaps "Java Programming", but see point 1.
    4. When posting code, keep it short. It increases the chance of readers looking at it. And in composing your shorter version for the forum, you just may solve your problem.

  • Import Flare Libraries

    Flare is an awesome data vizualization toolkit. Flare is a
    collection of ActionScript 3 classes for building a wide variety of
    interactive visualizations. For example, flare can be used to build
    basic charts, complex animations, network diagrams, treemaps, and
    more. Flare is written in the ActionScript 3 programming language
    and can be used to build visualizations that run on the web in the
    Adobe Flash Player. Flare applications can be built using the free
    Adobe Flex SDK or Adobe's Flex Builder IDE. Flare is based on
    prefuse, a full-featured visualization toolkit written in Java.
    Flare is open source software licensed under the terms of the BSD
    license, and can be freely used for both commercial and
    non-commercial purposes.
    Now, I downloaded the
    flare-prefuse
    visualization toolkit, from the
    flare-prefuse.org site.
    Following the steps in the
    Flare Tutorial,
    for the life of me I can't seem to import the flare libraries into
    the Tuturial project within Flex Builder.
    How do you import projects into another project? I'm able to
    import the libraries so that they appear in the Flex Builder's
    Navigation pane. I go through the "
    Importing a libarary with another project" steps mentioned
    below. When I click "OK" to add a project, the project name (eg.
    flare.util) does not appear in the Library Path window. Further,
    when I use a statement to reference the library, such as import
    flare.animate.Tween, the FB2 compiler returns an error, "Definition
    flare.animate:Tween could not be found".
    Specifically, the flare tutorial states:
    Importing Libraries
    Before proceeding, make sure you have the flare libraries
    loaded as projects within Flex Builder. You should have already
    unzipped the flare files into your main Flex Builder workspace
    directory. The next step is to import them into the Flex Builder
    environment:
    - Make sure you are in the "Flex Development" perspective.
    - Right click the navigator pane on the left.
    - Select "Import..." in the popup menu.
    - In the dialog, select "General > Existing Projects into
    Workspace" and click the "Next" button.
    - Use the "Select root directory" widgets to navigate to your
    Flex Builder workspace directory
    - You should now seen the flare projects listed in the
    "Projects:" panel
    - Make sure all flare.* projects are selected and then click
    the "Finish" button.
    You should now see all the flare projects in the Navigator
    pane. You can now browse the source code for each of the
    sub-libraries.
    Overview of the flare libraries
    Here is a quick overview of the various flare projects:
    flare.animate: animation library (depends on flare.util)
    flare.data: library for loading data sets, useful, but still
    under development (depends on flare.util)
    flare.demos: an application project showcasing a number of
    visualization demos
    flare.physics: a physics engine, useful for physical effects
    or force-directed layout (no dependencies)
    flare.query: a query processor for ActionScript objects
    (depends on flare.util)
    flare.util: a set of utility classes shared by all projects
    (no dependencies)
    flare.vis: the flare visualization components and operators
    (depends on flare.util, flare.animate, and flare.physics)
    If a project has a dependency, you will need to import all
    dependent projects into your application. We now describe how to do
    that.
    Importing a library within another project
    Now we need to adjust our project settings so that we can
    make use of the flare libraries. Just follow these steps:
    1. In the Navigator pane, right click the top folder of the
    "Tutorial" project
    2. Click "Properties" in the context menu
    3. In the resulting dialog, click "ActionScript Build Path"
    in the left panel (it should be the 3rd item from the top)
    4. Click the "Library path" tab in the right panel
    5. Click the "Add Project" button
    6. You should now see a list of projects, including all the
    flare libraries.
    7. Select "flare.util" and then click "OK"
    You've now added the flare.util libraries to your project,
    and can use any of the classes it provides. Repeat steps 5-7 above
    for the "flare.animate", "flare.physics", and "flare.vis" projects.
    (We will be using the flare.animate classes in this part of the
    tutorial, and then adding in the flare.vis classes in the next
    part, so we might as well import them all now). "
    My directory structure for the Tutorial project is:
    C:\Documents and Settings\Ron Barrett\My Documents\Flex
    Builder 2\Tutorial
    Can you help to explain to me how to import the flare
    libraries so that they are available to the Tutorial project?
    Man, if you can help me out with this I'd be REALLY
    grateful!!
    All the best,
    Ron

    Hi Magicrebirth:
    Jeff Heer, of UC Berkeley, responded to my question, which
    was also posted on the SourceForge Flare forum. The following is
    his reply, which solved my problem. The easy answer is simply to
    download and install FlexBuilder beta version 3.
    Sorry for your troubles! The tutorial was written and tested
    with Adobe
    Flex Builder 3 Beta, so one solution would be to use FB3
    instead.
    Another approach may instead be to do a clean import of the
    projects.
    To do this, first delete the following files in each flare
    project:
    .actionScriptProperties
    .flexLibProject
    .project
    Next, you can manually set up each project. In Flex
    Development mode,
    right click in the Flex Navigator and select &quot;New
    &gt; Flex Library
    Project&quot;. Now create a new project. Flex Builder
    acts strangely when
    project names have a &quot;.&quot; in them, so leave
    the &quot;.&quot; out of the name. For
    example, type &quot;flareutil&quot; instead of
    &quot;flare.util&quot;. After typing the
    name, click OK. There should now be a project named
    &quot;flareutil&quot; in the
    navigator pane.
    Now rename the project: right-click the project and select
    &quot;Rename...&quot;.
    Now add the &quot;.&quot; back into name (for example
    &quot;flareutil&quot; should become
    &quot;flare.util&quot;). In a warning message pops
    up, just dismiss it. The
    project should now have the correct name and include the
    files in the
    flare.util folder.
    Now we just need to setup the project settings. Right click
    the project
    and select &quot;Properties&quot;. A dialog window
    should appear. In the list on
    the left, select &quot;Flex Library Build Path&quot;.
    Under the tab &quot;Classes&quot;,
    make sure the box next to the &quot;flare&quot;
    package is checked (all sub
    checkboxes should be checked as a result) -- this makes sure
    all the
    files are included with the project.
    Finally, you need to set up any project dependencies. These
    are
    described in the Tutorial. For example, flare.animate has a
    dependency
    on flare.util. To specify this, click the &quot;Library
    path&quot; tab in the
    Properties dialog. Now click &quot;Add Project&quot;
    and select the project to
    add. After you've done that, the project should appear in the
    &quot;Build
    path libraries:&quot; list. Click the &quot;Link
    Type&quot; setting under the newly
    added project reference, click the &quot;Edit&quot;
    button on the right, and
    adjust the link type to &quot;External&quot;. Now
    repeat this for any other
    project dependencies.
    Repeat the above process for each of the included flare
    projects. The
    only difference is for flare.demos. For that project, create
    a new
    &quot;ActionScript Project&quot;, NOT a
    &quot;Flex Library Project&quot;.
    As you can see, this involves a bit of busy work, so
    switching to Flex
    Builder 3 may be simpler.
    hope that helps,
    -jeff

  • Importing classes... HELP!!!

    I'm using JBuilder Enterprise Edition...
    I open a .java file to edit and recompile to test my edit...
    However I keep getting errors that classes imported in the ,java file do not exist...
    I know they do, because I copied them locally to the folder where all the filess I need are located...
    The .java files that compile into .class files are read-only (there are over 100 of them)
    I've pulled them from a server to my local machine...
    Even if I check them out in Visual Source Safe, I still get errors that the imported classes in the source code do not exist...
    how do I fix this issue?

    Looks like I had a copy of JBuilder installed after all. So I selected Project-> Project Properties select the Paths tab then the Required Libraries tab (lower tab), hit the add button, then hit the new button. Fill in the library name and select project to hold the library. Then search your disk for the jar or the directory that contains your classes. Then hit OK a few times.

  • Error when I import classes using directive JSP page

    Hi all!
    I have installed JDeveloper 11g (11.1.1.3.0)
    My applications are located in the C:\dir (JDEV_USER_DIR = C:\dir)
    I Created application "Appliation1". In it i created 2 projects (Project1, in it beans session entity and other java classes; Project2, in it JSP).
    I want import classes from Project1 to Project2 using next directive:
    <%@ page contentType="text/html;charset=windows-1252"
    import="project1.*"%>
    so in Project properties of Project2 set the way to classes in Project1.
    When i run JSP an error occurred:
    Error(4,9): The import project1 cannot be resolved
    Maybe i'm not set correctly the way to the classes
    Thanks in advance.

    angelr, thanks, it helped me)
    In jdeveloper 10g i set address in Project Properties->Libraries and Classpath->Add JAR/Directory;
    and set the way to my classes;
    and it worked.
    in the 11 version seems different

  • Doesn't find import classes...

     

    Hi Wei,
              I removed everything that was related to JVIEW in the script and it's the
              same thing :(... can you explaine one thing to me?
              My GenerateHTML bean is compiled and if I don't import anything in it, it
              works fine and I can call methods of it... no problem. But when I import
              some libraries (jar files) in my, it compiles fine but when I want to use it
              in my jsp page it can't find the import packages... why? It's already
              compiled and those packages are in my system classpath... it even works if I
              open a prompt and do it at the commandline!
              Is there a rule to follow when using a bean in jsp that applies to importing
              packages in that bean?
              Thanks !
              Regards,
              David Pare
              "Wei Guan" <[email protected]> wrote in message
              news:[email protected]...
              > You have JDK and JVIEW in your startup script, and it is hard for me to
              > figure which one you are using. Without accessing your machine, it will be
              > hard for me to figure out what's wrong. If you are using jview, there is
              no
              > /cp to specify classpath in your script.
              >
              > I suggest you make your startup script simple, and check your GenerateHTML
              > is in CLASSPATH (jview) or in WEBLOGIC_CLASSPATH (JDK). If it is still not
              > working, try to use javap to figure whehter your class is in CLASSPATH
              > (jview) or in WEBLOGIC_CLASSPATH (JDK).
              >
              > My 2 cents
              >
              > --
              > Cheers - Wei
              > David Pare <[email protected]> wrote in message
              > news:[email protected]...
              > > Hi Wei,
              > >
              > > I tried that already but it doesn't work...
              > >
              > > I have attached 3 files to this mail:
              > >
              > > - Merchant.jsp
              > > - GenerateHTML.java
              > > - wls.cmd
              > >
              > > if you could take a look I would appreciate it :)
              > >
              > > Thanks in advance!
              > >
              > > Regards,
              > >
              > > David Pare
              > > Accor Corporate Services
              > >
              > > Wei Guan <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Just put these classes in WEBLOGIC_CLASSPATH, do not put them in
              > > > JAVA_CLASSPATH.
              > > >
              > > > My 2 cents.
              > > >
              > > > --
              > > > Cheers - Wei
              > > > David Pare <[email protected]> wrote in message
              > > > news:[email protected]...
              > > > > Hi,
              > > > >
              > > > > I have a simple .jsp file that uses a bean and in that bean
              import
              > > some
              > > > > classes... it compiles perfectly but then when I run my .jsp file,
              WLS
              > > > tells
              > > > > me that it cannot find the classes I'm importing in my bean? I don't
              > get
              > > > it!
              > > > >
              > > > > I've put those import packages in the CLASSPATH and
              > > WEBLOGIC_CLASSPATH...
              > > > > but it doesn't work!
              > > > >
              > > > > Any help would be appreciated :)
              > > > >
              > > > > FYI: I'm using WLS 5.1 SP 3 on NT 4 SP5
              > > > >
              > > > > Thanks!
              > > > >
              > > > > David Pare
              > > > > ACS
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > >
              > > >
              > >
              > >
              > >
              >
              >
              

  • Import classes or packages

    import java.util.*;
    import java.util.ArrayList,java.uitl.HashMap;
    What difference it makes to the performance of a class
    file when we import a specific class or an entire package

    For a great Q & A on this very question:
    http://www.javaworld.com/javaworld/javaqa/2001-04/01-qa-0406-import.html?
    Here is the quoted information:
    "Q. Does importing an entire package cause any runtime or compile time overhead? For example, does:
    import java.util.*
    compared with:
    import java.util.Vector
    cause any added overhead?
    A. In answering your questions a few definitions are helpful:
    Imports of the type java.util.Vector; are referred to as single type import
    Imports of the form java.util.*; are referred to as import on demand
    Both import on demand and single type import are passive mechanisms. As passive mechanisms, import loads information about the package and types only when it is needed. Indeed, the compiler will load this information only when a type is actually used, not when it is simply imported. The import simply tells the compiler where to look when it actually needs a type.
    So no, importing an entire package produces no more overhead than importing a specific type.
    That being said, it is generally regarded as bad practice to import an entire package using import on demand. Sometimes the number of imports may be large. However, you can quickly look at the list and know what classes the importing class uses. Such a list of imports can provide important documentation to someone unfamiliar with the code. "

  • Class Libraries and Code used to Access Google Distance Matrix API

    Hey Everyone....! I want to use Google Distance Matrix API with my C# application, which gets two co-ordinates(Latitude/Longitude) and pass them to API. Also to receive the results from API and construct and output class to interpret JSON objects.
    Can anyone please tell me about class libraries and code used for above purpose.
    Longbow

    Hello,
    If you want to use the Google Distance Matrix API, i suggest that you could post code sample demo to this api forum:
    https://developers.google.com/maps/support/
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Not allowed to import classes without package names?

    Hi,
    I have a few questions on Packages and importing?
    1. Is the following true that it is illegal to import classes in the same package as the current class, will this cause a comilation error? If this is the case where in the Java Language specification is this actually written as I could not find it?
    2. This has probably been answered by question 1 but if I have 2 classes in the same package and if I import 1 of the classes into the other class, is it illegal to import it by just using the class name and not the package name as well, ie
    if the package name is ie.tcd
    and the 2 class names are exp1.class and exp2.class, can I do this in class 2
    package ie.tcd;
    import exp1;
    public class exp2 {
    3. Is it illegal to import classes that are not explicitly part of any package or must a class be part of a package to be imported. I read somewhere that while this was always illegal it is only after jdk 1.4.2 that this is being enforced? If this is the case where in the Java Language specification is this actually written as I could not find it either?
    Thanks very much for any help,
    John

    Was just also wondering, 1 other thing, I am looking
    at someone elses code they have 2 classes (Class A
    and Class B) in the same package (pkg). The person
    imports class A into B:
    package pkg;
    import A;
    public class B {
    Is this legal code (or was it ever)?Not if A is really in pkg.A. If there is an A in the unnamed package it was legal, or at least it was understood by the compiler, and now it isn't (to both).
    Can you import or is there a point in importing a class in the same
    package?Only by naming the package in the import statement. If the current and the import statement are in the same package the import is redundant.
    If there is a point would you import just be
    using the class name (this would be illegal after jdk
    1.4) or should you use the whole package name even
    though it is in the package anyways?As I understand it you must always use the whole package name in imports.

  • Compilation Error for import classes not found in generated Proxy Class

    Hi,
    We are generating java classes for the COM dll using JCOM com2java compiler.
    We are getting a compilation error for import class not found when compiling the
    generated Proxy java source code. It can't find the com.bea.jcom.Dispatch class that
    the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
    or com.bea.jcom.Param. These are interfaces or data types or classes used by COM
    library.
    I added weblogic.jar to my class path and the only Dispatch class i found inside
    the weblogic.jar is com.linar.jintegra.Dispatch;
    We have com objects for which we want to develop an EJB client to interface with
    the COM object using JCOM with Native Mode disabled.
    Any help on the compilation error..I tried changing the extends for Dispatch to com.linar.jintegra.Dispatch
    but the other errors are still there.
    To begin with, I think the generated code should not refer to any of the COM data
    types.
    Any help please.
    Thank you in advance,
    Regards,
    Rahul Srivastava
    [email protected]

    Hi,
    I resolved the other errors by changing all references from com.bea.jcom.Variant
    etc to com.linar.jintegra.class name..all were present under the com.linar.jintegra
    package.
    Thank you all anyways,
    Regards,
    rahul
    "Rahul Srivastava" <[email protected]> wrote:
    >
    Hi,
    We are generating java classes for the COM dll using JCOM com2java compiler.
    We are getting a compilation error for import class not found when compiling
    the
    generated Proxy java source code. It can't find the com.bea.jcom.Dispatch
    class that
    the generated Proxy java source code extends. It also can't find com.bea.jcom.Variant
    or com.bea.jcom.Param. These are interfaces or data types or classes used
    by COM
    library.
    I added weblogic.jar to my class path and the only Dispatch class i found
    inside
    the weblogic.jar is com.linar.jintegra.Dispatch;
    We have com objects for which we want to develop an EJB client to interface
    with
    the COM object using JCOM with Native Mode disabled.
    Any help on the compilation error..I tried changing the extends for Dispatch
    to com.linar.jintegra.Dispatch
    but the other errors are still there.
    To begin with, I think the generated code should not refer to any of the
    COM data
    types.
    Any help please.
    Thank you in advance,
    Regards,
    Rahul Srivastava
    [email protected]

  • Inner class vs. imported class

    Hi everyone,
    I have entitiy beans created for a client's web app I'd like to use in the
    web service using WebLogic Workshop 7.0. Say the classes are imported like
    this in the services:
    import com.hoike.clientname.ap.bean.Invoice
    import com.hoike.clientname.ap.bean.Vendor
    Instances of these classes are used in callback methods and some of the
    service methods.
    When I generate the CTRL file, it actually adds those imported classes as
    inner class of the service defined.
    The problem is that when I try to used these services from another service,
    I cannot use the imported classes (as Invoice or Vendor), but instead I have
    to use the inner class (InvoiceService.Invoice or VendorService.Vendor)
    Does WebLogic Workshop 7.0 only allow you to use inner classes? Is there a
    way to use custom classes as method parameters?
    Thanks in advance!
    Makoto

    how do you declare your inner class?
    Is it (public)
    public static class MyInnerClassor (private)
    private static class MyInnerClassor (package)
    static class MyInnerClassor (protected)
    protected static class MyInnerClassTry to change the way you declare the inner class. Use protected or package or public instead.

Maybe you are looking for

  • List of business objects

    Hi all, Is it possible in the DI API to get a list of business objects (for example business partners) from the Company object or do I have to use a recordset with an SQL statement? If so, how. And if not, where do I find a translation of tablenames

  • RERAPP and reference field

    Hi, does anyone know how SAP determines the Reference field (XBLNR) when generating vendor open items via Periodic posting run RERAPP? Is there any possibility to define a certain reference by the user? Thanks, Sonja

  • Cannot Open Large PDF file 100 mb

    Cannot open a 118 Mb pdf file. Adobe Reader 11 opens, no error messages, does not show the file. I downloaded the file from three different sources. Is there a utility that I can use to check the validity of the pdf file? tony-only

  • Which Camera Calibration Profile for Leica M8 with LR3?

    I see there are 4 camera profiles for the Leica M8 that all produce significantly different results - ACR3.6 and 4.4 and Adobe Standard and Camera Standard. Any advice on which to use and when? Thanks in advance.

  • PE9 Organizer - sequencing pictures by filename in slideshow

    I've read many discussions about "sorting by filename" but not sure I've actually seen the answer.  When I bring pictures into organizer in PE9, I cannot seem to find a way to organize the pictures in the slideshow by filename.  Am I missing somethin