NetBeans and JCreator

Discussion in 'Java' started by SBC News, Feb 22, 2007.

  1. SBC News

    SBC News Guest

    Hello Guru,

    I'm new with Java and have a question regarding NetBeans and JCreator compatibility.

    I have a Window Application program that I wrote using JCreator Pro 4.0.
    The program is compiling and running fine in JCreator Pro 4.0.

    However, when I open the file in NetBeans, I don't have any way to compile/run the .java file.
    Is there a way that I can make the file works on both IDE environments?
    Or NetBeans just doesn't accept .java files that's not created using NetBeans?

    Thanks,
    PETER NGUYEN
    SBC News, Feb 22, 2007
    #1
    1. Advertising

  2. SBC News

    Lew Guest

    SBC News wrote:
    > Hello Guru,
    >
    > I'm new with Java and have a question regarding NetBeans and JCreator
    > compatibility.
    >
    > I have a Window Application program that I wrote using JCreator Pro 4.0.
    > The program is compiling and running fine in JCreator Pro 4.0.
    >
    > However, when I open the file in NetBeans, I don't have any way to
    > compile/run the .java file.
    > Is there a way that I can make the file works on both IDE environments?
    > Or NetBeans just doesn't accept .java files that's not created using
    > NetBeans?
    >
    > Thanks,
    > PETER NGUYEN


    Please post plain-text messages, not HTML, to newsgroups.

    - Lew
    Lew, Feb 23, 2007
    #2
    1. Advertising

  3. SBC News

    Lew Guest

    SBC News wrote:
    >> I'm new with Java and have a question regarding NetBeans and JCreator
    >> compatibility.
    >>
    >> I have a Window Application program that I wrote using JCreator Pro 4.0.
    >> The program is compiling and running fine in JCreator Pro 4.0.
    >>
    >> However, when I open the file in NetBeans, I don't have any way to
    >> compile/run the .java file.
    >> Is there a way that I can make the file works on both IDE environments?
    >> Or NetBeans just doesn't accept .java files that's not created using
    >> NetBeans?


    NetBeans generally does not have trouble with .java files that come from
    "outside" its environment. What error(s) do you get when you try to compile or
    run your program?

    Java is a very portable language, and programs written in one environment will
    work in the same revision level of Java pretty much anywhere (matters like JNI
    excepted). They also mostly work in later versions than where they originated.
    So if your program won't compile or run, there is a specific problem not
    related to whether "NetBeans just doesn't accept .java files", because it does.

    It is hard to give good advice without specific information.

    - Lew
    Lew, Feb 23, 2007
    #3
  4. On Feb 23, 9:29 am, "SBC News" <> wrote:
    ...
    > I'm new with Java and have a question
    > regarding NetBeans and JCreator compatibility.


    Lew made some good points. In addition
    to those, I will simply add that since
    JCreator seems to offer Ant support,
    making an Ant based JCreator project
    might be a good way to make code portable
    between JCreator, NetBeans, Eclipse..
    and even environments where people use
    'TextPad and Ant'.

    Andrew T.
    Andrew Thompson, Feb 23, 2007
    #4
  5. SBC News

    SBC News Guest

    Thanks Lew,

    There is no error.
    It just simple does not give me the option to compile or run the .java file.
    All of the compile and run command are grayed out.

    I can run the .class file (compiled with JCreator) from command line fine.
    I just want to make sure if I send the source code to my friend who uses
    NetBeans and he can compile/run my .java code.

    Thanks,
    PETER NGUYEN

    "Lew" <> wrote in message
    news:...
    > SBC News wrote:
    >>> I'm new with Java and have a question regarding NetBeans and JCreator
    >>> compatibility.
    >>> I have a Window Application program that I wrote using JCreator Pro
    >>> 4.0.
    >>> The program is compiling and running fine in JCreator Pro 4.0.
    >>> However, when I open the file in NetBeans, I don't have any way to
    >>> compile/run the .java file.
    >>> Is there a way that I can make the file works on both IDE environments?
    >>> Or NetBeans just doesn't accept .java files that's not created using
    >>> NetBeans?

    >
    > NetBeans generally does not have trouble with .java files that come from
    > "outside" its environment. What error(s) do you get when you try to
    > compile or run your program?
    >
    > Java is a very portable language, and programs written in one environment
    > will work in the same revision level of Java pretty much anywhere (matters
    > like JNI excepted). They also mostly work in later versions than where
    > they originated. So if your program won't compile or run, there is a
    > specific problem not related to whether "NetBeans just doesn't accept
    > .java files", because it does.
    >
    > It is hard to give good advice without specific information.
    >
    > - Lew
    SBC News, Feb 23, 2007
    #5
  6. SBC News

    David Segall Guest

    "SBC News" <> wrote:

    >Hello Guru,
    >
    >I'm new with Java and have a question regarding NetBeans and JCreator compatibility.
    >
    >I have a Window Application program that I wrote using JCreator Pro 4.0.
    >The program is compiling and running fine in JCreator Pro 4.0.
    >
    >However, when I open the file in NetBeans, I don't have any way to compile/run the .java file.
    >Is there a way that I can make the file works on both IDE environments?
    >Or NetBeans just doesn't accept .java files that's not created using NetBeans?

    Netbeans can be used with Java files from any source but it likes to
    arrange the directories in a "project" and write an Ant script to
    control the project. You can compile and run individual files in a
    project but you would normally compile and run the project.

    Did you use the Wizard from the "New Project" menu to start a
    "General" "Java Project with Existing Sources"? The items in quotes in
    the previous sentence are from the menus and tabs you need to use. If
    you successfully filled in the fields the Wizard asked you for, what
    happened when you tried to run the project?
    David Segall, Feb 23, 2007
    #6
  7. SBC News

    Lew Guest

    SBC News wrote:
    > Thanks Lew,


    Please do not top post.

    > There is no error.
    > It just simple does not give me the option to compile or run the .java file.
    > All of the compile and run command are grayed out.
    >
    > I can run the .class file (compiled with JCreator) from command line fine.
    > I just want to make sure if I send the source code to my friend who uses
    > NetBeans and he can compile/run my .java code.


    You probably need to set up a project for Netbeans to know the class path to
    the .java file, and where to put the compiled bytecode.

    I have a project in my Netbeans set up for all kinds of "misc"ellaneous java
    files. When I want to run a single class, I stick it in a package within that
    project.

    Don't forget that any Java compiler or execution has to be aware of the
    package structure. Avoid use of the default package.

    - Lew
    Lew, Feb 23, 2007
    #7
  8. SBC News

    SBC News Guest

    Hello David and All,

    No, what I did was in NetBeans' File -> Open File and select my .java file.
    It opened the file but all of the Compile/Run icons/options are grayed out.

    However, since the post, I did try to create empty project in NetBeans;
    then, copied the content of my .java file and pasted in the new project file
    and it compiled/ran o.k.

    I'm O.K. now in a sense that I can work around, but still want to know why
    NetBeans behaved like this, though. I'm hoping you or someone that have more
    experiences in this field can point out the obvious. If not, I have to do it
    this way in the future.

    Thank you all for your responses!
    PETER NGUYEN


    "David Segall" <> wrote in message
    news:...
    > "SBC News" <> wrote:
    >
    >>Hello Guru,
    >>
    >>I'm new with Java and have a question regarding NetBeans and JCreator
    >>compatibility.
    >>
    >>I have a Window Application program that I wrote using JCreator Pro 4.0.
    >>The program is compiling and running fine in JCreator Pro 4.0.
    >>
    >>However, when I open the file in NetBeans, I don't have any way to
    >>compile/run the .java file.
    >>Is there a way that I can make the file works on both IDE environments?
    >>Or NetBeans just doesn't accept .java files that's not created using
    >>NetBeans?

    > Netbeans can be used with Java files from any source but it likes to
    > arrange the directories in a "project" and write an Ant script to
    > control the project. You can compile and run individual files in a
    > project but you would normally compile and run the project.
    >
    > Did you use the Wizard from the "New Project" menu to start a
    > "General" "Java Project with Existing Sources"? The items in quotes in
    > the previous sentence are from the menus and tabs you need to use. If
    > you successfully filled in the fields the Wizard asked you for, what
    > happened when you tried to run the project?
    SBC News, Feb 24, 2007
    #8
  9. SBC News

    SBC News Guest

    Hello Lew,

    That is interesting.
    I've been using 'default package' sine I thought it default to NetBeans.
    So what you're saying is when I create a new project in NetBeans, I should
    give it a package name, so it does not create .java file in the 'default
    package', right?

    --
    PETER NGUYEN
    "Lew" <> wrote in message
    news:...
    > SBC News wrote:
    >> Thanks Lew,

    >
    > Please do not top post.
    >
    >> There is no error.
    >> It just simple does not give me the option to compile or run the .java
    >> file.
    >> All of the compile and run command are grayed out.
    >>
    >> I can run the .class file (compiled with JCreator) from command line
    >> fine.
    >> I just want to make sure if I send the source code to my friend who uses
    >> NetBeans and he can compile/run my .java code.

    >
    > You probably need to set up a project for Netbeans to know the class path
    > to the .java file, and where to put the compiled bytecode.
    >
    > I have a project in my Netbeans set up for all kinds of "misc"ellaneous
    > java files. When I want to run a single class, I stick it in a package
    > within that project.
    >
    > Don't forget that any Java compiler or execution has to be aware of the
    > package structure. Avoid use of the default package.
    >
    > - Lew
    SBC News, Feb 24, 2007
    #9
  10. Andrew Thompson, Feb 24, 2007
    #10
  11. SBC News

    Lew Guest

    "SBC News" wrote:
    > I've been using 'default package' sine I thought it default to NetBeans.
    > So what you're saying is when I create a new project in NetBeans, I should
    > give it a package name, so it does not create .java file in the 'default
    > package', right?


    Not really.

    First of all, the "default package" is a /Java/ concept, not Netbeans. It
    means a class that is not part of any package. It is for quick and dirty "toy"
    classes, not for real work.

    Second of all, "it" does not create .java files, /you/ create .java files.
    Those are the source files that the programmer writes. The javac compiler
    program then creates .class files from those.

    Third of all, you don't "give [a project] a package name", you put individual
    classes in packages. Packages organize and provide structure to groups of
    classes, and have important consequences to method and instance variable
    visibility. Consider, for example, the notion of "package-private", or
    "default" access.

    Fourth of all, these are fundamental notions to Java programming, and are a
    little confusing because they relate to the directory structure where the
    ..java and .class files reside. It will give you large dividends to study the
    Sun Java tutorial on the notions of classes and packages.

    - Lew
    Lew, Feb 24, 2007
    #11
  12. SBC News

    Lew Guest

    SBC News wrote:
    > what I did was in NetBeans' File -> Open File and select my .java file.
    > It opened the file but all of the Compile/Run icons/options are grayed out.
    >
    > However, since the post, I did try to create empty project in NetBeans;
    > then, copied the content of my .java file and pasted in the new project file
    > and it compiled/ran o.k.
    >
    > I'm O.K. now in a sense that I can work around, but still want to know why
    > NetBeans behaved like this, though. I'm hoping you or someone that have more
    > experiences in this field can point out the obvious. If not, I have to do it
    > this way in the future.


    It was mentioned that Netbeans, indeed any Java compiler and executor, needs
    to know the classpath to compile and run a file. When you just open a file in
    Netbeans, you do not tell it any of that information. When you set up a
    project, that process tells Netbeans where the Java resources are.

    (See David Segall's response, for example.)

    A: Because it makes posts so dang hard to read.


    Q: Why is it bad?


    A: Placing answers above the questions you're answering, like this.


    Q: What is top posting?


    Please do not top post.

    Note that you were given a link about the term, and GIYF, and Wikipedia has
    just about everything in it.

    - Lew
    Lew, Feb 24, 2007
    #12
    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. Guy Van Rinsveld
    Replies:
    0
    Views:
    736
    Guy Van Rinsveld
    Aug 3, 2003
  2. terry
    Replies:
    0
    Views:
    599
    terry
    Sep 14, 2003
  3. Thanasis \(sch\)

    JCreator too slow

    Thanasis \(sch\), Jan 30, 2004, in forum: Java
    Replies:
    3
    Views:
    788
    Thanasis \(sch\)
    Jan 30, 2004
  4. Jeremy Watts

    jcreator IDE

    Jeremy Watts, Sep 8, 2004, in forum: Java
    Replies:
    4
    Views:
    971
    Andrew Thompson
    Sep 9, 2004
  5. Michael B. Williams

    java.util.Formatter and JCreator

    Michael B. Williams, Oct 21, 2004, in forum: Java
    Replies:
    6
    Views:
    816
    Thomas Weidenfeller
    Oct 22, 2004
Loading...

Share This Page