Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By doWhile

Thread: How can I import my classes?

  1. #1
    Pojahn_M's Avatar
    Pojahn_M is offline Senior Member
    Join Date
    Mar 2011
    Location
    Sweden
    Posts
    197
    Rep Power
    4

    Default How can I import my classes?

    Previously when I was using Textpad, I placed my own packages in C:\Program\Java\jdk1.7.0\jre\classes\pjjava\crypt.
    When I created my own classes, I could import my own packages by writing import pjjava.crypt;.
    When I try to import this package in eclipse(same syntax as above), I get compile error.
    How do I fix this?

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: How can I import my classes?

    Word of warning - I would highly discourage putting any custom classes in the JRE path like this. Something as simple as a java update and poof - goodbye classes. I would recommend moving them out, importing them as a project into Eclipse...you can then add them to the classpath through Eclipse.

  3. #3
    Pojahn_M's Avatar
    Pojahn_M is offline Senior Member
    Join Date
    Mar 2011
    Location
    Sweden
    Posts
    197
    Rep Power
    4

    Default Re: How can I import my classes?

    thanks.
    Okey, i have now created an project of each package I had in jre/classes.
    Package pjjava.crypt is now in a project called Crypting Library(in package pjjava.crypt).
    Package pjjava.misc is now in a project called Misc Library(in package pjjava.misc).

    But there is problem, some classes from crypt package use classes from misc package. How can I use them(use classes from an other project)?

  4. #4
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: How can I import my classes?

    Right click the project, go to Properties -> Java Build Path -> Projects and add the project.
    Pojahn_M likes this.

Similar Threads

  1. How do you import?
    By Gary20 in forum New To Java
    Replies: 2
    Last Post: 01-28-2011, 07:12 PM
  2. static import only from classes and interfaces
    By balajir in forum New To Java
    Replies: 3
    Last Post: 12-13-2010, 06:31 AM
  3. Help with import
    By eel in forum New To Java
    Replies: 2
    Last Post: 09-19-2010, 11:51 AM
  4. Import
    By gothrog in forum Java Applets
    Replies: 2
    Last Post: 05-14-2010, 12:16 AM
  5. Can not import jxl.*
    By AnnieDing in forum Java Servlet
    Replies: 3
    Last Post: 01-22-2010, 04:52 PM

Posting Permissions

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