|
-
Sep 21st, 2010, 06:45 PM
#1
Thread Starter
Lively Member
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
}
}
-
Oct 1st, 2010, 08:41 AM
#2
Fanatic Member
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.
-
Nov 10th, 2010, 05:47 PM
#3
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|