Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java Compilation error using Eclipse

Reply
Thread Tools

Java Compilation error using Eclipse

 
 
Louis
Guest
Posts: n/a
 
      04-06-2004
Hello,
I am not a very skilled java programmer, in fact this is the first big
java project I am compiling. It contains several .java file and a .jar
library. I was able to compile the project with netBeans, opening the
main .java file and doing a compile while the library is loaded
correctly. But have never been able to run the applet with
netbeans.(yeah BTW it s a java applet) So I wanted to try with
eclipse, which seemed more appropriate since you can add different
modules to it, with one particular i want to try for the performance
analysis and such (hyades..).

So here i go, I opened a new project. After many tries on different
project building/settings options, I still cannot find the right
options. The .java source file are in a subdirectory, like
project/ver5/mdl/java/Prog/...
and the library file is in project/ver5/...
So with the best to perfect config, the errors I am getting now are
all about one package:
(Desc: The declared package does not match the expected package
IN folder : project/mdl/java/Prog )

Do i need to specify the source in a different way? there seems to be
confusion finding the packages... =(

Being a noob java programmer i dont know what info I should add.. so I
hope someone can help me, I ve been stuck on this for a few days
already!!!!!

Thanks a bunch!

Louis
 
Reply With Quote
 
 
 
 
Chris Smith
Guest
Posts: n/a
 
      04-06-2004
Louis wrote:
> So here i go, I opened a new project. After many tries on different
> project building/settings options, I still cannot find the right
> options. The .java source file are in a subdirectory, like
> project/ver5/mdl/java/Prog/...
> and the library file is in project/ver5/...
> So with the best to perfect config, the errors I am getting now are
> all about one package:
> (Desc: The declared package does not match the expected package
> IN folder : project/mdl/java/Prog )


What is the 'package' declaration for a source file (any file) in the
project/ver5/mdl/java/Prog directory? Or, if there isn't one, tell us
that, too.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
 
Michiel Konstapel
Guest
Posts: n/a
 
      04-06-2004
> So here i go, I opened a new project. After many tries on different
> project building/settings options, I still cannot find the right
> options. The .java source file are in a subdirectory, like
> project/ver5/mdl/java/Prog/...
> and the library file is in project/ver5/...
> So with the best to perfect config, the errors I am getting now are
> all about one package:
> (Desc: The declared package does not match the expected package
> IN folder : project/mdl/java/Prog )
>
> Do i need to specify the source in a different way? there seems to be
> confusion finding the packages... =(
>
> Being a noob java programmer i dont know what info I should add.. so I
> hope someone can help me, I ve been stuck on this for a few days
> already!!!!!
>

By default, Eclipse takes the project root directory as a source folder.
So, subdirectories are seen as package elements, making it think your code
is in a package project.mdl.java.Prog. This doesn't match the package
declared *inside* the source file (presumably, your code is in the default
package - no package declaration at all). Right click the project folder,
open its properties and tell Eclipse the correct directory to use as the
source folder. Under Java Build Path, you can specify which libraries your
code needs.
HTH,
Michiel
 
Reply With Quote
 
Louis
Guest
Posts: n/a
 
      04-07-2004
Michiel Konstapel <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> > So here i go, I opened a new project. After many tries on different
> > project building/settings options, I still cannot find the right
> > options. The .java source file are in a subdirectory, like
> > project/ver5/mdl/java/Prog/...
> > and the library file is in project/ver5/...
> > So with the best to perfect config, the errors I am getting now are
> > all about one package:
> > (Desc: The declared package does not match the expected package
> > IN folder : project/mdl/java/Prog )
> >
> > Do i need to specify the source in a different way? there seems to be
> > confusion finding the packages... =(
> >
> > Being a noob java programmer i dont know what info I should add.. so I
> > hope someone can help me, I ve been stuck on this for a few days
> > already!!!!!
> >

> By default, Eclipse takes the project root directory as a source folder.
> So, subdirectories are seen as package elements, making it think your code
> is in a package project.mdl.java.Prog. This doesn't match the package
> declared *inside* the source file (presumably, your code is in the default
> package - no package declaration at all). Right click the project folder,
> open its properties and tell Eclipse the correct directory to use as the
> source folder. Under Java Build Path, you can specify which libraries your
> code needs.
> HTH,
> Michiel



I have been able to get no error message while compiling the
project(only tons of warnings)... I see the package in the file tree
(mdl.java.Welding2) but Eclipse doesnt seems to recognise it when I
want to run the applet. When i go to Run... -> appelt -> new config.
Eclipse doesnt find the applet class which should be
(mdl.java.Welding2) ...
what could be wrong now...?

thanks again for your help!
Louis
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate WSDL in eclipse using Eclipse Web tools project Veerle Java 0 03-13-2009 02:09 PM
Compilation error with seperate compilation C__chp C++ 4 02-15-2008 03:57 PM
Eclipse Plugin: how to modify perl build path from an eclipse Plugin java class eser@libero.it Java 1 09-07-2007 09:45 PM
[compilation error] debugging this error message "Object() in java.lang.Object cannot be applied to" Gavin Java 3 03-28-2007 05:57 AM
Eclipse/Lomboz/JBoss: Cannot Start JBoss (Debug) Server from Eclipse Using Lomboz Plugin Jubz Java 0 05-30-2006 10:24 PM



Advertisments