Solved

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

Posted on 2012-03-15
12
511 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

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

Suggested Solutions

Title # Comments Views Activity
by zero exception 10 80
Delphi: barcode reading on android platform 1 98
Bitwise and to sum elements 2 50
Selenium WebElement Login button findElement 9 10
This article will show, step by step, how to integrate R code into a R Sweave document
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 synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

739 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