Running Eclipse on desktop = can't find companion library - eclipse

I just downloaded Eclipse Juno onto my machine. I extracted the files to an Eclipse subdirectory in "C:\Program Files". When I try to launch eclipse from here, it works great! But I don't want to have to navigate to this directory every time I want to launch eclipse. I tried just moving the executable to my Desktop, but then when I try to run it I get this message:
The eclipse executable launcher was unable to locate its companion library.
How do I let eclipse know where it's companion library is if I don't plan to have them in the same folder? Please be very specific.
Thanks!

You dont move the executable to your desktop because the executable needs to be in the same directory with other files where it was. get it back and then make a shortcut or link to it. you are free to make the shortcut or link where you want.

Well i had the same problem sometime back, and i figured out that since i've changed the location of my elcipse.exe , it has some how effected the "eclipse.ini " file
1.Path to -startup
D:\ < elcipse folder> elcipse:\ plugins\org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar \this is the start up jar file.
2.Path to shared lucher library
D:\ < elcipse folder> elcipse:\ org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 \this is the shared launcher library jar file.
just set the follwing two paths and ti will start up again like befor..
Happy coding..

This is a bug filed with Eclipse for Windows and Mac:
When attempting to launch Eclipse (double click on Eclipse.app), the launch fails. The only action is a dialog box with this message:' the eclipse executable launcher was unable to locate its companion shared library'. I found an online description of the problem and the workaround here:
Specifically, as per the instructions above:
I opened the Eclipse.app package, located eclipse.ini, edited it
searched the plugins folder for something matching org.eclipse.equinox.launcher.carbon.
copied the maching folder name (from plugins)
pasted it as the terminating portion of the path for --launcher.library
replaced the --launcher.library line with that path
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288112

Eclipse Neon, 2017:
I copied my old .p2 folder found in my home.
Ran eclipse again and it worked.
It used to be that you could just copy eclipse as a zip and it would work fine, but it seems some plugins now rely on the .p2 folder.

Related

How modify Eclipse locations to prevent write to user.home directory?

