How to add a file as a link in Eclipse - eclipse

In VS 2008 there is a nice feature that I can share a single file between two projects
How can i do the same in Eclipse (Android)

For Java, you can right click on the project and go to Properties then into Java Build Path. Under the Source tab you can click on the Link Source... button and then input the location of your common source directory - that will allow you to put all "shared" files in the one spot and link them into the projects you want.

Related

How to open downloaded project?

I've downloaded example project in defold site. it's zip file, how to import it to defold? Do I must create new project and drag all file into it?
Sorry if this is beginner question, thank before.
I assume you mean these example projects?
If so, follow these steps:
Create a new project in Defold (from dashboard.defold.com) and open it in the editor
Right-click
"game.project" in the Project Explorer and select Show in Finder
(Mac) or Show in Explorer (PC)
Download and unpack the examples
archive you want
Drag the contents of the archive to the location of
the new project in the Finder/Explorer and replace the files in the
project The editor will pick up the new files and you are ready to
go
Alternatively you can add a project as a library dependency in your project ('importing' the files for read-only use). If so – add the zip url to the "dependencies" in the project section in "game.project" in Defold. See more about library usage here.
When you open a project for the first time or download, you need to create a "branch", whch is a copy of the project on your computer. Click "New branch" and name your local working copy (like "my work" or similar).
Also Check Your project compatiboly woth your OS Linux/ Windows and 32 bit or 62 bit.
You can learn basic thing from here .
http://www.defold.com/tutorials/getting-started/
Make sure you are using the latest editor and make sure to clear your browser cache.

Eclipse does not remember external source attachments

Using Eclipse 4.3.1 (Kepler) on Ubuntu, I find that each time I exit and reenter Eclipse, I have to respecify my external source attachments. What is the key to making Eclipse remember them?
Open the Source Attachment Configuration dialog by clicking on the "Change Attached Source" button in the Class File Editor; or open the similar Java Source Attachment dialog by right-clicking on the containing jar in Package Explorer and selecting "Properties".
I've tried both.
In the dialog, click on the "External File" button and navigate to a jar containing sources, or click on the "External Folder" button and navigate to a directory containing .java files in subdirectories corresponding to the package hierarchy.
All these ways work until I quit Eclipse and come back in.
I have never used these parts of Eclipse; I'm using Maven to manage my dependencies and Maven will automatically attach sources - so take my answer with a grain of salt :-)
I'm not sure why Eclipse doesn't remember those settings. My current feeling is that those settings are temporary.
If you edit the source attachments in the project's properties (look for "Java Build Path"; there is a tab "Libraries"), then the changes should be saved in the file .classpath. Have a look in there.
Lastly, you can try to create a "User Library" (search for this term in the preferences dialog). Here, you can define a bundle of JARs which make up some library. After adding the code JAR, you get options to specify the source JAR.

Eclipse IDE -- how do I put my external .jar files into a lib folder?

Eclipse IDE - Can someone please tell me how I can group my external .jar files into a C:\lib folder? I'd really like have them all in a lib folder and not taking up vertical space in the root of my project (see attachment).
I have read some of the similar posts here and tried them but my projects still are not 'seeing' the needed .jar files! It's very frustrating.
I know how to add a Folder but how do I tell Eclipse my .jar folders are in c:\lib so my projects will execute? I'm not even sure if making a lib folder in my project is even related to the fact that my jar files happen to be in c:\lib.
Thanks...
(source: msgVault.com)
From your description it sounds to me like you want the jars to stop taking up space in the root of your project. I am not sure how you initially added them but if I am adding external jars this is what I usually do:
Right click on your project, select properties, then Java Build Path, and then click the libraries tab, click on add external jars and then you can select each one individually (which would be a pain) or you can select them all at once if they are in the same folder (hence the c:/lib). Click OK and it should add them into a Referenced Libraries folder like so:
Also, when you open the libraries tab initially, if all of your jars show there, remove them before proceeding as you don't want to import them twice into your application (If that's even posssible, not sure).
Edit
Switch to Package explorer:
Click on Window > Show View > Package Explorer
Update
If you want to add c:\lib to your project do this:
Right click on your project, highlight build path, click Add Libraries..., in the list select User Library, click Next, click User Libraries... on the right. A new window will open. Click New... and then give the library a name such as "clibs". Click OK and then highlight the new library and click add external jars. Select the jars you want from c:/lib and then click OK. Now you can add that User library to any application you want and it will not "pile" up in the root directory under Project View.
That is just eclipse's way of displaying what libraries are on the build path of the project. It doesn't mean that they are on the root of the project, those are just references to those jars ( that maybe any-where on the system ).
A good practice is to get all the jars required by your project and put them in a folder. Next, you can either declare that folder as a library from eclipse and add that library on your build-path or you can just add the jars directly. But they will still be displayed like you are seeing them already. The true path of where these jars are located will be written next to them (like you can see in the attachment C:\selenium....).

.class file opens instead of .java while debugging

