Solved

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

Posted on 2012-03-15
12
512 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +2
12 Comments
 
LVL 40

Expert Comment

by:gurvinder372
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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:gurvinder372
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 500 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

724 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