I have tried all different settings, and yes, I m aware of eclipse.ini and config.ini and also tried different command line arguments! Nothing solved my problem!
All attempts and still each time I run eclipse.exe it wants write to my userhome i.e. the .eclipse and .p2 folders.
I have tried with all settings bellow among others, in different combinations too:
-Dosgi.user.area=file:/c:/eclipse-conf/e46
-Dosgi.configuration.area=file:/c:/eclipse-conf/e46
-Dosgi.instance.area=file:/c:/eclipse-conf/e46
-Declipse.p2.data.area=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.configurationFolder=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.installFolder=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.cache=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.roaming=file:/c:/eclipse-conf/e46/p2
-Dorg.eclipse.equinox.p2.cache.shared=file:/c:/eclipse-conf/e46/p2
This did not help! Well it writes to /e46 and /e46/p2 folder but it also creates/writes to c:\users\mrsimplemind\.eclipse & .eclipseextension & .p2
Even if I manually create the folders before it will not help.
Now please anyone here had success to fully isolate eclipse configuration output?
The only way I achieved this was by changing the user.home but I don't like this workaround as there are stuff in the original "user.home" that will be needed in eclipse, e.g. .ssh , .git , .m2 maven etc. I don't want to keep duplicates of profile settings for each eclipse user.home
I just want to isolate eclipse, this should be configurable! I don't like the outputs to user.home .. It is not an option! I want to have control of what eclipse creates in what folders, for each eclipse installation.
(I can only tell from windows os, I don't know how if Eclipse on Mac works better with the settings above)
I dont use OOMPH installer, some comments below are misleading
The method I have tried to solve this problem has been nearly successful. Whether this is an answer for you will depend on your minimum acceptable level of quality.
If you are trying to prevent your Eclipse IDE from filling up your home drive, this technique will work (it has worked for me). It should not matter if Eclipse was installed by Oomph or from a plain zip, as nothing Oomph-related is modified in this solution.
If the requirement is that the user home p2 folder can be completely deleted and yet Eclipse still works without recreating that directory, no I have not been able to achieve that yet.
I am posting this as a partial solution, perhaps in the hope someone else can build upon it to figure out a better workaround. Obviously the perfect solution would be if eclipse had a configurable download location and the installer actually installed all software to only the location selected, but that requires the Eclipse developers to fix the "P2" component of the product. What follows is only a workaround.
Strategy
The premise is that the download pool folder always seems to be hardcoded into the config files to be under the home folder of the user that ran the eclipse installer. The essence of this workaround is to create a fake user home folder in the location of your choice, do a massive find-and-replace in the config files, and then force the Java system property to use that new folder as "user.home" which fools Eclipse into using it for its downloads.
Method
This was tested on Eclipse 4.7 Oxygen.3A on Mint Linux.
Extensive brain surgery of the Eclipse installation folder is needed.
Install Eclipse somewhere other than your user's home drive.
In this example the Oomph installer was given /media/LINAPPS/ubuntu-apps/eclipse-oxy as the install target, which then creates /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse during the installation.
Start Eclipse at least once, then close it and make sure Eclipse is not running.
Create a new fake user home drive folder underneath the Eclipse folder.
In this example I created eclipse-oxy/eclipse/fakeHome
Copy the entire (hidden) p2 directory from your user home directory into the new fakeHome.
eg cp -R /home/$USER/.p2 /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome/.p2
Go to the eclipse folder and edit the eclipse.ini in a text editor. Make these 2 changes:
set the line after --launcher.library to be the copy of the pool in the new location relative to the eclipse folder, eg : fakeHome/.p2/pool/...etc...
append a new system property setting to end of the file after all the other vm arguments, and set user.home to the new fake user home directory.
eg: -Duser.home=/media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome
Edit the file eclipse/configuration/org.eclipse.update/platform.xml. Find the first <site> entry and change the url attribute to be the new pool folder relative to the eclipse folder. eg: url="file:fakeHome/.p2/pool/"
Edit the file /media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info and again find and replace all references to you user home's p2 folder with the new p2 folder under the fakeUser. You could find over 1000 matches to replace here. It again seems to be possible to make these relative to the eclipse folder, so a path of "fakeHome/.p2/pool/....." will work.
Go to the new /eclipse/fakeHome/.p2 folder and edit both of the files there "pools.info" and "profiles.info". Again find any reference to your real user home and replace it with the path to the fakeUser folder. Use the full pathname (from root) for the pool location in both of these files.
Unpack, edit, and repack the latest profileRegistry. Find the folder
eclipse/fakeHome/.p2/org.eclipse.equinox.p2.engine/profileRegistry/_media_LINAPPS_ubuntu-apps_eclipse-oxy_eclipse.profile/. Now find the latest timestamped gz file in that folder. For example it might be called "1529736854441.profile.gz".
gunzip that .gz file. Edit the .profile file and again replace any mention of your real user home with the new fakeUser folder. For example in my installation one of the first property settings had to be changed to
<property name='org.eclipse.equinox.p2.cache' value='/media/LINAPPS/ubuntu-apps/eclipse-oxy/eclipse/fakeHome/.p2/pool'/>
Delete the old gz file, then gzip the profile into a gz, so it has replaced the old one.
I also edited the file /eclipse/fakeHome/.p2/org.eclipse.equinox.p2.core/cache/artifacts.xml and replaced the repository name with a reference to the new location inside fakeHome, but I am not sure this was necessary to get eclipse working.
Start eclipse.
Results
After doing the above, I tried to add Install New Software from the Help menu. After downloading lots of new plugins from Redhat and Spring, the new fakeHome pool occupies 900MB, but the original user home pool is still less than 400MB which is what it was as soon as eclipse had been installed. So it has been successful at moving the download cache of the updater and no files get updated in the old location, but two directories under .p2 still seem to have their timestamps touched.
If anyone finds this useful, or figures out how to improve it, please let me know.
This works on Windows 7, Eclipse Oxygen:
Install Eclipse, but DON'T launch it yet
Edit eclipse.ini and, underneath -vmargs, add an entry to change user home to be a shared folder:
e.g.
-vmargs
-Duser.home=C:\Development
Launch Eclipse. Should see ".eclipse", ".tooling", etc folders created in shared folder, and nothing created under your user folder.
As of Eclipse Java 2019-06 for Windows 10 64-bit
I added my eclipse.ini below:
-vmargs
-D"user.home=C:\your_path_here"
The 3 folders of .eclipse, .p2, & .tooling appeared after I started and then closed eclipse.
I am not sure when these are written into the new path, but it worked in my Windows 10.
Did you try adding the following line to eclipse.ini below -vmargs:
-Dosgi.configuration.area=#user.home/.someFolder
which will use .someFolder instead of .eclipse
or
-Dosgi.configuration.area=C:\path_to_desired_location\.eclipseJAVA

Eclipse mars Installation folder in Mac

I need the Eclipse Installation folder, it was requested from another program, but there is no such a folder. When I installed eclipse I did not get any folder out of the compressed file, I only get the program itself.
However, I copied the contents and it says " it's not the installation folder since it does not have "plugins" subfolder.
The error message
The new path for the plugins is
/Applications/Eclipse.app/Contents/Eclipse/plugins
The eclipse will be installed where you decided to put it not always under /Applications necessarily. The easiest way I think to find the installation folder is to run eclipse, go to Eclipse > About Eclipse. Click "Installation Details" at the bottom. The configuration tab in installation details should have the location of eclipse for launcher and startup config. Hope this helps!
In mac os you need to select the eclipse ini file not ecllipse.app

How to fix the Eclipse executable launcher was unable to locate its companion shared library for windows 7?

I am getting the following error, while launching Eclipse:
The eclipse executable launcher was unable to locate its companion shared library.
Previously Eclipse was working fine when I had jre6 installed on my pc. After installing jre7 update 25, I am no longer able to launch Eclipse.
My Eclipse ini-file has these lines:
-startup
plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
How do I fix this error? Any help would be great.
Had similar issue, which was a result of update. Please make sure that names of libraries mentioned in eclipse.ini and the actual names of these files on your disk match exactly.
-startup
plugins\org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.1.R36x_v20100810
Here is the post that I used to fix this issue on my system http://codewithgeeks.blogspot.in/2013/11/fixing-eclipse-executable-launcher-was.html
It worked only after removing the eclipse folder and all related folders like .p2, .eclipse (in my case they are at different location where I have saved eclipse installer) etc. and after re-downloading the eclipse, it worked.
In my case, this error occurred because of windows 7 shortcuts. In windows we create shortcuts on desktop by using right click > send to > desktop. In my pc, there is no option for desktop, but there is one for "documents". I created the shortcuts there and then moved them to the desktop. Executing these shortcuts causes the error. Eclipse works fine when I run it directly from the folder where it is installed. I fixed it by using right click > create shortcut and then moving this shortcut to the desktop.
This is an issue with the 64 bit version of Kepler and windows7 in my case.
I downloaded the 32 bit and it worked immediately.
In my case I have moved plugins folder mistakenly to another folder while taking backup of my unnecessary projects.
Then while I was trying to run the eclipse.exe I was getting the error-
The Eclipse executable launcher was unable to locate its companion
shared library.
I have simply copied the plugins folder to eclipse root directory, and it was working fine for me.
If you have the folders backup in your computer then just copy and paste the folders on eclipse directory, you don't need to reinstall or change the ini file so far I realized.
This happened to me when deleting some Equinox package from my plugins directory, make sure this is not the case.
The reason to that might be the 2 lines in eclipse.ini
--launcher.library
C:\Users\UserName\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
for my case the reason was admin privilages so I had to move the folder from the path specified in ini to my eclipse plugins and change path in ini to :
plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.400.v20160518-1444
This worked for me
On the Zipped folder of the ADT you initially downloaded unzip and navigate to:
adt-bundle-windows-x86_64-20140702\eclipse\plugins
Copy all the executable jar files and paste them on the
C:\adt-bundle-windows-x86_64-20140702\adt-bundle-windows-x86_64-20140702\eclipse\plugins
directory (or wherever your adt is located).
Any executable jar files missing in the plugin folder will be added. You should be able to launch eclipse
I encountered the similar problem after installing new software. In my case, the problem was solved by: (1) restoring .p2 subdirectory under my home directory; and (2) editing eclipse.init file to have the updated java directory.
In my case, i had copied a plugins folder into workspace from a collegue. Becaouse it was an unzipped folder, the structure was like 'pluginsfolder inside a plugins folder2 . so make sure that all the plugins are directly located under the toppest plugins folder at the workspace.
In my case eclipse.ini entry for --launcher.library was :
--launcher.library
C:\Users\UserName\.p2\pool\plugins\org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
and on my machine 'C:\Users\UserName\.p2\' folder was missing hence installed the eclipse again which created the .p2 folder structure at required location and now I am able to login successfully.
I followed the below steps and it worked for me.
Step1:
Edit eclipse.ini by adding javaw.exe path and remove --launcher.appendVmargs line.
Below shows the original and edited file
Orginal eclipse.ini
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
After editing eclipse.ini:
openFile
-vm
C:/ProgramFiles/Java/javapath/javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.8
Step2:
Copied the org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar to eclipse installation folder .
You can find the .jar location in eclipse.ini
eg : C:\Users\Username.p2\pool\plugins

Enterprise Configuration of Workspace mechanic

I am using Google's Workspace Mechanic to configure my eclipse environment. All seems to work fine, except that for any fresh installation, the workspace mechanic opens up with a default location of its own (~/.eclipse/mechanic) to look for preference files.
As given in their documentation i tried including their code
(/instance/com.google.eclipse.mechanic/mechanicSourceDirectories=/shared/eclipse/tasks\:${user_homedir}/.eclipse/mechanic)
in my plugin_customization.ini , but it does not work for me.
Does anyone have any other idea as to how to achieve this?
Quite late, but I just needed the same configuration.
First locate your plugin_customization.ini (eg. 'find -name plugin_customization.ini' in your eclipse folder).
I had two files with same name, located in org.eclipse.platform and org.eclipse.epp.package.jee.
For me, the jee one was relevant and you can configure it as JSON Array.
com.google.eclipse.mechanic/mechanicSourceDirectories=["http\://server/mechanics/tasks.json","/tmp"]
This example shows how to configure a folder (/tmp) and via http location.
Under Windows, I found that when using the recent Eclipse Juno and the latest Workspace Mechanic I had to do the following:
Edit the (Java EE):
...\Eclipse_Juno_SR1\plugins\org.eclipse.epp.package.jee_1.5.1.20120828-0743\plugin_customization.ini
and add the following line at the end:
com.google.eclipse.mechanic/mechanicSourceDirectories=c:\\...\\eclipse_extensions\\WorkspaceMechanics
in order for the plugin to recognize the above directory as the shared folder...
The plugin preferences now correctly references the folder !
The documentation is for Eclipse on Linux/Unix. If you are running Eclipse on Windows you will need a different path.
Another aproch is to put the preferencces in another file and point to that file from your eclipse.ini with a line such as
-Declipse.pluginCustomization=/var/wsm/current/my.properties
or eclipse startup with
eclipse -pluginCustomization /var/wsm/current/my.properties
The following worked for me (for Eclipse Luna in Windows).
Open the Luna/plugins folder
Search for a folder that begins with org.eclipse.epp.package.
(and I ended up with org.eclipse.epp.package.java_4.4.1.20140925-1820)
Go inside that folder and edit plugin_customization.ini
Append the following at the end (to point to \\sharedserver\share\DEV\Workspace-Prefs-Luna):
#Workspace Mechanic Settings
com.google.eclipse.mechanic/mechanicSourceDirectories=\\\\\sharedserver\\share\\DEV\\Workspace-Prefs-Luna
Save and Close the file
Restart Eclipse

How do you install JDK?

I have eclipse and I can test run java apps but I am not sure how to compile them. I read that I should type javac -version into my cmd.exe and see if it is recognized. It is not. So I went to sun's website and downloaded/installed JDK v6. Yet it still says 'javac' is an unrecognized command. What am I doing wrong?
Thanks!
UPDATE
OK after reading some replies it seems like what I am trying to do is create a .jar file that can be ran on another computer (with the runtime). However I am having trouble figuring out how to do that. This might be because I am using Flex Builder(eclipse), but I added the ability to create java projects as well.
Thanks
UPDATE
OK I do not want to make a JAR file, I am not trying to archive it...the whole point of making a program is to send it to users so they can use the program...THAT is what I am trying to do...why is this so hard?
To setup Eclipse to use the JDK you must follow these steps.
1.Download the JDK
First you have to download the JDK from Suns site. (Make sure you download one of them that has the JDK)
2.Install JDK
Install it and it will save some files to your hard drive.
On a Windows machine this could be in c:\program files\java\jdk(version number)
3.Eclipse Preferences
Go to the Eclipse Preferences -> Java -> Installed JREs
4.Add the JDK
Click Add JRE and you only need to located the Home Directory. Click Browse... and go to where the JDK is installed on your system. The other fields will be populated for you after you locate the home directory.
5.You're done
Click Okay. If you want that JDK to be the default then put a Check Mark next to it in the Installed JRE's list.
You don't need a separate compiler, eclipse already compiles the application for you. What you probably want to do is to create an "executable" JAR file, which you can do in eclipse by selecting File->Export->Runnable JAR file.
Note, however, that the resulting JAR file is not a "real" (i.e. Windows binary) executable - it still needs a JRE installed on the target computer. There isn't really a way to create windows binaries; that's not how Java works. On the upside, it will work without recompilation on a Linux or MacOS machine (if it has a JRE installed).
javac is located in the "bin" folder of your JDK installation. In order to run it you must either use full path or add this directory to your systems search path via the Control Panel.
If you installed to c:\program files\java\jdk1.6.0 your call will have to look like this:
c:\> "c:\program files\java\jdk1.6.0\bin\javac" -version
Umm, eclipse is an IDE, it compiles things as you go. You don't need javac.
If you have Eclipse installed and you can write new java apps from within it, your compilation should work already..
Eclipse automatically builds/compiles your system when you're saving new Java files. Just try to write a new simple Hello world app, printing something to the console (just type sysout and Ctrl+Space inside Eclipse)
Eclipse automatically compiles all project in the workspace. YOu can disable this option if you like under Project->Build Automatically.
A JAR file can function as an executable, when you export your project as a JAR file in Eclipse (as Michael Borgwardt pointed out) you can specify what's the executable class, that meaning which one has the entry point [aka public static void main(String[] args)]
If the user installed the JRE he/she can double-click it and the application would be executed.
EDIT: For a detailed explanation of how this works, see the "How do I create executable Java program?"
Eclipse to use the JDK you must follow these steps.
1.Download the JDK
First you have to download the JDK from oracle site.
Download link - > https://www.oracle.com/technetwork/es/java/javasebusiness/downloads/index.html
2.Install JDK
Install it and it will save some files to your hard drive. On a Windows machine this could be in c:\program files\java\jdk(version number)
3.Eclipse Preferences
Go to the Eclipse Preferences -> Java -> Installed JREs
4.Add the JDK
Click Add JRE and you only need to located the Home Directory. Click Browse... and go to where the JDK is installed on your system. The other fields will be populated for you after you locate the home directory.
5.You're done
Click Ok. If you want that JDK to be the default then put a Check Mark next to it in the Installed JRE's list.