Current setup:
MainProject which is a Library Project
BranchProject which is a new projects and has MainProject as a Reference
Whenever I debug and a file from MainProject is on focus (actually BranchProject has only graphic and xml layout changes) the Debug window opens a .class file which is read only. I want it to open the .java file so I can edit it directly.
Skyler's answer from this post worked for me:
Opening source code from debug view edits .class after Android R18 update
Here is a summary:
The fix is to right click the Project name in the debug view, and select "Edit Source Lookup..." from the menu. From there, remove the Default lookup path. After that, manually add the associated projects (not jars) that your project references. This is done by clicking Add, selecting Java Project, then checking the appropriate projects.
When you're using a Library project one of the things you're in fact doing is compiling your Library project into a jar and then referencing that jar in your calling Project.
If you right click the Project, and select "Configure Build Path" you'll see a tab called "Libraries", if you look inside "Android Dependencies" you'll notice a list of jar's corresponding to your Library projects.
These jars are expandable, showing you that they have a slot for a source attachment. Usually this would be editable allowing you to directly link the source but in terms of ADT these are already filled and are uneditable.
When debugging these files you're linked to a read-only class file with this attached source. This is because you're not running against source files directly, you're running against a pre-compiled class file. Until the ADT team get this functionality in place, you're pretty much forced to jump to the direct source code and rebuild everything.
EDIT
See #Steven linked answer :)
I faced the same issue while debugging the a .java file using Eclipse IDE. As per my understanding this issue comes when we put the xyz.class file of xyz.java file or JAR at the project build path. Delete the .class or JAR file from the project class path and rerun .java file in the debug mode. This time you see a source not found window. Click on "Source not found" button and check "Find duplicates..." at the bottom of the window. Done your problem is solved :)
The problem is that the class file is preferred over the java (by default), here is how you can change that for Eclipse (tested on NEON 2):
Right-click on the Project in the Project-Explorer, click Properties
On the new window select: Run/Debug Settings
Create a new configuration (or duplicate another one)
Select the new config and click Edit...
Go to the tab Source
Select the Default and Remove
Create a new path with Add..., select Java Library, then JRE System Library
Create a new path with Add..., select the location where the sourcecode is by Workspace folder (if it is a project in the same workspace) or File System directory (it it is not)
I think this depends on, how you set up the dependency in eclipse. You should set up your BranchProject to depend on the source-Files of your MainProject. If you depend on compiles Class-Files is obvious that the debugger opens the class files, because it does not know about the source files.
I found a good solution for me here:
Using Android library in eclipse and jumping to class files instead of source file that is within eclipse workspace
Simply, select each library project your project depends on, and use Top or Up to move it above the projects outputs. Eg. move all library projects to the top.
Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
Switch to Order and Export tab and uncheck Android Dependencies
Enjoy
If you tried all above hints and it still doesn't work try this solution, it worked form me:
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path...
Select tab Order and Export
select library that you can't reach code and then click on button Bottom
Then click on Apply and Close
hope this can help you
Most of the time it happens when specific source folder are not added in build path Sources tab.
Right-click on the Project in the Package-Explorer, click Build Path -> Configure Build Path -> Source Tab
Add the source folder if your project source folder is not there.
Select Add folder -> select your project source folder specifically. Eg: project_name/src . Then Apply it and restart server.

Is there a way to make NetBeans hide specific files/folders?

I'm working on a joomla project and for debugging/type hinting/auto-complete have my whole joomla install as a project. Is there a way I can hide the folders I don't need in file or project view?
Ideally I would have a project that scans all of the folders but simply displays this:
administrator
components
com_myproject
(display all files under this)
components
com_myproject
(display all files under this)
You can hide any directories you'd like in Netbeans 6.9.1. Right click on the project, select properties, and select the "Ignored Folders" category. In this section you can add all the directories you don't want to see.
No, you cannot do it with NetBeans like this.
However, you can do it little differently... this is going to be component development.
Basically for every custom component you will need to have a separate project.
Create project with folder structure like Joomla
|
|-administrator
|-componnets
|-my_component
|
|-componnets
|-my_component
After this step, right click the project and go into properties. In the properties go to PHP Include Path, map path to Joomla directory, this is what is going to give you autocomplete feature for Joomla code.
Also, to improve auto-complete for Joomla, go to Tools->Properteis->Editor->Code Copletion
Select PHP from language drop down.
Check Also Non-Static methods after ::, this will give your auto-complete for methods like JFactory::getDBO(), etc...
Obviously it makes it hard to test right now, because component is not inside of Joomla... and copying it manually makes it a hassle. Go to project properties (right click project->properties) and enabled "copy files from Sources Folder to another location" and math the path. NetBeans will no allow you to setup copy into existing directory, workaround is simple.
Setup copy support into temp direcotry /tmp
In NetBeans windows, go to Files of your component project
Expand the nbproject node
Open project.properties
Manually modify the copy path
If you want something more advanced and runt test's, you can use Ant and create build.xml files. Read more about it on Sun's blog about NetBeans PHP and Ant.
Heres a video that will help u to do the same using netbeans IDE. Keeping yout component file into a seperate directory and do the development making full use of IDE features using the Apache ANt build procedures.
The Ant build file.
http://docs.joomla.org/Building_Joomla_Extensions_with_Apache_Ant
The video to help you setup netbeans for component development.
http://www.vimeo.com/13167176