Home » Language IDEs » Java Development Tools (JDT) » Building (Compiling) .java files in eclipse
Building (Compiling) .java files in eclipse [message #71970] |
Wed, 02 July 2003 18:16  |
Eclipse User |
|
|
|
Originally posted by: umdougmm.hotmail.com
Ok. so I spend the last day trying to figure out, in particular, one
thing about Eclipse...how do I simply compile code. I'm coming from a
JB8 EE environment (@ work), and at home I got a hold of eclipse...looks
good, and is a LOT faster, but I can't seem to find the equivalent of
Make, make clean, and run in JBuilder? I know, I should look through
the archives perhaps more thuroughly, but I have spent the last day
browsing these, and since all the groups are password protected, can't
use google to make your life easier. So, the question is, if I have a
java project open, how do I compile it (javac), and then run it(java)?
Does anyone know a document for me to read? The exact problem is as
follows (heck I think I also read on the newsgroup that eclipse provides
its own java compiler?!? - if so, why the need for sun's sdk?):
Any new project I create can simply be compiled by pressing the 'run'
button, which takes you to the 'Createm manager, run configurations'
menu. I fill it out and click 'Run', and voila..it runs. However, if I
manually delete all .class files and ask the project to run again, it
comes back with the obvious "NoClassDefFoundError". It's trying to run
it, without compiling it..
Also, am I understanding this right...core functionality (such as
running) is present in JDT plugins for Eclipse? I'm a little baffled by
this.
And lastly, and on a less serious note, my WINDOW>PREFERENCES>JAVA>CLASS
PATH VARIABLES JRE_LIB env variable is pointing to the wrong
installation of the sdk even though my WINDOW>PREFERENCES>JAVA>INSTALLED
JREs is ONLY pointing to the correct installation? The package explorer
JRE System Library node also points to the wrong installation! How can
I change this?
Any help appreciated
Doug
|
|
| |
Re: Building (Compiling) .java files in eclipse [message #72064 is a reply to message #71989] |
Wed, 02 July 2003 18:40   |
Eclipse User |
|
|
|
Originally posted by: umdougmm.hotmail.com
Randy Faust wrote:
> FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html
>
> How do I compile my Java program?
> Eclipse has an incremental compiler which compiles every time you save a
> Java file. You will see this feature referred to as "autobuild"
>
> See Window->Preferences->Workbench->Perform build automatically on resource
> modification.
>
I turned this off, don't like when something is happening in the
background without me knowing it. I'd much rather prefer to be able to
choose the action.
> With autobuild turned off, you can press the "Build" button (that appears on
> the toolbar) to compile your Java files. The "Build" action will appear on
> various other menus as well (for example, on the popups in the Navigator and
> Packages views).
Yes, I tried this, a window comes up and quickly dissappears. It says
"Building" or something to that respect, but no *.class files are
created in my output directory. (PS. I only have "Build All" or "Build
Project")
>
> **
>
> Eclipse has uses its own built in incremental compiler.
>
>
>
>>And lastly, and on a less serious note, my WINDOW>PREFERENCES>JAVA>CLASS
>>PATH VARIABLES JRE_LIB env variable is pointing to the wrong
>>installation of the sdk even though my WINDOW>PREFERENCES>JAVA>INSTALLED
>>JREs is ONLY pointing to the correct installation?
>
>
> Windows->preferences->java. Change the JRE you're using.
>
As I stated above, I did this, and I also deleted from the settings the
old java installation so that eclipse wouldn't see it anymore...it still
obviously can though..
Doug
>
>
> Randy
>
>
|
|
|
Re: Building (Compiling) .java files in eclipse [message #72242 is a reply to message #72064] |
Thu, 03 July 2003 10:37   |
Eclipse User |
|
|
|
Originally posted by: eric.rizzo.jibeinc.com
Doug wrote:
> Randy Faust wrote:
>
>> FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html
>>
>> How do I compile my Java program?
>> Eclipse has an incremental compiler which compiles every time you save a
>> Java file. You will see this feature referred to as "autobuild"
>>
>> See Window->Preferences->Workbench->Perform build automatically on
>> resource
>> modification.
>>
> I turned this off, don't like when something is happening in the
> background without me knowing it. I'd much rather prefer to be able to
> choose the action.
But you *do* know about it - it compiles (including dependent classes)
each time you save code. There is no mystery here. To be honest, if you
turn that feature off you are really not using Eclipse in its natural
environment - and you'll be missing out on quite a bit of the advantages
it offers.
Manually building works, but it is not nearly as slick and useful.
>> With autobuild turned off, you can press the "Build" button (that
>> appears on
>> the toolbar) to compile your Java files. The "Build" action will
>> appear on
>> various other menus as well (for example, on the popups in the
>> Navigator and
>> Packages views).
>
> Yes, I tried this, a window comes up and quickly dissappears. It says
> "Building" or something to that respect, but no *.class files are
> created in my output directory. (PS. I only have "Build All" or "Build
> Project")
Have you set the build classpath for the Project? I would think you
have, but...
Also, try selecting the Project, then from the menu bar choose Project >
Rebuild Project. What, if anything, is showing in your Tasks list?
BTW, why would you want to manually delete all .class files in your
output dir? Eclipse will insure that all dependencies are maintained
correctly and everything is compiled up-to-date. You can also use Ant to
manage when to clear a build output location, if you want to go that route.
It really sounds as if you're trying too hard to make Eclipse work like
JB - I suggest letting go of those old habits and give the Eclipse way
of doing things a try for a few days.
>>> And lastly, and on a less serious note, my WINDOW>PREFERENCES>JAVA>CLASS
>>> PATH VARIABLES JRE_LIB env variable is pointing to the wrong
>>> installation of the sdk even though my WINDOW>PREFERENCES>JAVA>INSTALLED
>>> JREs is ONLY pointing to the correct installation?
The JRE_LIB variable is tied to whichever of your Installed JRE's is
selected as the default. Go to Preferences > Java > Installed JREs and
change the check-box to be the one you want. Then OK the Preferences
window. Open it again and your JRE_LIB variable should be updated.
HTH,
Eric
--
Eric Rizzo
Software Architect
Jibe, Inc.
http://www.jibeinc.com
|
|
|
Re: Building (Compiling) .java files in eclipse [message #72294 is a reply to message #72242] |
Thu, 03 July 2003 10:54   |
Eclipse User |
|
|
|
Are you looking for the .class files in the Java Perspective? If so, you
won't see them, as the view filter them out. Try looking via the resource
perspective or directly in the file system...
Another possibility is that you don't have source folders set properly for
your project (or it's not a Java project).
-- Scott
"Eric Rizzo" <eric.rizzo@jibeinc.com> wrote in message
news:be1epj$obm$1@rogue.oti.com...
> Doug wrote:
> > Randy Faust wrote:
> >
> >> FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html
> >>
> >> How do I compile my Java program?
> >> Eclipse has an incremental compiler which compiles every time you save
a
> >> Java file. You will see this feature referred to as "autobuild"
> >>
> >> See Window->Preferences->Workbench->Perform build automatically on
> >> resource
> >> modification.
> >>
> > I turned this off, don't like when something is happening in the
> > background without me knowing it. I'd much rather prefer to be able to
> > choose the action.
>
> But you *do* know about it - it compiles (including dependent classes)
> each time you save code. There is no mystery here. To be honest, if you
> turn that feature off you are really not using Eclipse in its natural
> environment - and you'll be missing out on quite a bit of the advantages
> it offers.
> Manually building works, but it is not nearly as slick and useful.
>
>
> >> With autobuild turned off, you can press the "Build" button (that
> >> appears on
> >> the toolbar) to compile your Java files. The "Build" action will
> >> appear on
> >> various other menus as well (for example, on the popups in the
> >> Navigator and
> >> Packages views).
> >
> > Yes, I tried this, a window comes up and quickly dissappears. It says
> > "Building" or something to that respect, but no *.class files are
> > created in my output directory. (PS. I only have "Build All" or "Build
> > Project")
>
> Have you set the build classpath for the Project? I would think you
> have, but...
> Also, try selecting the Project, then from the menu bar choose Project >
> Rebuild Project. What, if anything, is showing in your Tasks list?
>
> BTW, why would you want to manually delete all .class files in your
> output dir? Eclipse will insure that all dependencies are maintained
> correctly and everything is compiled up-to-date. You can also use Ant to
> manage when to clear a build output location, if you want to go that
route.
> It really sounds as if you're trying too hard to make Eclipse work like
> JB - I suggest letting go of those old habits and give the Eclipse way
> of doing things a try for a few days.
>
> >>> And lastly, and on a less serious note, my
WINDOW>PREFERENCES>JAVA>CLASS
> >>> PATH VARIABLES JRE_LIB env variable is pointing to the wrong
> >>> installation of the sdk even though my
WINDOW>PREFERENCES>JAVA>INSTALLED
> >>> JREs is ONLY pointing to the correct installation?
>
> The JRE_LIB variable is tied to whichever of your Installed JRE's is
> selected as the default. Go to Preferences > Java > Installed JREs and
> change the check-box to be the one you want. Then OK the Preferences
> window. Open it again and your JRE_LIB variable should be updated.
>
> HTH,
> Eric
> --
> Eric Rizzo
> Software Architect
> Jibe, Inc.
> http://www.jibeinc.com
>
|
|
|
Re: Building (Compiling) .java files in eclipse [message #72363 is a reply to message #71970] |
Thu, 03 July 2003 11:17   |
Eclipse User |
|
|
|
Originally posted by: dcorbin.imperitek.com
Doug wrote:
> Ok. so I spend the last day trying to figure out, in particular, one
> thing about Eclipse...how do I simply compile code. I'm coming from a
> JB8 EE environment (@ work), and at home I got a hold of eclipse...looks
> good, and is a LOT faster, but I can't seem to find the equivalent of
> Make, make clean, and run in JBuilder? I know, I should look through
> the archives perhaps more thuroughly, but I have spent the last day
> browsing these, and since all the groups are password protected, can't
> use google to make your life easier. So, the question is, if I have a
> java project open, how do I compile it (javac), and then run it(java)?
> Does anyone know a document for me to read? The exact problem is as
> follows (heck I think I also read on the newsgroup that eclipse provides
> its own java compiler?!? - if so, why the need for sun's sdk?):
>
> Any new project I create can simply be compiled by pressing the 'run'
> button, which takes you to the 'Createm manager, run configurations'
> menu. I fill it out and click 'Run', and voila..it runs. However, if I
> manually delete all .class files and ask the project to run again, it
> comes back with the obvious "NoClassDefFoundError". It's trying to run
> it, without compiling it..
>
> Also, am I understanding this right...core functionality (such as
> running) is present in JDT plugins for Eclipse? I'm a little baffled by
> this.
>
> And lastly, and on a less serious note, my WINDOW>PREFERENCES>JAVA>CLASS
> PATH VARIABLES JRE_LIB env variable is pointing to the wrong
> installation of the sdk even though my WINDOW>PREFERENCES>JAVA>INSTALLED
> JREs is ONLY pointing to the correct installation? The package explorer
> JRE System Library node also points to the wrong installation! How can
> I change this?
>
> Any help appreciated
> Doug
>
First, I agree with Eric Rizzo's comments that you should learn to use
Eclispe as it was designed to be used.
Secondly, Eclispe caches lots of information about files on your file
system. Anytime you change something about your filesystem (that's in
your workspace) from outside eclipse, you need to Refresh. You deleted
the .class files, but eclipse could not tell that because you didn't
refresh.
David
|
|
|
Re: Building (Compiling) .java files in eclipse [message #72596 is a reply to message #72294] |
Thu, 03 July 2003 20:11   |
Eclipse User |
|
|
|
Originally posted by: umdougmm.hotmail.com
No, I'm looking for .class files in the shell window...however, I got
it, Eric suggested to REbuild the project instead of just building all,
and that's what seems to be needed. Build all does nothing if you
delete the class files (for some reason).
Doug
Scott Stanchfield wrote:
> Are you looking for the .class files in the Java Perspective? If so, you
> won't see them, as the view filter them out. Try looking via the resource
> perspective or directly in the file system...
>
> Another possibility is that you don't have source folders set properly for
> your project (or it's not a Java project).
> -- Scott
>
> "Eric Rizzo" <eric.rizzo@jibeinc.com> wrote in message
> news:be1epj$obm$1@rogue.oti.com...
>
>>Doug wrote:
>>
>>>Randy Faust wrote:
>>>
>>>
>>>>FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html
>>>>
>>>>How do I compile my Java program?
>>>>Eclipse has an incremental compiler which compiles every time you save
>
> a
>
>>>>Java file. You will see this feature referred to as "autobuild"
>>>>
>>>>See Window->Preferences->Workbench->Perform build automatically on
>>>>resource
>>>>modification.
>>>>
>>>
>>>I turned this off, don't like when something is happening in the
>>>background without me knowing it. I'd much rather prefer to be able to
>>>choose the action.
>>
>>But you *do* know about it - it compiles (including dependent classes)
>>each time you save code. There is no mystery here. To be honest, if you
>>turn that feature off you are really not using Eclipse in its natural
>>environment - and you'll be missing out on quite a bit of the advantages
>>it offers.
>>Manually building works, but it is not nearly as slick and useful.
>>
>>
>>
>>>>With autobuild turned off, you can press the "Build" button (that
>>>>appears on
>>>>the toolbar) to compile your Java files. The "Build" action will
>>>>appear on
>>>>various other menus as well (for example, on the popups in the
>>>>Navigator and
>>>>Packages views).
>>>
>>>Yes, I tried this, a window comes up and quickly dissappears. It says
>>>"Building" or something to that respect, but no *.class files are
>>>created in my output directory. (PS. I only have "Build All" or "Build
>>>Project")
>>
>>Have you set the build classpath for the Project? I would think you
>>have, but...
>>Also, try selecting the Project, then from the menu bar choose Project >
>>Rebuild Project. What, if anything, is showing in your Tasks list?
>>
>>BTW, why would you want to manually delete all .class files in your
>>output dir? Eclipse will insure that all dependencies are maintained
>>correctly and everything is compiled up-to-date. You can also use Ant to
>>manage when to clear a build output location, if you want to go that
>
> route.
>
>>It really sounds as if you're trying too hard to make Eclipse work like
>>JB - I suggest letting go of those old habits and give the Eclipse way
>>of doing things a try for a few days.
>>
>>
>>>>>And lastly, and on a less serious note, my
>
> WINDOW>PREFERENCES>JAVA>CLASS
>
>>>>>PATH VARIABLES JRE_LIB env variable is pointing to the wrong
>>>>>installation of the sdk even though my
>
> WINDOW>PREFERENCES>JAVA>INSTALLED
>
>>>>>JREs is ONLY pointing to the correct installation?
>>
>>The JRE_LIB variable is tied to whichever of your Installed JRE's is
>>selected as the default. Go to Preferences > Java > Installed JREs and
>>change the check-box to be the one you want. Then OK the Preferences
>>window. Open it again and your JRE_LIB variable should be updated.
>>
>>HTH,
>>Eric
>>--
>>Eric Rizzo
>>Software Architect
>>Jibe, Inc.
>>http://www.jibeinc.com
>>
>
>
>
|
|
|
Re: Building (Compiling) .java files in eclipse [message #72612 is a reply to message #72242] |
Thu, 03 July 2003 20:21   |
Eclipse User |
|
|
|
Originally posted by: umdougmm.hotmail.com
Eric Rizzo wrote:
> Doug wrote:
>
>> Randy Faust wrote:
>>
>>> FAQ: http://www.eclipse.org/eclipse/faq/eclipse-faq.html
>>>
>>> How do I compile my Java program?
>>> Eclipse has an incremental compiler which compiles every time you save a
>>> Java file. You will see this feature referred to as "autobuild"
>>>
>>> See Window->Preferences->Workbench->Perform build automatically on
>>> resource
>>> modification.
>>>
>> I turned this off, don't like when something is happening in the
>> background without me knowing it. I'd much rather prefer to be able
>> to choose the action.
>
>
> But you *do* know about it - it compiles (including dependent classes)
> each time you save code. There is no mystery here. To be honest, if you
> turn that feature off you are really not using Eclipse in its natural
> environment - and you'll be missing out on quite a bit of the advantages
> it offers.
> Manually building works, but it is not nearly as slick and useful.
Oh, I do know about it, it just seems kind of like an extra layer of
complixity that is bound to cause headaches...then again, I am coming
from the JB world...hmm
>
>
>>> With autobuild turned off, you can press the "Build" button (that
>>> appears on
>>> the toolbar) to compile your Java files. The "Build" action will
>>> appear on
>>> various other menus as well (for example, on the popups in the
>>> Navigator and
>>> Packages views).
>>
>>
>> Yes, I tried this, a window comes up and quickly dissappears. It says
>> "Building" or something to that respect, but no *.class files are
>> created in my output directory. (PS. I only have "Build All" or "Build
>> Project")
>
>
> Have you set the build classpath for the Project? I would think you
> have, but...
> Also, try selecting the Project, then from the menu bar choose Project >
> Rebuild Project. What, if anything, is showing in your Tasks list?
Bingo Eric..many thanx. It seems (as already mentioned) that Build All
does nothing if you manually remove .class files using the shell...even
if you Refresh the project. It seems that you HAVE to REbuild Project.
Too bad you can't place the rebuild button on the toolbar menu. And
seeing how we are on the subject, is there a 'make clean' (an action
which would cause all the *.class files to be deleted before compiling
the project) option in eclipse?
>
> BTW, why would you want to manually delete all .class files in your
> output dir? Eclipse will insure that all dependencies are maintained
> correctly and everything is compiled up-to-date. You can also use Ant to
> manage when to clear a build output location, if you want to go that route.
> It really sounds as if you're trying too hard to make Eclipse work like
> JB - I suggest letting go of those old habits and give the Eclipse way
> of doing things a try for a few days.
>
>>>> And lastly, and on a less serious note, my
>>>> WINDOW>PREFERENCES>JAVA>CLASS
>>>> PATH VARIABLES JRE_LIB env variable is pointing to the wrong
>>>> installation of the sdk even though my
>>>> WINDOW>PREFERENCES>JAVA>INSTALLED
>>>> JREs is ONLY pointing to the correct installation?
>
>
> The JRE_LIB variable is tied to whichever of your Installed JRE's is
> selected as the default. Go to Preferences > Java > Installed JREs and
> change the check-box to be the one you want. Then OK the Preferences
> window. Open it again and your JRE_LIB variable should be updated.
>
This is the first thing I tried, and after I did that (checked the
appropriate installation of Java) I removed from Eclipse the other
possibility..so now only one exists. After doing this, I checked
whether the WINDOW>PREFERENCES>CLASSPATH VARIABLES were updated: one was
, the JRE_SRC was updated, but the JRE_LIB was not. Now, I must admit
that both the version I have are the same thing, except that one points
to to the other via a symbolically linked directory. It is to this
linked directory I wanted to point eclipse to so that updating Java
sdk's wouldn't require updating eclipse settings.
> HTH,
> Eric
Doug
|
|
|
Re: Building (Compiling) .java files in eclipse [message #72810 is a reply to message #72612] |
Fri, 04 July 2003 04:36  |
Eclipse User |
|
|
|
Originally posted by: faust.acm.org
> Oh, I do know about it, it just seems kind of like an extra layer of
> complixity that is bound to cause headaches...then again, I am coming
> from the JB world...hmm
More likely it removes an extra layer of complexity.
> Too bad you can't place the rebuild button on the toolbar menu. And
> seeing how we are on the subject, is there a 'make clean' (an action
> which would cause all the *.class files to be deleted before compiling
> the project) option in eclipse?
"Rebuild all" should delete all your class files and then compile them. I've
never thought of it as a 'make clean' though. Hmmm.....
Randy
|
|
|
Goto Forum:
Current Time: Sat Jul 19 02:38:36 EDT 2025
Powered by FUDForum. Page generated in 0.03843 seconds
|