Things Visible in Two Classes

I'm developing a program using two classes: "Analysis.class" and "AnalysisCalc.class", each in separate files. I don't desire to import either class via package design. I'm trying to call a method from "AnalysisCalc.class" using variables visible to both classes. The intent of the program is to decrement a variable using a while loop. The intent of using "AnalysisCalc.class" is to manage my code better rather than consolidate all the code in "Analysis.class". How do I modify the following source code for these classes?
(NOTE: Don't worry about other aspects of program such as I/O since I know how to handle that )
// Analysis Program: Analysis.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Analysis extends JApplet implements ActionListener {
     double variableX;
     boolean variableA, variableB;
     public void init()
          variableX = 0;          
          variableA = true;
          variableB = true;
     } // end method init     
     public void strt()
          while(variableB){                    
               rundata();
               if( variableX < 10 )
                    variableB = false;
     }  // end method strt
     strt();
} //end class Analysis
// AnalysisCalc.java
public class AnalysisCalc {  
     // AnalysisCalc constructor
     public AnalysisCalc()
          rundata( );
     public void rundata( )
          if( variableA == true)
               variableX = 100;
               variableA = false;
          variableX--;
} // end class AnalysisCalc

OK, forget the code I posted previously.
The following code in files Trajectory.java and Calculate.java have a similar problem. I'm trying to get my method set up simple with a decrement logic because later the logic for the method will become more complex. I want to keep all this complex code out of the Trajectory.java file and manage it from the Calculate.java file. I would set up package and import design, but my ISP will not accept package design in building website since fully qualified names must be used to avoid naming conflicts.
key code segments in file trajectory.java, being analogous to Analysis.java, include--->
Calculate Z = new Calculate();
while(sentinel){
Z.rundata();
if( altitude < 10 )
sentinel = false;
The file analogous to AnalysisCalc.java is Calculate.java
// Trajectory Analysis Program: Trajectory.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Trajectory extends JApplet implements ActionListener {
     final double MAX = 90.0;
     final double MIN = -90.0;
     final double MAX_ALTITUDE = 2000000.0;
     final double MIN_ALTITUDE = 0.0;
     private JTextArea introductionArea, resultsArea;
     private JLabel spanLabel, chordLabel,
          thicknessLabel, massLabel, altitudeLabel, velocityLabel,
          trajectory_angleLabel, time_incrementLabel, rotation_factorLabel,
          calculationLabel, resultsLabel;
     private JTextField spanField, chordField, thicknessField,
          massField, altitudeField, velocityField, trajectory_angleField,
          time_incrementField, rotation_factorField;
     private JButton startButton, resetButton, contButton, abortButton;
     String introduction_string, span_string, chord_string, thickness_string, mass_string,
          altitude_string, velocity_string, trajectory_angle_string,
          time_increment_string, rotation_factor_string, results_string;
     public double span, chord, thickness, mass, altitude, velocity, trajectory_angle, time_increment,
          rotation_factor, distance, velocity_fps, elapsed_time;
     boolean value, sentinel;
     // create objects
     public void init()
          Calculate Z = new Calculate();
          span = 0;
          chord = 0;
          thickness = 0;
          mass = 0;
          altitude = 0;
          velocity = 0;
          trajectory_angle = 0;
          time_increment = 0;
          rotation_factor = 0;
          distance = 0;
          velocity_fps = 0;
          elapsed_time = 0;
          velocity_fps = 0;
          elapsed_time = 0;
          value = true;
          sentinel = true;
          introduction_string =
               "DEBRIS TRAJECTORY PROGRAM\n" 
               + "designed by Weldon K. Chafin, Jr.\n\n"
               + "Inspired by the brave heroes of the Columbia Accident "
               + "of February 1, 2003.\n\n"
               + "This program determines trajectory for an object modeled "
               + "as a rectangular prism having given mass falling through "
               + "the atmosphere. The object is assumed to oscillate with same "
               + "frequency about all six possible permutations for axis "
               + "angular velocity vectors as the means to simulate "
               + "equally likely random events.\n\n"
               + "NOTE: This program is still under construction. "
               + "I predict this program will be fully functional by October 4, 2003. "
               + "Then it should have calculation capability comparable to the C++ program version I created "
               + "for the Columbia Accident Investigation Board (CAIB) to predict locations of Columbia debris. "
               + "In fact, the CAIB forwarded my program as an analytical tool to NASA "
               + "JSE Early Sightings Assessment Team tasked with finding high interest "
               + "Columbia debris items via radar imaging.";
          span_string = "";
          chord_string = "";
          thickness_string = "";
          mass_string = "";
          altitude_string = "";
          velocity_string = "";
          trajectory_angle_string = "";           
          time_increment_string = "";
          rotation_factor_string = "";
          results_string = "";
          // create container & panel
          Container container = getContentPane();     
          Panel panel = new Panel( new FlowLayout( FlowLayout.LEFT));
          container.add( panel );
          // set up vertical boxlayout
          Box box = Box.createVerticalBox();
          Box inputbox1 = Box.createHorizontalBox();
          Box inputbox2 = Box.createHorizontalBox();
          Box inputbox2a = Box.createHorizontalBox();
          Box inputbox2b = Box.createHorizontalBox();
          Box inputbox2c = Box.createHorizontalBox();
          Box inputbox2d = Box.createHorizontalBox();
          Box inputbox3 = Box.createHorizontalBox();
          Box buttonbox = Box.createHorizontalBox();
          // set up introduction
          introductionArea = new JTextArea( introduction_string, 10, 50 );
          introductionArea.setEditable( false );
          box.add( new JScrollPane( introductionArea ) );
          box.add( Box.createVerticalStrut (10) );
          box.add( inputbox1);
          box.add(inputbox2a);
          Dimension minSize = new Dimension(5, 15);
          Dimension prefSize = new Dimension(5, 15);
          Dimension maxSize = new Dimension(Short.MAX_VALUE, 15);
          inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));
          // set up span
          spanLabel = new JLabel( "span (feet)" );
          spanField = new JTextField(5 );
          inputbox2a.add( spanLabel );
          inputbox2a.add( spanField );
          inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));          
          // set up chord
          chordLabel = new JLabel( "chord (feet)" );
          chordField = new JTextField(5 );
          inputbox2a.add( chordLabel );
          inputbox2a.add( chordField );
          inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));     
          // set up thickness
          thicknessLabel = new JLabel( "thickness (feet)" );
          thicknessField = new JTextField(5 );
          inputbox2a.add( thicknessLabel );
          inputbox2a.add( thicknessField );
          inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));
          box.add( Box.createVerticalStrut (10) );
          box.add(inputbox2b);
          inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
          // set up mass
          massLabel = new JLabel( "mass (slugs)" );
          massField = new JTextField(5);
          inputbox2b.add( massLabel );
          inputbox2b.add( massField );
          inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));     
          // set up altitude
          altitudeLabel = new JLabel( "altitude (feet)");
          altitudeField = new JTextField(5 );
          inputbox2b.add( altitudeLabel );
          inputbox2b.add( altitudeField );
          inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
          // set up velocity
          velocityLabel = new JLabel( "velocity (Mach Number)");
          velocityField = new JTextField(5);
          inputbox2b.add( velocityLabel );
          inputbox2b.add( velocityField );
          inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
          box.add( Box.createVerticalStrut (10) );
          Dimension minSize2c = new Dimension(160, 15);
          Dimension prefSize2c = new Dimension(160, 15);
          Dimension maxSize2c = new Dimension(Short.MAX_VALUE, 15);
          box.add(inputbox2c);
          inputbox2c.add(new Box.Filler(minSize2c, prefSize2c, maxSize2c));
          // set up trajectory_angle
          trajectory_angleLabel = new JLabel( "trajectory angle (degrees)");
          trajectory_angleField = new JTextField(5);
          inputbox2c.add( trajectory_angleLabel );
          inputbox2c.add( trajectory_angleField );
          inputbox2c.add(new Box.Filler(minSize2c, prefSize2c, maxSize2c));
          box.add( Box.createVerticalStrut (10) );
          Dimension minSize2d = new Dimension(50, 15);
          Dimension prefSize2d = new Dimension(50, 15);
          Dimension maxSize2d = new Dimension(Short.MAX_VALUE, 15);
          box.add(inputbox2d);
          inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
          // set up time_increment
          time_incrementLabel = new JLabel( "time increment (seconds)" );
          time_incrementField = new JTextField(5);
          inputbox2d.add( time_incrementLabel );
          inputbox2d.add( time_incrementField );
          inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
          // set up rotation_factor
          rotation_factorLabel = new JLabel( "rotation factor (number)" );
          rotation_factorField = new JTextField(5);
          inputbox2d.add( rotation_factorLabel );
          inputbox2d.add( rotation_factorField );
          inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
          box.add( Box.createVerticalStrut (10) );
          box.add( buttonbox);
          Dimension minSizeB = new Dimension(10, 30);
          Dimension prefSizeB = new Dimension(10, 30);
          Dimension maxSizeB = new Dimension(Short.MAX_VALUE, 30);
          buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
          // set up start
          startButton = new JButton( "START" );
          buttonbox.add( startButton );
          buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
          // set up reset
          resetButton = new JButton( "RESET" );
          buttonbox.add( resetButton );
          buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
          // set up cont
          contButton = new JButton( "CONTINUE" );
          buttonbox.add( contButton );
          buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
          // set up abort
          abortButton = new JButton( "ABORT" );
          buttonbox.add( abortButton );
          buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
          box.add( Box.createVerticalStrut (10) );          
          // set up results
          resultsArea = new JTextArea( results_string, 6, 50 );
          resultsArea.setEditable( false );
          box.add( new JScrollPane( resultsArea ) );
          // add box to panel
          panel.add( box );
          // register event handlers
          spanField.addActionListener( this );
          chordField.addActionListener( this );          
          thicknessField.addActionListener( this );
          massField.addActionListener( this );
          altitudeField.addActionListener( this );
          velocityField.addActionListener( this );          
          trajectory_angleField.addActionListener( this );
          time_incrementField.addActionListener( this );
          rotation_factorField.addActionListener( this );
          startButton.addActionListener( this );
          resetButton.addActionListener( this );
          contButton.addActionListener( this );
          abortButton.addActionListener( this );
          reset();
     } // end method init     
     public void t_r_a_test (double trajectory_angle) throws Tare {   
          if (trajectory_angle > MAX || trajectory_angle < MIN)
                      throw new Tare("\ntrajectory_angle "
               + trajectory_angle + " is outside of allowable range\n\n" 
               + "Try another value for the trajectory angle\n"
               + "( " + MIN + " <= trajectory angle <= " + MAX + " )" );
     }  // end method t_r_a_test
     public void a_r_e_test (double altitude) throws Are {   
          if ( altitude > MAX_ALTITUDE )
                      throw new Are("\naltitude "
               + altitude + " is outside of allowable range\n\n" 
               + "Try value for altitude\n"
               + "( " + MIN_ALTITUDE + " <= altitude <= "
               + MAX_ALTITUDE + " )" );
     }  // end method a_r_e_test
     public void n_v_test (boolean value) throws Nve {   
          if ( value == false ){
               if( span < 0 ){
                     span = 0;
                           throw new Nve("\nValue for "
                    + " span must not be negative\n\n" 
                    + "Try another value ");
               if( chord < 0 ){
                     chord = 0;
                           throw new Nve("\nValue for "
                    + " chord must not be negative\n\n" 
                    + "Try another value ");
               if( thickness < 0 ){
                     thickness = 0;
                           throw new Nve("\nValue for "
                    + " thickness must not be negative\n\n" 
                    + "Try another value ");
               if( mass < 0 ){
                     mass = 0;
                           throw new Nve("\nValue for "
                    + " mass must not be negative\n\n" 
                    + "Try another value ");
               if( altitude < 0 ){
                    altitude = 0;
                           throw new Nve("\nValue for "
                    + " altitude must not be negative\n\n" 
                    + "Try another value ");
               if( velocity < 0 ){
                    velocity = 0;
                           throw new Nve("\nValue for "
                    + " velocity must not be negative\n\n" 
                    + "Try another value ");
               if( time_increment < 0 ){
                    time_increment = 0;
                           throw new Nve("\nValue for "
                    + " time increment must not be negative\n\n" 
                    + "Try another value ");
               if( rotation_factor < 0 ){
                    rotation_factor = 0;
                           throw new Nve("\nValue for "
                    + " rotation factor must not be negative\n\n" 
                    + "Try another value ");
          } //end if( value == false )
     }  // end method n_v_test
     // process events
     public void actionPerformed( ActionEvent event )
          // process spanField
          if( event.getSource() == spanField ) {
               span_string = spanField.getText();
               span = Double.parseDouble( span_string);
          // process chordField
          if( event.getSource() == chordField ) {
               chord_string = chordField.getText();
               chord = Double.parseDouble( chord_string);
          // process thicknessField
          if( event.getSource() == thicknessField ) {
               thickness_string = thicknessField.getText();
               thickness = Double.parseDouble( thickness_string);
          // process massField
          if( event.getSource() == massField ) {
               mass_string = massField.getText();
               mass = Double.parseDouble( mass_string);
          // process altitudeField
          if( event.getSource() == altitudeField ){
               altitude_string = altitudeField.getText();
               altitude = Double.parseDouble( altitude_string);
          // process velocityField
          if( event.getSource() == velocityField ){
               velocity_string = velocityField.getText();
               velocity = Double.parseDouble( velocity_string);
          // process trajectory_angleField
          if( event.getSource() == trajectory_angleField ){
               trajectory_angle_string = trajectory_angleField.getText();
               trajectory_angle = Double.parseDouble( trajectory_angle_string);
          // process time_incrementField
          if( event.getSource() == time_incrementField ){
               time_increment_string = time_incrementField.getText();
               time_increment = Double.parseDouble( time_increment_string);
          // process rotation_factorField
          if( event.getSource() == rotation_factorField ){
               rotation_factor_string = rotation_factorField.getText();
               rotation_factor = Double.parseDouble( rotation_factor_string);
          // process startButton event
          if ( event.getSource() == startButton )                
               strtb();               
          // process resetButton event
          if ( event.getSource() == resetButton )
               reset();
          // process contButton event
          if ( event.getSource() == contButton )
               cont();
          // process abortButton event
          if ( event.getSource() == abortButton )
               abort();
     } // end method actionPerformed
     public void strtb()
          try{          
               span = Double.parseDouble( spanField.getText() );
               chord = Double.parseDouble( chordField.getText() );
               thickness = Double.parseDouble( thicknessField.getText() );
               mass = Double.parseDouble( massField.getText() );
               altitude = Double.parseDouble( altitudeField.getText());
               velocity = Double.parseDouble( velocityField.getText());
               trajectory_angle = Double.parseDouble( trajectory_angleField.getText());
               time_increment = Double.parseDouble( time_incrementField.getText() );     
               rotation_factor = Double.parseDouble( rotation_factorField.getText() );          
               if( span < 0 || chord < 0 || thickness < 0 || mass < 0
                    || altitude < 0 || velocity < 0
                    || time_increment < 0 || rotation_factor < 0 )
               value = false;
               t_r_a_test( trajectory_angle );
               n_v_test( value );
               a_r_e_test( altitude );
               while(sentinel){
                    Z.rundata();
                    if( altitude < 10 )
                         sentinel = false;
               results();
               resultsArea.setText( results() );
          }//end try
          // process improperly formatted input
          catch ( NumberFormatException numberFormatException ) {
               JOptionPane.showMessageDialog( this,
               "You must enter numbers in decimal format or integers"     ,
               "Invalid Number Format" ,
               JOptionPane.ERROR_MESSAGE );
          } // end catch NumberFormatException
          catch ( ArithmeticException arithmeticException ) {
               JOptionPane.showMessageDialog( this,
               arithmeticException.toString(), "Arithmetic Exception" ,
               JOptionPane.ERROR_MESSAGE );
          } // end catch ArithmeticException
          catch ( Tare tare ) {
                    JOptionPane.showMessageDialog( this,
                    tare.toString(), "-90 <= range <= 90 " ,
                    JOptionPane.ERROR_MESSAGE );
          } // end catch Tare
          catch ( Nve nve ) {
                    JOptionPane.showMessageDialog( this,
                    nve.toString(), " value less than zero" ,
                    JOptionPane.ERROR_MESSAGE );
          } // end catch Nve
          catch ( Are are ) {
                    JOptionPane.showMessageDialog( this,
                    are.toString(), " value greater than maximum" ,
                    JOptionPane.ERROR_MESSAGE );
          } // end catch Are
     }  // end method strtb
     public void reset()
          span_string = "";
          chord_string = "";
          thickness_string = "";
          mass_string = "";
          altitude_string = "";
          velocity_string = "";
          trajectory_angle_string = "";
          time_increment_string = "";
          rotation_factor_string = "";
          results_string = "";
          spanField.setText( span_string );
          chordField.setText( chord_string );
          thicknessField.setText( thickness_string );
          massField.setText( mass_string );
          altitudeField.setText( altitude_string );
          velocityField.setText( velocity_string );
          trajectory_angleField.setText( trajectory_angle_string );
          time_incrementField.setText( time_increment_string );
          rotation_factorField.setText( rotation_factor_string );
          resultsArea.setEditable( true );
          resultsArea.setText( results_string );
          resultsArea.setEditable( false );
          span = 0;
          chord = 0;
          thickness = 0;
          mass = 0;
          altitude = 0;
          velocity = 0;
          trajectory_angle = 0;
          time_increment = 0;
          rotation_factor = 0;
          distance = 0;
          velocity_fps = 0;
          elapsed_time = 0;
          value = true;
     }   // end method reset
     public void cont()
     //later
     public void abort()
     //later
     public String results()
     results_string =
     "Distance =\t\t" + distance + " miles\n"
     + "Altitude =\t\t" + altitude + " feet\n"
     + "Trajectory Angle =\t" + trajectory_angle + " degrees\n"
     + "Velocity =\t\t" + velocity_fps + " feet per second\n"
     + "Elapsed Time =\t\t" + elapsed_time + " seconds\n";
     return results_string;
} //end class Trajectory// Trajectory Analysis Program: Calculate.java
public class Calculate {  
     Trajectory T = new Trajectory();
     // Calculate constructor
     public Calculate()
          rundata( );
     public void rundata( )
     T.altitude--;
} // end class Calculate

Similar Messages

  • Is it possible to extend two classes?

    I want to do something like :
    public class C extends A, B {
    public class E extends A, D {
    }The two classes have things in A in common, but have to extend other different classes (B, D) as there are other differences.

    Make A an interface. I mean it. Make A an interface.Thanks for the suggestion but I have identical code to duplicate and wanted an abstract class
    class A{
       private String commonValue;
       public String getCommonValue() { return commonValue; }
       public void processSomething() {
           // Will be identical code for every class needing A
    }I guess I need to make another abstract class and have that extend and than the parent class extend this..
    Just seems annoying to duplicate the same code 5 times
    Message was edited by:
    smiles78

  • Cannot compile two classes that are on same package

    When I compile two classes that are on same package one class that is independent of other class gets compiled but the other class which uses
    the first one shows cannot find symbol error with the first class name

    try...
    javac *.java
    that should compile all the java files in that folder at the same time. I dont know if that will fix your problem but it is worth a shot.

  • How do you have two classes drawing to the same JPanel? Graphics g problem

    Hi all,
    This is probably a five second answer but im really stuck on it!
    How do i have two classes both writing to the same JPanel?
    I have one class that extends JPanel and using Graphics g, draws to the panel ie g.drawString(..);
    But i would like another class to draw to the same panel, so that the two different classes can both draw what they like to the JPanel.
    How do i do this?
    I have tried sending the Graphics g object from the one class to the other but only the original class draws still. I was thinking perhaps if it carn't be done could i have a JPanel on top of the other one that is transparent so there would be a tracing paper effect?
    Many thanks

    I have tried sending the Graphics g object from the
    one class to the other but only the original class
    draws still. I was thinking perhaps if it carn't beThis is the right idea. One problem you may be running into is that JPanel fills in its background with the background color by default. If you switch and use JComponent instead of JPanel you may get better results. Another idea is to use a "painter": a class that has a paint(Graphics g) but is not a component and just paints on a component. I've done this before in implementing Tetris where the dropping piece is a class which can paint itself but is not a component.

  • One performance view for two classes, possible?

    Hi there,
    My system is still running 2007 R2. I am writing a MP now which contains two classes. There are few performance collection rules targeting those two classes. I want to create one performance view to display performance data for BOTH classes. Is it possible?
    I already created an instance group and added both classes as member of the group. By using the group, I can created one alert view to display alerts from either class. Can I use the same trick for the performance view? Thanks!

    In addition, we also can add a dashboard view with two columns for the two classes, and add performance widget for each column.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Two class needs to be extends, So I need some  WorkAround ...

    I have a Simple Question
    for accessing SAP PI MAPPING API in ECLIPSE .
    I need to extend one class AbstractTransformation ....
    similary for getting SAX Parser functionalty in ECLIPSE , I need to extend class DefaultHandler..
    So How to Handle this Case : Two class needs to be extends and I know only one class can be extend .
    So JAVA GURUS , I need some workaround .
    Regards
    PS

    Hi,
    First of all Java does not allow multiple inheritance ie u can extend from only one base class.
    work around :
    write two seperate java class say
    1. myJavaMapping.java which extends AbstractTransformation.
    2. mySaxParser.java which extends DefaultHandler
    And now create an object of mySaxParser in ur myJavaMapping class(see below code).
                    mySaxParser parser = new mySaxParser(out);                             //Out is the outputstream
              SAXParserFactory factory = SAXParserFactory.newInstance(); //standard class
              try
                   SAXParser saxParser = factory.newSAXParser();              //standard class
                   this.out = out;
                   saxParser.parse(in, parser);                                                 //begin parsing                                                                               
    // in is inputstream object & has input XML
              catch(Exception e)
                   e.printStackTrace();
    Hope it is clear,
    Anand

  • Two classes have the same XML type name??? Please, help...

    Hello!
    I have a simple web service class. I generated the ws server-side classes using wsgen.
    I created a jar file from the generated code.
    Then :
    Endpoint endPoint = Endpoint.create(
    new WebServicesUnitImpl()
    String wsFinalName = "http://localhost:9999/akarmi";
    endPoint.publish( wsFinalName );
    The web service started fine.
    Then called wsimport, and the generated classes have been placed into a jar file.
    Then called the code like this:
    WebServicesUnitImplService service = new WebServicesUnitImplService();
    WebServicesUnitImpl unit = service.getWebServicesUnitImplPort();
    unit.serviceXXX();
    but the code doesn't work at all, resulting this error message:
    Two classes have the same XML type name "{http://ws.components.core.ilogique.vii.com/}getMessages". Use @XmlType.name and @XmlType.namespace to assign different names to them.
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
              at public com.vii.ilogique.core.components.ws.GetMessages com.vii.ilogique.core.components.ws.ObjectFactory.createGetMessages()
              at com.vii.ilogique.core.components.ws.ObjectFactory
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
    I have this error report on all generated class file! How can i fix this?
    What is the main problem? The SE usage? I copied the lates jax-ws jars into endorsed lib resulting the same.
    Any help is appreciate.

    Hello!
    I have a simple web service class. I generated the ws server-side classes using wsgen.
    I created a jar file from the generated code.
    Then :
    Endpoint endPoint = Endpoint.create(
    new WebServicesUnitImpl()
    String wsFinalName = "http://localhost:9999/akarmi";
    endPoint.publish( wsFinalName );
    The web service started fine.
    Then called wsimport, and the generated classes have been placed into a jar file.
    Then called the code like this:
    WebServicesUnitImplService service = new WebServicesUnitImplService();
    WebServicesUnitImpl unit = service.getWebServicesUnitImplPort();
    unit.serviceXXX();
    but the code doesn't work at all, resulting this error message:
    Two classes have the same XML type name "{http://ws.components.core.ilogique.vii.com/}getMessages". Use @XmlType.name and @XmlType.namespace to assign different names to them.
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
              at public com.vii.ilogique.core.components.ws.GetMessages com.vii.ilogique.core.components.ws.ObjectFactory.createGetMessages()
              at com.vii.ilogique.core.components.ws.ObjectFactory
         this problem is related to the following location:
              at com.vii.ilogique.core.components.ws.GetMessages
    I have this error report on all generated class file! How can i fix this?
    What is the main problem? The SE usage? I copied the lates jax-ws jars into endorsed lib resulting the same.
    Any help is appreciate.

  • Re: How to create More two class with one object

    haii,
             i have small information How to create More two class with one object,
    bye
    bye
    babu

    Hello
    I assume you want to create multiple instance of your class.
    Assuming that you class is NOT a singleton then simply repeat the CREATE OBJECT statement as many times as you need.
    TYPES: begin of ty_s_class.
    TYPES: instance   TYPE REF TO zcl_myclass.
    TYPES: end of ty_s_class.
    DATA:
      lt_itab      TYPE STANDARD TABLE OF ty_s_class
                     WITH DEFAULT KEY,
      ls_record  TYPE ty_s_class.
      DO 10 TIMES.
        CLEAR: ls_record-instance.
        CREATE OBJECT ls_record-instance.
        APPEND ls_record TO lt_itab.
      ENDDO.
    Regards
      Uwe

  • 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.

  • Compiling simultaneously two classes referencing each other

    Hi,
    When we want to compile 2 classes simultaneously in a package, we give command --
    javac package-name/*.java
    Suppose the two classes are ClassA and ClassB and ClassA has a reference of ClassB. So the compiler will finish compiling ClassB before compiling ClassA.
    But, if both the classes have each others' reference, how does compiler resolve this? Because, even in that case both classes get compiled
    Regards,
    Amit

    Lets say that compilation is done in 2 steps.
    The first step is done for all files first.
    Then the second step is done for all files.
    That means that for the second step the compile-time resolution has takes place.
    Two classes that refers to each other must go through the first step in
    the same compilation so that in the second step when
    they are referring to each other they are easily resolved.
    This is different from runtime resolution.

  • Is there any way to identify the two classes are compiled by same vm

    Is there any way to identify the two classes are compiled by same vm?
    Thank's a lot.

    I think this is the better forum than java compiler. The answer to the question you asked is no.
    But that question is not the best way to address your problem.
    If this were me, I'd use a tool like ASM (http://asm.objectweb.org/) to read in that file, and replace the getToday() method, with one like this
    long getToday() {
        return 20080101;
    }and replace the class file with this new one. (keep the old one, they might be using a class loader that verifies class signatures or something)
    (They said the code you are looking at could have been changed by you - so take the hint and change it back).
    If they've ripped you off, this will restore justice much more cheaply and effectively than involving the lawyers. If they then sue you for breaching the license agreement, that would probably force them to disclose their underhand tactics.
    OTOH, if you're lying to us about the purchase, and needing to pay for upgrades to fix the performance issue, and instead are trying to crack some trial software, then I hope they are using a custom class loader that checks the integrity of the classes.
    If you are being ripped off, why are you not telling us the name of the company? I am not sure who is being ripped off here.
    Bruce

  • Hi, my current plans and products include Creative Cloud Photography plan (one-year) and Creative Cloud single-app membership for Photoshop (one-year), I only use photoshop occasionally and for very basic things, are these two plans required for basic p

    Hi, my current plans and products include Creative Cloud Photography plan (one-year) and Creative Cloud single-app membership for Photoshop (one-year), I only use photoshop occasionally and for very basic things, are these two plans required for basic photoshop use or am I able to go with one or the other ?

    PS is part of the photography plan, so your single app plan is redundant.
    Mylenium

  • Getting the JAXB exception like "Two classes have the same XML type name-"

    Getting the JAXB exception like "Two classes have the same XML type name...",
    Here is the exception details:
    Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
    I took the example like:
    package com.model; ---->this package contains 'Address' class and 'City' class
    public class Address {
    private String areaName; private City currentCity; private com.common.City previousCity;
    package com.model;
    public class City {
    private String cityName;
    Another city class in "com.common" package.
    package com.common;
    public class City {
    private String pinCode;
    We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
    I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
    It would be great if i can get the solution from any one....May thanks in advance.
    Thanks,
    Satya.

    Getting the JAXB exception like "Two classes have the same XML type name...",
    Here is the exception details:
    Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
    I took the example like:
    package com.model; ---->this package contains 'Address' class and 'City' class
    public class Address {
    private String areaName; private City currentCity; private com.common.City previousCity;
    package com.model;
    public class City {
    private String cityName;
    Another city class in "com.common" package.
    package com.common;
    public class City {
    private String pinCode;
    We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
    I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
    It would be great if i can get the solution from any one....May thanks in advance.
    Thanks,
    Satya.

  • How to communicate class a and class b , these two classes doesnot have rel

    class A
    private int a;
    class B
    private int b;
    these two classes doest not have any relation like extends(inhiertance,static method,creating object for class A in class B

    Not sure if this is what you are asking, but...
    You have jars that reference each other (sounds pretty tightly coupled to me, maybe they shouldn't be in separate jars, but I digress) and each has a manifest file in META-INF, right?
    To reference another jar's contents, simply add it to the Class-Path variable in your manifest. Then you can reference the classes as if they were all unjarred and slapped in the same directories.
    More Info:
    http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html#special-purpose
    Tarabyte :)

  • Class casting problem when using two class loaders

    Hi, I have a problem with class casting using two different ClassLoader...
    I created an instance of Test class, which is a subclass of AbstractTest and stored it for later use to ArrayList<AsbtractTest>. The instance was created with a custom class loader which extends URLClassLoader. Later when I got the stored instance from the ArrayList<AbstractTest> in default ClassLoader context and cast it to Test, it failed saying "java.lang.ClassCastException: com.test.Test cannot be cast to com.test.Test".
    Does anybody have an idea why this happens?

    Yes - a class is identified by it's package, it's name and it's class loader so the same class code loaded with two different class loaders are two different classes.
    An approach to dealing with your problem is to have the class implement an interface that is loaded by the parent class (assuming, of course, that the two class loaders have the same parent) then you can cast to the interface.

Maybe you are looking for

  • How do I create a welcome page for PDF portfolio in Acrobat X?

    When making portfolios in v9 i was able to add a welcome page to my PDF portfolio. However, since I upgraded I am no longer able to locate this fucntion. Does it still exist and if so how do i access it? If it doesn't exist can anyone explain to me w

  • ALV CHECK CHANGED DATA WITH REUSE_ALV_GRID_DISPLAY

    HELLO  EVERY-ONE.     I have a question that how to check changed data in ALV. I know we can use CHECK_CHANGE_DATA Method in OO, and how to check it in REUSE_ALV_GRID_DISPLAY <b>without double click</b> ?

  • DB Link from Oracle to SQL Server error

    Dear buddies, I need to perfome some select on the tables which reside in SQL Server 2005 from Oracle 10g. I followed the steps given in : http://www.dba-oracle.com/t_heterogeneous_database_connections_sql_server.htm I could perform a TNS ping which

  • Re : How many Records that are transfer once I.P is shedule

    Hi Once one Info package is schedule what is the database that store how much records are transfer to data targets (Info package ,O.D.S) Can any one provide the information on SAP BW Database tables

  • IPhoto won't open for other users on MacBook

    I'm using a MacBook with OSX 10.9. My account purchased iPhoto some time ago, and it appears to work well in my account. Other users of the machine would like to use it too.  Unfortunately, when they attempt to open iPhoto, The App Store opens instea