Results 1 to 6 of 6
  1. #1
    donvr is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default Classes in Project not appearing in Intellisense

    I have this recurring problem with intellisense that no one has been able to help me with-

    When I define a class elsewhere in my project, I will try to access it and its properties in my main class. For example, in Tuple.java, I will have

    package myPack;

    public class Tuple{
    public Tuple()
    {}
    public Rename()
    {do some stuff}
    }

    When in my main class, package myPack, it refuses to add this info to the intellisense- It's a minor problem that I can get over, but it would be nice to figure it out.

    Any advice?

  2. #2
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    6

    Default

    Quote Originally Posted by donvr View Post
    I have this recurring problem with intellisense that no one has been able to help me with-

    When I define a class elsewhere in my project, I will try to access it and its properties in my main class. For example, in Tuple.java, I will have

    package myPack;

    public class Tuple{
    public Tuple()
    {}
    public Rename()
    {do some stuff}
    }

    When in my main class, package myPack, it refuses to add this info to the intellisense- It's a minor problem that I can get over, but it would be nice to figure it out.

    Any advice?
    It works for me (after making the Tuple class compilable).

    I created the Tuple class and in the main method, I typed "new Tup" followed by Ctrl+Space (to open the code completion window), and it gave me the option to use the default constructor.

    Then, I went to the end of the line and pressed ".", and it opened up the code completion window, from which I selected Rename.

    The final result
    Java Code:
    package myPack;
    
    public class Main
    {
    	public static void main(String[] args)
    	{
    		new Tuple().Rename();
    	}
    }

    What steps did you take? What were you expecting? And what actually happened?
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

  3. #3
    donvr is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default

    Well, due to the project I'm working on, I compile in ANT and not through eclipse itself. I can see how that would cause a problem-
    I have no main class. Each class I program is designed to be used by outside software that will access it;

    When I try to insert a Tuple, I will type 'Tup' and ctrl+space gives me "No default proposals."

    Is there some preference I could alter for it to detect this, or should i just make a main class (which won't really affect my project) and try to compile?

  4. #4
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    6

    Default

    You are writing the code in Eclipse, right? Can you get some steps that I can take to reproduce this, because what I tried didn't work - I still got the code completion.

    Although I use Eclipse to do the compiling, I cleaned the project and didn't recompile. I then closed Eclipse and restarted it. However, I still get the auto-complete.


    Also, whether you write the method in a main method, or another method, if there is access to the Tuple class, then code completion should work.

    If I type in "Tup" then ctrl+space, I get Tuple in the main method, in the class (outside of a method), and even in different methods - in all places where Tuple is visible.


    Out of personal curiosity, why don't you use Eclipse to compile your code? I find that the automatic, incremental builds make it very easy to keep the code compiled, using the latest version, and it compiles quickly.
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

  5. #5
    donvr is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default

    The thing I don't understand is that I don't do any unusual steps-
    I make a new class by adding it to the project, then write out what I have.

    There is a problem I have from time to time that might explain something;
    One of my classes is named Token.
    Whenever I use it, however, the class auto-adds a reference to a different, separate class for Token, which I believe to be included with eclipse. It has interfered with my coding in the past, causing various errors, as eclipse would prefer to go with its own definition of Token than with mine.

    Does that help at all?

    The reason I prefer to compile in ant is that it does not require me to have a main class to compile. Eclipse, when I hit debug or run, tells me it cannot do so without a main class- Is there a different way of compiling that I'm not aware of?

  6. #6
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    6

    Default

    Did you mean a main class, or a main method? There is no such thing as a main class.

    The main method is the entry point into any Java program. You can put a main method in any class, and that class can be run.

    Now, in Eclipse, when you create a class, you can have it automatically create the main method for you, but it's still not a "main class", rather just a normal class with a main method.


    So, it might be a miscommunication or something. What is it that you currently do, but don't think you can do in Eclipse?

    Edit:
    As per your Token class, Sun has several Token classes (many are com.sun.***.Token), so Eclipse is probably offering to import one of those. However, you can still create your own Token class, I know I have before.
    Last edited by CodesAway; 12-05-2009 at 10:49 PM.
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

Similar Threads

  1. JDialog appearing in the toolbar
    By riddick in forum New To Java
    Replies: 6
    Last Post: 11-06-2009, 02:19 PM
  2. jfilechooser not appearing
    By letter5 in forum New To Java
    Replies: 5
    Last Post: 02-15-2009, 04:45 PM
  3. why isn't my combobox appearing on my frame?
    By matpj in forum AWT / Swing
    Replies: 9
    Last Post: 01-29-2009, 03:46 PM
  4. Replies: 1
    Last Post: 07-29-2008, 03:08 AM
  5. Log messages are not appearing in my log file
    By indu_raj in forum Java Servlet
    Replies: 1
    Last Post: 08-08-2007, 11:59 PM

Tags for this Thread

Posting Permissions

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