Java Packages

Discussion in 'Java' started by João Marques, Dec 10, 2008.

  1. Hi, I am working with a program named OtsuThresholding_16Bit, but I
    can't compile even though I have the code already built. But I need
    some packages that don't come already with java and I don't know how
    to get them in the right place. The packages are:

    import ij.*;
    import ij.plugin.filter.PlugInFilter;
    import ij.process.*;
    import ij.gui.*;
    import ij.plugin.frame.PlugInFrame;

    These packages can be found in ImageJ documentation I think.
    If anyone knows how I can help me put these packages to work in my
    java, I'd appreciate a lot.

    Thanks, Joao
     
    João Marques, Dec 10, 2008
    #1
    1. Advertising

  2. João Marques wrote:
    > Hi, I am working with a program named OtsuThresholding_16Bit, but I
    > can't compile even though I have the code already built. But I need
    > some packages that don't come already with java and I don't know how
    > to get them in the right place. The packages are:
    >
    > import ij.*;
    > import ij.plugin.filter.PlugInFilter;
    > import ij.process.*;
    > import ij.gui.*;
    > import ij.plugin.frame.PlugInFrame;
    >
    > These packages can be found in ImageJ documentation I think.
    > If anyone knows how I can help me put these packages to work in my
    > java, I'd appreciate a lot.
    >
    > Thanks, Joao


    You need to list the .jar files that those classes come in your
    classpath. The easiest method is to put them into the same directory
    that you compile your source from and add them to the compile command line.

    javac -cp .;some.jar;someother.jar MyClass.java

    --

    Knute Johnson
    email s/nospam/knute2008/

    --
    Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
    ------->>>>>>http://www.NewsDemon.com<<<<<<------
    Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
     
    Knute Johnson, Dec 10, 2008
    #2
    1. Advertising

  3. Andrew Thompson, Dec 10, 2008
    #3
  4. João Marques

    Arne Vajhøj Guest

    Andrew Thompson wrote:
    > On Dec 11, 8:52 am, João Marques <> wrote:
    >> ..need some packages ... ImageJ ...

    >
    > I suspect Knute answered a different question
    > to the one you are asking, but I am not sure.
    >
    > So, here is my answer.
    >> http://www.google.com/search?q=imagej download


    Very likely the original poster needs both: get the jar and
    put it in classpath.

    Arne
     
    Arne Vajhøj, Dec 10, 2008
    #4
  5. On 10 dez, 23:28, Arne Vajhøj <> wrote:
    > Andrew Thompson wrote:
    > > On Dec 11, 8:52 am, João Marques <> wrote:
    > >> ..need some packages ... ImageJ ...

    >
    > > I suspect Knute answered a different question
    > > to the one you are asking, but I am not sure.

    >
    > > So, here is my answer.
    > >>http://www.google.com/search?q=imagej download

    >
    > Very likely the original poster needs both: get the jar and
    > put it in classpath.
    >
    > Arne


    Well I have already downloaded de ImageJ program into my computer.
    What I don't know is where those packages can be found. If you can
    answer me something else, maybe it would help. When you write "import
    java.util.Scanner" for example, and compile the program, the compiler
    will know what package you are talking about. But where can you find
    it in your computer? Is there a folder where these packages are?
     
    João Marques, Dec 11, 2008
    #5
  6. João Marques

    Arne Vajhøj Guest

    João Marques wrote:
    > On 10 dez, 23:28, Arne Vajhøj <> wrote:
    >> Andrew Thompson wrote:
    >>> On Dec 11, 8:52 am, João Marques <> wrote:
    >>>> ..need some packages ... ImageJ ...
    >>> I suspect Knute answered a different question
    >>> to the one you are asking, but I am not sure.
    >>> So, here is my answer.
    >>>> http://www.google.com/search?q=imagej download

    >> Very likely the original poster needs both: get the jar and
    >> put it in classpath.

    >
    > Well I have already downloaded de ImageJ program into my computer.
    > What I don't know is where those packages can be found. If you can
    > answer me something else, maybe it would help. When you write "import
    > java.util.Scanner" for example, and compile the program, the compiler
    > will know what package you are talking about. But where can you find
    > it in your computer? Is there a folder where these packages are?


    In that case it is Knute's advice you need. You need to
    ass the jar file to the classpath.

    Like:

    javac -classpath foobar.jar Something.java
    java -classpath foobar.jar Something

    Arne

    PS: You don't need to specify anything for the java.util because those
    classes are in a jar file that java search by default.
     
    Arne Vajhøj, Dec 11, 2008
    #6
  7. João Marques

    Mark Space Guest

    João Marques wrote:

    > Well I have already downloaded de ImageJ program into my computer.
    > What I don't know is where those packages can be found. If you can


    Well, I think you need to help us and tell us what you downloaded and
    where you put it. We can't guess.


    > answer me something else, maybe it would help. When you write "import
    > java.util.Scanner" for example, and compile the program, the compiler
    > will know what package you are talking about. But where can you find
    > it in your computer? Is there a folder where these packages are?


    No, it's the other way around. You tell Java where to find the package,
    with the classpath. That's why we need to know where you put the thing.

    Also, what IDE are you using?


    (There is a way to put any library in the default search path, but it's
    really evil and can mess up other projects. Better to use the classpath
    by far.)
     
    Mark Space, Dec 11, 2008
    #7
  8. On 11 dez, 02:00, Mark Space <> wrote:
    > João Marques wrote:
    > > Well I have already downloaded de ImageJ program into my computer.
    > > What I don't know is where those packages can be found. If you can

    >
    > Well, I think you need to help us and tell us what you downloaded and
    > where you put it.  We can't guess.
    >
    > > answer me something else, maybe it would help. When you write "import
    > > java.util.Scanner" for example, and compile the program, the compiler
    > > will know what package you are talking about. But where can you find
    > > it in your computer? Is there a folder where these packages are?

    >
    > No, it's the other way around.  You tell Java where to find the package,
    > with the classpath.  That's why we need to know where you put the thing..
    >
    > Also, what IDE are you using?
    >
    > (There is a way to put any library in the default search path, but it's
    > really evil and can mess up other projects.  Better to use the classpath
    > by far.)


    I have downloaded the packages that I need and I have them in my
    Desktop. I tried to set the source path as to include this folder but
    it doesn't seem to work. I don't really know how to use classpath. And
    I use the JCreator to write my Java programs.
     
    João Marques, Dec 11, 2008
    #8
  9. On 11 dez, 02:00, Mark Space <> wrote:
    > João Marques wrote:
    > > Well I have already downloaded de ImageJ program into my computer.
    > > What I don't know is where those packages can be found. If you can

    >
    > Well, I think you need to help us and tell us what you downloaded and
    > where you put it.  We can't guess.
    >
    > > answer me something else, maybe it would help. When you write "import
    > > java.util.Scanner" for example, and compile the program, the compiler
    > > will know what package you are talking about. But where can you find
    > > it in your computer? Is there a folder where these packages are?

    >
    > No, it's the other way around.  You tell Java where to find the package,
    > with the classpath.  That's why we need to know where you put the thing..
    >
    > Also, what IDE are you using?
    >
    > (There is a way to put any library in the default search path, but it's
    > really evil and can mess up other projects.  Better to use the classpath
    > by far.)


    I have downloaded the packages that I need and I have them in my
    Desktop. I tried to set the source path as to include this folder but
    it doesn't seem to work. I don't really know how to use classpath. And
    I use the JCreator to write my Java programs.
     
    João Marques, Dec 11, 2008
    #9
  10. On 11 dez, 02:00, Mark Space <> wrote:
    > João Marques wrote:
    > > Well I have already downloaded de ImageJ program into my computer.
    > > What I don't know is where those packages can be found. If you can

    >
    > Well, I think you need to help us and tell us what you downloaded and
    > where you put it.  We can't guess.
    >
    > > answer me something else, maybe it would help. When you write "import
    > > java.util.Scanner" for example, and compile the program, the compiler
    > > will know what package you are talking about. But where can you find
    > > it in your computer? Is there a folder where these packages are?

    >
    > No, it's the other way around.  You tell Java where to find the package,
    > with the classpath.  That's why we need to know where you put the thing..
    >
    > Also, what IDE are you using?
    >
    > (There is a way to put any library in the default search path, but it's
    > really evil and can mess up other projects.  Better to use the classpath
    > by far.)


    I have downloaded the packages that I need and I have them in my
    Desktop. I tried to set the source path as to include this folder but
    it doesn't seem to work. I don't really know how to use classpath. And
    I use the JCreator to write my Java programs.
     
    João Marques, Dec 11, 2008
    #10
  11. On 11 dez, 02:00, Mark Space <> wrote:
    > João Marques wrote:
    > > Well I have already downloaded de ImageJ program into my computer.
    > > What I don't know is where those packages can be found. If you can

    >
    > Well, I think you need to help us and tell us what you downloaded and
    > where you put it.  We can't guess.
    >
    > > answer me something else, maybe it would help. When you write "import
    > > java.util.Scanner" for example, and compile the program, the compiler
    > > will know what package you are talking about. But where can you find
    > > it in your computer? Is there a folder where these packages are?

    >
    > No, it's the other way around.  You tell Java where to find the package,
    > with the classpath.  That's why we need to know where you put the thing..
    >
    > Also, what IDE are you using?
    >
    > (There is a way to put any library in the default search path, but it's
    > really evil and can mess up other projects.  Better to use the classpath
    > by far.)


    I have downloaded the packages that I need and I have them in my
    Desktop. I tried to set the source path as to include this folder but
    it doesn't seem to work. I don't really know how to use classpath. And
    I use the JCreator to write my Java programs.
     
    João Marques, Dec 11, 2008
    #11
  12. João Marques

    Lew Guest

    João Marques wrote:
    > I don't really know how to use classpath.


    Have you considered reading the documentation?

    <http://java.sun.com/javase/6/docs/technotes/tools/solaris/classpath.html>
    <http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html>

    --
    Lew
     
    Lew, Dec 11, 2008
    #12
  13. João Marques

    Lew Guest

    João Marques wrote:
    > I have downloaded the packages that I need and I have them in my
    > Desktop. I tried to set the source path as to include this folder but
    > it doesn't seem to work. I don't really know how to use classpath. And
    > I use the JCreator to write my Java programs.


    No need to repeat yourself, the first three times made it through.

    --
    Lew
     
    Lew, Dec 11, 2008
    #13
  14. On 11 dez, 02:00, Mark Space <> wrote:
    > João Marques wrote:
    > > Well I have already downloaded de ImageJ program into my computer.
    > > What I don't know is where those packages can be found. If you can

    >
    > Well, I think you need to help us and tell us what you downloaded and
    > where you put it.  We can't guess.
    >
    > > answer me something else, maybe it would help. When you write "import
    > > java.util.Scanner" for example, and compile the program, the compiler
    > > will know what package you are talking about. But where can you find
    > > it in your computer? Is there a folder where these packages are?

    >
    > No, it's the other way around.  You tell Java where to find the package,
    > with the classpath.  That's why we need to know where you put the thing..
    >
    > Also, what IDE are you using?
    >
    > (There is a way to put any library in the default search path, but it's
    > really evil and can mess up other projects.  Better to use the classpath
    > by far.)


    I have downloaded the packages that I need and I have them in my
    Desktop. I tried to set the source path as to include this folder but
    it doesn't seem to work. I don't really know how to use classpath. And
    I use the JCreator to write my Java programs.
     
    João Marques, Dec 11, 2008
    #14
  15. João Marques

    Lew Guest

    João Marques wrote:
    > I have downloaded the packages that I need and I have them in my
    > Desktop. I tried to set the source path as to include this folder but
    > it doesn't seem to work. I don't really know how to use classpath. And
    > I use the JCreator to write my Java programs.


    OK, stop.

    --
    Lew
     
    Lew, Dec 11, 2008
    #15
  16. On 11 dez, 02:37, Lew <> wrote:
    > João Marques wrote:
    > > I have downloaded the packages that I need and I have them in my
    > > Desktop. I tried to set the source path as to include this folder but
    > > it doesn't seem to work. I don't really know how to use classpath. And
    > > I use the JCreator to write my Java programs.

    >
    > No need to repeat yourself, the first three times made it through.
    >
    > --
    > Lew


    Sorry I dont know why it happened. I just sent it once. But everytime
    I refreshed another one would appear..i'll read through it then
     
    João Marques, Dec 11, 2008
    #16
  17. On 11 dez, 02:37, Lew <> wrote:
    > João Marques wrote:
    > > I have downloaded the packages that I need and I have them in my
    > > Desktop. I tried to set the source path as to include this folder but
    > > it doesn't seem to work. I don't really know how to use classpath. And
    > > I use the JCreator to write my Java programs.

    >
    > No need to repeat yourself, the first three times made it through.
    >
    > --
    > Lew


    Sorry I dont know why it happened. I just sent it once. But everytime
    I refreshed another one would appear..i'll read through it then
     
    João Marques, Dec 11, 2008
    #17
  18. João Marques

    Lew Guest

    João Marques wrote:
    > Sorry I dont know why it happened. I just sent it once. But everytime
    > I refreshed another one would appear..i'll read through it then


    Don't use Google Groups.

    If you must, don't use refresh. Obviously you are refreshing the screen from
    whence you sent your reply. Just click on one of the links provided by GG to
    navigate. Don't use refresh from the screen from which you submitted your reply.

    --
    Lew
     
    Lew, Dec 11, 2008
    #18
  19. João Marques

    Guest

    On Dec 10, 9:43 pm, Lew <> wrote:
    > João Marques wrote:
    > > Sorry I dont know why it happened. I just sent it once. But everytime
    > > I refreshed another one would appear..i'll read through it then

    >
    > Don't use Google Groups.
    >
    > If you must, don't use refresh.  Obviously you are refreshing the screen from
    > whence you sent your reply.  Just click on one of the links provided by GG to
    > navigate.  Don't use refresh from the screen from which you submitted your reply.
    >
    > --
    > Lew


    You need to learn
    - What a package is and how a class can be qualified with a package
    name (analogous to how a file belongs to a folder)
    - What classpath is (start with above provided links)
    - How to add jars to your project's classpath in your IDE or on the
    command line while compiling and executing.
    - What jars are already included implicitly in your project (from JRE)
    If you are working on Windows, open your jar using WinZip and see if
    your packages and classes are there to make sure you have correct jar
    files.
     
    , Dec 11, 2008
    #19
  20. João Marques

    Mark Space Guest

    João Marques wrote:

    > I have downloaded the packages that I need and I have them in my
    > Desktop. I tried to set the source path as to include this folder but
    > it doesn't seem to work. I don't really know how to use classpath. And
    > I use the JCreator to write my Java programs.


    I don't know JCreator. In NetBeans I can right-click on the Library
    folder of my project, pick Add Jar... and navigate to the JAR file I
    want to include in the project. Maybe you can do the same thing in
    JCretaor.

    If you're using an Ant build or similar script, we still need a path.
    The path to the Desktop varies for different user-names and versions of
    Windows and Unix. My Desktop is at:

    C:\Users\Brenden\Desktop

    Where is your's? And we'll still need the name of your JAR file.

    (And yes, please loose the refresh key.)
     
    Mark Space, Dec 11, 2008
    #20
    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. Silvere Martin-Michiellot

    Java Math packages

    Silvere Martin-Michiellot, Oct 5, 2003, in forum: Java
    Replies:
    3
    Views:
    787
    Randy Poe
    Oct 6, 2003
  2. Silvère Martin-Michiellot

    Java Math packages

    Silvère Martin-Michiellot, Oct 7, 2003, in forum: Java
    Replies:
    1
    Views:
    1,806
    alphah
    Jun 14, 2010
  3. Paul  Smith
    Replies:
    0
    Views:
    742
    Paul Smith
    Nov 18, 2003
  4. David Lyon
    Replies:
    19
    Views:
    596
    David Lyon
    Apr 24, 2009
  5. Ian
    Replies:
    3
    Views:
    177
Loading...

Share This Page