I want to set up workspace location for an Eclipse instance in order to distribute it to some of my friend. I must use relative path to workspace for this. So far I decided to use data switch to point particular workspace located inside the Eclipse directory. The problem is when I use command-line switch like this:
./eclipse -data workspace
it works fine, but when I try to add this at the end of eclipse.ini like this
-data
workspace
it does not seem to have any effect. Note that I've tried to restart Eclipse with clean switch after editing eclipse.ini.
I noticed that setting osgi.instance.area in eclipse/configuration/config.ini let me point to workspace but I couldn't get relative (to elcipse directory) path working. I tried a number of solutions (#user.dir/workspace, platform\:/base/workspace and just workspace), all they actually compute relative path from user home directory (and platform solution creates directory named platform in user's home).
The desired behaviour is implemented in Scala IDE, but I can't figure out how they get this.
When add to the eclipse.ini file check if there is a -vmargs entry in the file. Everything in the file after any -vmargs is treated as a VM argument not an Eclipse argument.
So add the -data at the start of the file.
Related
There was a bug where after installing plugins the -vm entry got messed up. This is a bit similar, on every run the relative path will get resolved into an absolute path. I would like to keep the eclipse portable and this is the last part required to make this happen. When the path gets resolved into absolute it again is not portable. Is there a way to stop eclipse from resolving the -vm entry? Or disallow touching the INI file at all?
If not I will have to use separate cmd to start the eclipse or use a shortcut and feed the -vm that way.
Thank you in advance for any hints.
Edit: The desire is to have portable Eclipse with bundled JRE and have it working even when it's moved around.
No exact answer to your question, but to get a portable Eclipse IDE or an Eclipse-based application, a JRE/SDK can be embedded in the subfolder jre instead of using -vm in the .ini file.
I'm trying to reinstall eclipse and add:
-vm C:\Program Files\Java\jre1.8.0_121\bin\javaw.exe.
See Image.
Please try the rules for specifying the virtual machine for eclipse as found here:
Note the format of the -vm option - it is important to be exact:
The -vm option and its value (the path) must be on separate lines.
The value must be the full absolute or relative path to the Java executable, not just to the Java home directory.
The -vm option must occur after the other Eclipse-specific options (such as -product, --launcher.*, etc), but before the -vmargs option, since everything after -vmargs is passed directly to the JVM.
Experiencing the same problem here, running Eclipse Neon.2 and JRE 1.8.0_121 on MS Windows 10.
If I specify a JVM in eclipse.ini (putting the -vm option and the javaw.exe pathname on separate lines in the right position, as Carlos Heuberger correctly suggests), eclipse crashes at startup with exit code=-1073740791, before opening the interface, but after initializing the workspace.
If I run Eclipse again, the interface opens and I can start working, but it is likely to crash after a while, apparently in a random way.
If I remove the -vm option from eclipse.ini and set JAVA_HOME and PATH in the environment, Eclipse seems to work fine; of course, this might cause problems to other applications on your system.
I think I eventually found the solution to the problem: the eclipse.ini file coming with the distribution has the JVM option -Dosgi.requiredJavaVersion=1.8 duplicated: simply remove the second instance and it will work like a charm!
When you start Eclipse for the first time, it asks you the path for the workspace. Now, normal path should be C:\Users\USERNAME\Workspace but, if I try to set %USERPROFILE%\Workspace it doesn't work, it creates a folder called %USERPROFILE%\Workspace under the Eclipse folder.
So the question is: how to use windows environment variables to specify workspace path? Thank you.
P.S: I know that Eclipse has got customizable environment variables but I didn't try them and I want to use them neither.
You can run eclipse.exe -data %USERPROFILES%\myCustomWorkspaceDir to have the workspace in your wanted sub directory. In this case, you will not even get the dialog asking for the workspace.
There are still more runtime options for Eclipse.
I'm trying to speed up Eclipse by having my projects on a RAM disk (stuck with a slow laptop and a heavy kind of eclipse project at the moment). Worked great for loading the project and such, but when I'm building it seems to read and write a lot to a directory in %APPDATA% (seems to have a generated name from the name of the project). This makes it actually go slower than usual...
So... is there a way I can move the tmp directory of eclipse? Preferably without moving the tmp directory of other applications in the process.
May have found a way by setting a property called java.io.tmpdir in eclipse.ini. Seems to have changed where most of the read/write activity happens during build at least. For example:
-vmargs
-Xms128m
-Xmx1024m
-XX:MaxPermSize=256M
-Djava.io.tmpdir=E:\tmp
Not sure if it have to be after the -vmargs thing or not, but this seems to work anyways.
It can be done by Djava.io.tmpdir property
->On root directory of your project right click as select run or debug as then in:
In Run/Debug Configuration of your project
->Run configuration
->Arguments-->
In VM Arguments
write the complete path of your temp directory
example: if you want to select a folder JAVAtmp in F drive then pass the VM arguments as :
-Djava.io.tmpdir=F:\JAVATmp
When Eclipse first start, it creates some config files and folders on my hard drive (contains information about work-space ...etc...). I don't like the position it creates config files because config files are all put in my C:\Users\Long folder and that's ugly. I want to put all those config files somewhere else (C:\Eclipse\ for example). This happens in Linux too.
Do you know how to put those files in somewhere else?
Just add the following to your eclipse.ini file (found at the root eclipse installation folder):
-Dosgi.configuration.area=file:/C:/Workspace/.eclipse
To change the default .eclipse folder location, go to ${eclipse.home}, open your eclipse.ini with a text editor and insert there one line more:
-Dosgi.configuration.area=/path_to_new_folder_location/.eclipse/
As someone already said, adding the property -Dosgi.configuration.area in the eclipse.ini file does the trick.
But in my opinion it would be better to rely on the user.home variable and set the destination like for the other variables.
Example with -Dosgi.instance.area.default:
-Dosgi.instance.area.default=#user.home/eclipse-workspace
In my case I just wanted another destination than the default #user.home/.eclipse which was still used by the Eclipse Mars that I keep for old projects and I just defined:
-Dosgi.configuration.area=#user.home/.eclipse-oygen-3
to have a specific destination for the Eclipse Oxygen 3 installation.
Note that syntax works for both Windows and Linux (I did not tested on OSX, but I guess it should).
Eclipse has some command line arguments you can use. One of those arguments is the flag -data which tells Eclipse where the workspace of Eclipse should be located.
So when I create a new workspace, I normally create a shortcut under Windows (or script file under Linux) with the following contents:
eclipse.exe -vm <JDK>\bin\javaw.exe" -data ws -nl en
This defines which JDK should be used, that the workspace is located under ws and that the english locale should be used.
IMHO parameter -configuration does the trick. It must point to a subdirectory named "config". Eclipse will fill this and the upper directory itself with files, e.g. for a JBoss server installation.
If you have more than one eclipse installation, then you should use a different directory for each eclipse installation.
Example how to keep everything in defined places:
"C:\Program Files (x86)\eclipse\eclipse48jee\eclipse.exe" -nl en_US -vm "C:\Program Files (x86)\Java\jdk1.8.0_212\bin" -configuration C:\EclipseData\eclipse48jee\config -data C:\Workspaces\SomeProject