Eclipse question - using class files in a project with out source .java

Discussion in 'Java' started by keperry, Apr 27, 2006.

  1. keperry

    keperry Guest

    Our professor gives us .class files to use for our homework because
    they contain methods/classes that are needed with the other source
    files he provides. The problem is that Eclipse doesn't recognize these
    ..class files, and makes all my other .java files show errors.

    I guess what I mean by doesn't recognize is that if there is a file
    that has a class named "NewClass" called NewClass.class and I import
    that into my eclipse project, then when I use OtherClass.java and try
    to instantiate an NewClass object, then Eclipse doesn't recognize it.

    Is there a way to fix this?

    Btw - command-line compilation works fine of course, but this doesn't
    let me use the power of Eclipse

    Thanks,
    Keith
     
    keperry, Apr 27, 2006
    #1
    1. Advertising

  2. keperry

    Venkatesh Guest

    U should put the directory or jar containing that class file into ur
    project library.

    These are the steps to set up ur libraries properly in eclipse:
    1. Right click on the project name in Package explorer and choose
    Properties.
    2. In the dialog box that comes up choose Java Build Path
    3. Inside java build path, choose the "Libraries" tab and add
    directories(Button - Add Class Folders)/jars (Button - Add jars/Add
    external jars) etc ...

    I'm using Eclipse 3.1.0, but guess the same thing is applicable for all
    versions of eclipse

    -Venkatesh
     
    Venkatesh, Apr 27, 2006
    #2
    1. Advertising

  3. keperry

    keperry Guest

    Hmm...this didn't seem to change anything?
     
    keperry, Apr 27, 2006
    #3
  4. keperry

    Venkatesh Guest

    Hi,

    What is ur class file name? Is it inside a package? Where did u place
    the class? Also, what path did u add in the "libraries" list.

    Guess the correct path is not added, hence u r not finding things
    working

    -Venkatesh
     
    Venkatesh, Apr 27, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gunter Hansen
    Replies:
    10
    Views:
    41,991
    Paul Hamaker
    Apr 3, 2006
  2. horst
    Replies:
    12
    Views:
    26,118
    f1mahesh
    Mar 5, 2012
  3. Replies:
    1
    Views:
    740
  4. gc
    Replies:
    0
    Views:
    2,894
  5. Veerle
    Replies:
    0
    Views:
    1,400
    Veerle
    Mar 13, 2009
Loading...

Share This Page