Java Compilation error using Eclipse

L

Louis

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
 
C

Chris Smith

Louis said:
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
 
M

Michiel Konstapel

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
 
L

Louis

Michiel Konstapel said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top