Problems compiling when calling other classes

hello,
following the Sun tutorial "How to build a application" i wrote this code...
package divelog;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DiveLog extends JFrame{
     // make space in memory for a tabbed pane - not a object until constructor is called to initate
     private JTabbedPane tabbedPane;
     public DiveLog(){ //opens constructor - constructor iniaties objects
          super("Jason's DiveLog"); // super calls jframe - this is cause DiveLog extends JFrame
          addWindowListener(new WindowAdapter() // closes program form clicking "x" on the Jframe
          { //opens addWindowListener method
               public void windowClosing(WindowEvent e){
                    System.exit(0);
     tabbedPane = new JTabbedPane(SwingConstants.LEFT);
     //tabbedPane.setBackground(Color.blue);
     //tabbedPane.setForeground(Color.white);
     // method to add tabs
     populateTabbedPane();
     //method builds menu
     buildMenu();
     // put on JFrame and set sizes
     getContentPane().add(tabbedPane);
     pack();
     setSize(765,690);
     setBackground(Color.white);
     setVisible(true);
     } //ends constructor started on line 13  - DiveLog()     
     // Methods -- for the constructor
     private void populateTabbedPane(){
          tabbedPane.addTab("Welcome",
                                                            null,
                                                            new Welcome(),
                                                            "Welcome to Jason's Dive Log");
          tabbedPane.addTab("Diver Data",
                                                             null,
                                                             new Diver(),
                                                             "Click here to enter diver data");
          tabbedPane.addTab("Log Dives",
                                                            null,
                                                            new Dives(),
                                                            "Click here to enter dives");
          tabbedPane.addTab("Stats",
                                                            null,
                                                            new Statistics(),
                                                            "Click here to calculate stats");
     } // ends tabbed pane method
     private void buildMenu(){
          JMenuBar mb = new JMenuBar();
          JMenu menu = new JMenu("FIle");
          JMenuItem item = new JMenuItem("Exit");
          menu.add(item);
          mb.add(menu);
          setJMenuBar(mb);
          item.addActionListener(new ActionListener()
               public void actionPerformed(ActionEvent e){
                    System.exit(0);
     }// ends buildMenu method
} //ends class
          then... i made the welcome, dives,diver.... classes ...they look like this...
package divelog;
import javax.swing.*;
import java.awt.*;
public class Welcome extends JPanel{
}all the .java files are in /home/mohadib/java_restore/DiveLog/
so per the tutorial i try to compile with this.....
javac -classpath /home/mohadib/java_restore/ DiveLog.java
but i get this error....
mohadib@mohadib ~/java_restore/DiveLog--->javac -classpath /home/mohadib/java_restore/ DiveLog.java
DiveLog.java:48: cannot resolve symbol
symbol : class Welcome
location: class divelog.DiveLog
new Welcome(),
^
DiveLog.java:53: cannot resolve symbol
symbol : class Diver
location: class divelog.DiveLog
new Diver(),
^
DiveLog.java:58: cannot resolve symbol
symbol : class Dives
location: class divelog.DiveLog
new Dives(),
^
DiveLog.java:63: cannot resolve symbol
symbol : class Statistics
location: class divelog.DiveLog
new Statistics(),
^
4 errors
could some one please tell me what im doing wrong :)
Thanks,
jd
          

found the problem...
i used this at the top of all the .java files....
package divelog;
then my dir tree looked like this....
/home/mohadib/java_restore/DIveLog
so i changed to
/home/mohadib/java_restore/divelog
and compiled with this....
javac -classpath /home/mohadib/java_restore DiveLog.java
then ran it with this.....
java -classpath /home/mohadib/java_restore divelog.DiveLog
thanks,
jd

Similar Messages

  • I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

  • Compile and call the class during the runtime

    Hi guys,
    I am struggling with a project, which allow user to modify the behavior of the program.
    To do this, my Java code must be able to compile the Java code (*.java) and call the class from the code during the runtime.
    Here are my code:
    com.sun.tools.javac.Main javac = new com.sun.tools.javac.Main();
    String[] options = new String[] {"d:\\javaExternal\\RunTimeCompilation.java"};
    System.out.println(Main.compile(options));This allows me to compile the .java file into .class file. However, I can't find the way to access/use the .class file.
    Do you guys have solution for this?
    Thanks a lot.

    You will also need to investigate class unloading and proxies since presumably they can modify the file and compile it again.
    Might note that in general this seldom works for business solutions. It seems like allowing the users to add their own functionality would be a good idea so the programmers don't have to keep doing it. But the reality is that then the users must become programmers. And often must be pretty good at it as well since they must not only know the programming language but also the framework too. The second problem is that it also becomes a maintenance nightmare for the real developers to upgrade the existing system.

  • Calling other classes

    First off, I should note that I'm new here, and this question is probably ridiculously easy to fix, but I'll give it anyway.
    I am making a game (Mini Golf) using the FANG engine (http://www.fangengine.org). I'm not sure if that matters for this problem, but it may. Anyway, the game consists of a bounce engine, a putting engine, and the levels. I'd like to have each level in its own class, with the main class containing the engines and having something like this in it.
    <code>
    if (ballGoesInHole)
    holeOn = holeOn + 1;
    if (holeOn = 2)
    runLevel2Class();
    </code>
    Of course, there would be more if (holeOn = hole) statements. The problem? I'm not sure how to do it. The Level?Class() would just make the next level, and have to physics whatsoever. It would just draw. The physics engine would have to refer back to sprites created in the Level Classes. Is this even possible? If it can be done, how?

    qwerty96 wrote:
    Ok, I think I've got a handle on that. Just one thing, however. I have an arrayList that will be added to in the other classes. So if I create an arrayList in The Main class, then how do I add to it in the other classes?Expose a public void addThing(Thing thing) method from the Main class, yes?
    You really really really need to go through [The Tutorials|http://java.sun.com/docs/books/tutorial/] (or something)... you're wasting your time asking basic questions, and we're wasting our time answering them.

  • Passing values and calling other classes?

    Hello all.
    I have 2 classes(separate .java files). One is a login class and the other is the actual program. Login class(eventually exe file) should open the other class and pass the login parameters if you know what I mean. Is this possible, or do the 2 classes need to be part of one file?
    Thanks alot
    Milan D

    Login class can be another class in another file
    wht u have to do is to make an instance of login class in the class u want to use that class
    like login lg = new Login();
    and call method of login class
    lg.setUser(username);
    where setUser(String user); is a method of login class
    this way u can pass the parameters to login class
    i hope this might be helpful
    regards
    Moazzam

  • Errors in a Java class when calling other methods

    I am giving the code i have given the full class name . and now it is giving the following error :
    Cannot reference a non-static method connectDB() in a static context.
    I am also giving the code. Please do help me on this. i am a beginner in java.
    import java.sql.*;
    import java.util.*;
    import DButil.*;
    public class StudentManager {
    /** Creates a new instance of StudentManager */
    public StudentManager() {
    Connection conn = null;
    Statement cs = null;
    public Vector getStudent(){
    try{
    dbutil.connectDB();
    String Query = "Select St_Record, St_L_Name, St_F_Name, St_Major, St_Email_Address, St_SSN, Date, St_Company, St_Designation";
    cs = conn.createStatement();
    java.sql.ResultSet rs = cs.executeQuery(Query);
    Vector Studentvector = new Vector();
    while(rs.next()){
    Studentinfo Student = new Studentinfo();
    Student.setSt_Record(rs.getInt("St_Record"));
    Student.setSt_L_Name(rs.getString("St_L_Name"));
    Student.setSt_F_Name(rs.getString("St_F_Name"));
    Student.setSt_Major(rs.getString("St_Major"));
    Student.setSt_Email_Address(rs.getString("St_Email_Address"));
    Student.setSt_Company(rs.getString("St_Company"));
    Student.setSt_Designation(rs.getString("St_Designation"));
    Student.setDate(rs.getInt("Date"));
    Studentvector.add(Student);
    if( cs != null)
    cs.close();
    if( conn != null && !conn.isClosed())
    conn.close();
    return Studentvector;
    }catch(Exception ignore){
    return null;
    }finally {
    dbutil.closeDB();
    import java.sql.*;
    import java.util.*;
    public class dbutil {
    /** Creates a new instance of dbutil */
    public dbutil() {
    Connection conn;
    public void connectDB(){
    conn = ConnectionManager.getConnection();
    public void closeDB(){
    try{
    if(conn != null && !conn.isClosed())
    conn.close();
    }catch(Exception excep){
    The main error is occuring at the following lines connectDB() and closeDB() in the class student manager. The class dbutil is in an another package.with an another file called connectionManager which establishes the connection with DB. The dbutil has the openconnection and close connection methods. I have not yet written the insert statements in StudentManager. PLease do Help me

    You're doing quite a few things that will cause errors, I'm afraid. I'll see if I can help you.
    The error you're asking about is caused by the following line:
    dbutil.connectDB();
    Now first of all please always ensure that your class names begin with capital letters and your instances of classes with lowercase letters. That's what everybody does, so it makes your code much easier to follow.
    So re-write the couple of lines at the beginning of your dbutil class like this:
    public class Dbutil {
    /** Creates a new instance of Dbutil */
    public Dbutil() {
    Now you need to create an instance of dbutil before you can call connectDB() like this:
    Dbutil dbutil = new Dbutil();
    now you can call the method connectDB():
    dbutil.connectDB();
    The problem was that if you don't create an instance first then java assumes that you are calling a static method, because you don't need an instance of a class to call a static method. If it was static, the method code would have been:
    public static void connectDB(){
    You have a fine example of a static method call in your code:
    ConnectionManager.getConnection();
    If it wasn't a static method your code would have to look like this:
    ConnectionManager connectionManager = new ConnectionManager();
    connectionManager.getConnection();
    See the difference? I also know that ConnectionManager.getConnection() is a call to a static method because it begins with a capital letter.
    Anyway - now on to other things:
    You have got two different Connection objects called conn. One is in StudentManager and the other is in Dbutils, and for the moment they have nothing to do with each other.
    You call dbUtil.connectDb() and so if your connectDb method is working properly you have a live connection called conn in your dbUtil object. But the connection called conn in StudentManager is still null.
    If your connection in the dbUtil object is working then you could just add a line after the call to connectDb() in StudentManager so that the StudentManager.conn object references the dbUtil.conn object like this:
    dbutil.connectDB();
    conn = dbUtil.conn;

  • Problem in hearing ringer when calling other side, iPhone 4S ?

    I updated iPhone version yesterday to the latest version iOS 7.1 and now when I'm calling my friends or home, I'm unable to hear the ringing tone !!!! but when I turn ON the loudspeaker and turn it OFF then I can hear the ringing sound
    I tried calling several different networks and its happening to all. can anybody have any suggestion ... thank you

    Apple guys are deleting posts. I have found my posts have been deleted. Apple should MUST let us downgrade at least to previous release from current which was working fine.

  • Select options field is giving type conflict when calling a class.

    hai guys,
           i have a field SALESORD in subscreen as a SELECT-OPTIONS field for vbeln.
    Now i created a class,with SALESDETAILS  of type TABLE as a parameter of a method.
    when i call the method(after creating an object) the SALESDETAILS parameter is supposed to take the SALESORD field.
      but it gives me a type conflict error.
    i wonder why..coz both fileds have same type..
    how to resolve the issue..
    helpful answers will be rewarded.
    thank you.

    Hi Shravan,
    Pass the select-options vbeln values into a temporary table and pass this table into the method.
    <b>Reward for helpful answers</b>
    Satish

  • Problem facing when calling a JAX WS WSDL

    Hi,
    I have a simple JAVA WS , deployed in a server and I want to call it from ODI , the JAVA Class takes some inputs as input Parameter and writes the data into the DB.
    I didn't use any explicit XSD for designing the WS, WS has it own inline schema.
    definitions targetNamespace="http://ws.test.com/" name="TestWSService"><types><xsd:schema><xsd:import namespace="http://ws.test.com/" schemaLocation="http://localhost:7001/Test-context-root/TestPort?xsd=1"/></xsd:schema></types>
    When I am using clicking on Connect to WSDL from OdiInvokeWebService tool from the Advance Editor, it is giving an error as ODI-20362:Couldn't connect to web Service, In the detailed description it is showing as
    "This URL does not point to a valid WSDL"
    I am not getting why I am getting such error, any help is highly appreciable.
    Thanks.

    Hi ,
    Can anyone pls help me.
    Inspite of changing proxy information in its preference dialog of ODI still I am getting the same error when trying to invoke a JAX_WS wsdl with inline schema.
    ODI-20362: Couldn't connect to web Service.
    In the detailed part I am getting as follows:
    com.sunopsis.wsinvocation.SnpsWSInvocationException: com.sunopsis.wsinvocation.SnpsWSInvocationException: This URL does not point to a valid WSDL
        at com.sunopsis.wsinvocation.client.WebServiceFactory.getParserIstance(WebServiceFactory.java:95)
        at com.sunopsis.wsinvocation.client.WebServiceFactory.getParserIstance(WebServiceFactory.java:126)
        at com.sunopsis.graphical.wsclient.RequestWsPane$17.doInBackground(RequestWsPane.java:1691)
        at com.sunopsis.graphical.tools.utils.swingworker.SwingWorker$1.call(SwingWorker.java:240)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:139)
        at com.sunopsis.graphical.tools.utils.swingworker.SwingWorker.run(SwingWorker.java:279)
        at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:656)
        at java.lang.Thread.run(Thread.java:662)
    Caused by: com.sunopsis.wsinvocation.SnpsWSInvocationException: This URL does not point to a valid WSDL
        at oracle.odi.wsinvocation.client.impl.jaxws.OdiJaxwsParserImpl.setWsdlUrl(OdiJaxwsParserImpl.java:132)
        at com.sunopsis.wsinvocation.client.WebServiceFactory.getParserIstance(WebServiceFactory.java:89)
        ... 8 more
    Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Error importing schemas: java.io.IOException: Unable to parse schema at 'http://172.18.41.47:7001/GenericErrorHandlerWSApp-GenericErrorHandlerWS-context-root/ErrorHandlerWSPort?xsd=1': Expected 'EOF'.
        at oracle.j2ee.ws.wsdl.extensions.schema.SchemaSerializer.unmarshall(SchemaSerializer.java:76)
        at oracle.j2ee.ws.wsdl.extensions.ParseUtils.createExtensibilityElement(ParseUtils.java:112)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:1505)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.parseDefinition(WSDLReaderImpl.java:790)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:707)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:656)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:648)
        at oracle.odi.wsinvocation.client.impl.jaxws.OdiJaxwsParserImpl.setWsdlUrl(OdiJaxwsParserImpl.java:128)
        ... 9 more
    Caused by: java.io.IOException: Unable to parse schema at 'http://172.18.41.47:7001/GenericErrorHandlerWSApp-GenericErrorHandlerWS-context-root/ErrorHandlerWSPort?xsd=1': Expected 'EOF'.
        at oracle.j2ee.ws.wsdl.extensions.schema.SchemaSerializer.readSchemaFile(SchemaSerializer.java:186)
        at oracle.j2ee.ws.wsdl.extensions.schema.SchemaSerializer.loadReference(SchemaSerializer.java:138)
        at oracle.j2ee.ws.wsdl.extensions.schema.SchemaSerializer.processImportIncludeRedefine(SchemaSerializer.java:108)
        at oracle.j2ee.ws.wsdl.extensions.schema.SchemaSerializer.unmarshall(SchemaSerializer.java:73)
        at oracle.j2ee.ws.wsdl.extensions.ParseUtils.createExtensibilityElement(ParseUtils.java:115)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:1505)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.parseDefinition(WSDLReaderImpl.java:790)
        at oracle.j2ee.ws.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:708)
        ... 12 more

  • Cant hear ringer tone when calling others nor can hear who im calling

    okay so everytime i make a call for the frist time i cant hear the ringer tone nor can hear the person im calling.
    they say they can hear me perfectly but the only thing i hear is my own voice,
    i see the call outgoes the iphone because the call timer starts to count but i cant hear the ringer nor the person im calling so i can never tell when they answer my call or not unless i see the timer.
    Now i have to hang up and call again, THEN the second time i call i can hear the ringer and the person im calling when they answer.
    i have an iphone 4s 32gb with iOS5 and siri is off, in fact i have never turned it on
    any help? is my phone defective? or do i have to wait for an update to fix this?
    thanks!

    I have the same problem, but I am sorry to say that I have no idea why it happens.

  • My number comes up blocked when calling others

    i recently lost my pearl flip =( and had to get another blackberry cause i couldnt stand the nokia i had. i ended up finding a pearl 8110 for a good price so i bought it. i put my sim card in it and couldnt be happier with it except this one problem.
    when i make calls to other people the number shows up 'private' or blocked on whose ever phone i am calling. alot of my friends and family will not answer private numbers so this is a problem! i assume there is a 'restrict identity' or something feature but i couldnt find it in any options. anyone else have a problem like this?
    also, is there a way to change the sms/mms message tone?i can only change the ringtone.
    any help is appreciated
    Solved!
    Go to Solution.

    1. Press the green dial key to enter the call log > Menu key > Restrict My Identity > No or never.
    2. Profiles... edit your profiles on the device > Advanced > Active Profile > SMS. Set the tone there.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Problem with cfobject calling java class

    hi there,
    i have a small java class that takes 2 arguments in
    (fileToRead & fileToWrite) and everything runs fine when i run
    the class from the command line...
    C:\>java csvParser fileToRead fileToWrite
    however when i try to instantiate the class via cfobject like
    so :
    <cfobject type="Java" action="create" class="csvParser"
    name="convert">
    <cfset convert.init(#tmpfile#, "text.xml")>
    it continuously throws the following error at me :
    Unable to find a constructor for class csvParser that accepts
    parameters of type ( java.lang.String, java.lang.String ).
    any ideas ast to what i may be missing here...startin to
    drive me batty.

    C:\>java csvParser fileToRead fileToWrite
    Suggests you passed arguments as args[0] and args[1] to the
    method
    public static void main(String[] args)
    <cfobject type="Java" action="create" class="csvParser"
    name="convert">
    <cfset convert.init(#tmpfile#, "text.xml")>
    Suggests the code for the class CSVParser has the following
    constructor definition:
    private String s1, s2;
    CSVParser (String s1, String s2) {
    this.s1=s1;
    this.s2=s2;
    This seems unlikely, in view of
    "everything runs fine when i run the class from the command
    line". One possibility is to convert the
    public static void main method into, for example, the public
    method
    doThemFiles(String s1, String s2), not forgetting to include
    the return-type in its signature. You could then run
    <cfobject type="Java" action="create" class="csvParser"
    name="convert">
    <cfset convert.doThemFiles("#tmpfile#", "text.xml")>

  • Problem met when call external exe in jar.

    hi all,
    in my java project, i call an external exe . i met a problem that sometimes the exe is not fully finished. How could i confirm that the exe is finished before i start to use the output of this exe.
    i use following code to call the external exe:
    Runtime.getRuntime().exec(command).

    Hi Avm,
    thanks very much.
    The simplest answer is that
    getRuntime().exec(command).waitFor() will help you.
    But besides of sync there are number of other
    potential problems with Runtime.exec
    Good examples and description there is here:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-
    traps.html

  • Problem meet when call exe in java.

    hi all,
    in my java project, i call an external exe . now the problem is that sometimes the exe is not fully finished. How could i confirm that the exe is finished before i start to use the output of this exe.
    i use following code to call the external exe:
    Runtime.getRuntime().exec(command).

    Hi,
    Please post this to an appropriate forum . this forum is exclusively related to creator
    MJ

  • TS3899 When at home using our home wireless I can send and receive emails on my iPad no problem.  When using other wireless networks I can send emails to people who share the same Internet provider but not others.  Why?

    Is the wireless provider the issue?  I can receive emails everywhere I go but in some locations can only send to a limited number of email addresses.

    Greetings
    I suspect that the issue is the SMTP server settings. On your home network you are using your providers SMTP server and all is fine (If you check your email account configs you will find that the SMTP server is set to your providers?).
    When you use a different network (provider) mail will not be sent unless you use that networks (providers) SMTP server (this is a security issue to address ways of "spamming").
    So if youre 3G/4G provider is the same as you home provider all will work well via your home WiFi. If you turn off WiFi and just use your 3G/4G connection to send mail (iPhone/iPad etc) all will work well (when you are out and about and using anothers WiFi network).
    If you are connected to, say a MacDonalds WiFi, mail will probably not be sent. (It will be received though).
    Using WEB mail interface (via your WEB browser) removes this problem as well. 
    (A SMTP server is what is used to send email. So to successfully use anothers (not a networks the same as your providers) WiFi network and send email via it, you must know the SMTP servers name and reconfigure your email account/s to use that server to send mail.)

Maybe you are looking for

  • HP LaserJet Pro P1606dn Printer constantly goes offline

    We have a HP LaserJet Pro P1606dn Printer. We initally put this on our print server. But almost immediately it goes offline. Current settings: Jam Recovery: Auto Auto Continue: On IO Timeout: 1800 Auto Off: Disabled Since it was so problematic - we t

  • Urgent Please: Mac-Based Home Studio

    hi. sorry if this is not the right category for this post. i'd really appreciate some urgent advice regarding the following. a sponsor has offered me about £5000-6000 for starting a mini (home) but professional audio-video studio, provided that i pro

  • I am not happy with the changes in recent versions of Firefox

    Hey Guys and Girls in the 'Development Team' Have you noticed that the vastest majority of Firefox users are looking for ways to return the interface to the one they know and love. Clearly this has been ignored. The changes have taken away all of the

  • Officejet 7410 shows "Remove and check color cartridge" on display.

    I have removed and checked the Color Cartridge and replaced it.  No change. I carefully cleaned the cartridge contacts with distilled water. Still no change. I went and bought both a new Color Cartridge (#97) and a new Black Cartridge (#96). Installe

  • ¿Cómo usar ipod touch en Os X Tiger?

    Hola, alguien sabe que solución puede haber para usar el ipod touch 4G ios 4.3.3 sobre sistema operativo 10.4.11 Tiger.