Results 1 to 3 of 3

Thread: Java help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2009
    Posts
    98

    Arrow Java help

    Anyone know how I can get around recompiling a class that is inside a package and uses classes that aren't in a package?

    The code

    global.java
    Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    /**
     *
     * @author Admin
     */
    public class Global {
            example.Main main;
            public Global(example.Main m)
            {
                    main = m;
            }
    }
    main.java
    Code:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    package example;
    
    /**
     *
     * @author Admin
     */
    public class Main {
    
            /**
            * @param args the command line arguments
            */
            public static void main(String[] args) {
                    Global g = new Global(new Main());
                    //It is trying to use example.Global as the symbol.
            // TODO code application logic here
            }
    
    }

  2. #2
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    Re: Java help

    please use a reasonable title, so people know what you're about to do, so people without an answer just don't click here and expect to be able to answer, like myself.


    SUBJECT LINES:
    Your subject line will impact how well your question is answered. Your subject line should indicate the topic you are asking or commenting about. Here are some suggestions:


    Be concise.
    If you can do it in just a few words, ask a question or state the topic of your question.
    If you cannot state your question or comment in just a few words, then type the topic of your question or comment as the subject line
    Don't simply say "help". It is assumed that if you ask a question, you want help.
    If your subject line isn't concise or doesn't indicate a specific topic, many people will skip your posting.

  3. #3
    Fanatic Member kregg's Avatar
    Join Date
    Feb 2006
    Location
    UK
    Posts
    524

    Re: Java help

    Try importing the main class into your global class.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width