[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can I import a directory/sub-directory of a java application into eclipse?

Posted on 2012-03-15
12
Medium Priority
?
538 Views
Last Modified: 2012-03-20
The application is made of packages/sub-packages. I have tried multiple time but with no success. each time I get an error (like "the selection cannot be launched" OR "The declared package does not match the expected package").

What I want is to be able to modify the application and run it from eclipse.

Your help is appreciated.
0
Comment
Question by:Lamiaaa
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 37725801
why don't you include the existing class files as a jar file and use them that way?
0
 

Author Comment

by:Lamiaaa
ID: 37726044
Sorry, but I am relatively new to java/eclipse.

I want to "modify" not only "use" the classes, would that still be possible?
If yes, can you please give me the steps that I should follow?
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37726068
Does your jar file(s) conatin only classes or also source java codes ?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 47

Expert Comment

by:for_yan
ID: 37726082
If you have java source code files  you can importa them into Eclipse project , modify, compile and run in Eclipse. If you have classfiles they are not supposed to be edited, then can only be executed. You can decompile them to java code and then work with the source - but that is normally not advisable way
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 37726147
Unless you create those packages in your source folder of eclipse project, you cannot modify the source code.

If you want to use their functionalities and add some new ones, then inherit those classes and override those methods which you want to modify and add those methods which were not available earlier
0
 

Author Comment

by:Lamiaaa
ID: 37726213
Thanks guys..

It does contain java source code files and I did try to import them many times. However, each time I got an error like: "the selection cannot be launched" OR "The declared package does not match the expected package".

How can I make sure they are imported properly?
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37726277
press ctrl + shift + O------> eclispe automatically import ur package...
0
 

Author Comment

by:Lamiaaa
ID: 37726429
I am now getting the error: (the import org.math cannot be resolved) and (the import org.jdom cannot be resolved)...

How can I resolve this problem?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 37726562
How can I resolve this problem?

Add the jars of the apis in question to the project. In the latter case, it's JDom. In the former case, i've no idea
0
 
LVL 47

Accepted Solution

by:
for_yan earned 1000 total points
ID: 37726627
Extract all your java files into some folder hierarchy
Create the Java project in Eclipse

right click on the src folder - go to import - General - File folder - browse to the top level
folder of your soource - say select all and import all your Java sources

If you have third partuy jar depnendencies those need to be added also as dedepmnendecies
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 1000 total points
ID: 37726642
To add the third-party jars go to the project name in navigation panel 9not to the src folder)
and then right clikc - got to Build Path-- Configure Build Path - select Libarary tab on te top,
click on Add external Jars and brows to the external jar which needs to be added
0
 

Author Closing Comment

by:Lamiaaa
ID: 37742116
Thanks guys
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question