Launch eclipse product in shared directory - java

I deployed an Eclipse product and it works great in my computer, in order to everybody in my network could use it I left it in a shared directory, at first nobody but me could run it then I noticed that in the application.ini file there are some arguments that are pointing to libraries that are in my computer, I fixed it copying these libraries at the root folder of the aplication and changing this arguments in the file and it worked but with errors, those error are because the config.ini file has the variable osgi.framework pointing to the eclipse directory that I have in my computer then again I tried to copy these libraries to the application's root folder but it can't launch the application because it is not reading that osgi.framework variable.
Currently is something like this:
osgi.framework=file\:/D\:/personal/Apps/eclipse-jee-mars-M2-win32/eclipse/configuration/org.eclipse.osgi/312/data/1012924256/plugins/org.eclipse.osgi_3.10.100.v20140909-1314.jar
I tried to change it after I moved those libraries to the application folder to something like:
osgi.framework=file\:/\\shareddirectory\/application/plugins/org.eclipse.osgi_3.10.100.v20140909-1314.jar
But it doesn't work.
There is a correct way to make an eclipse product usable from shared directory or a least making portable? there is totally another way to do this?
Thanks

Try putting #user.home in your products .ini file.
Something like:
-configuration
#user.home/<datadir>/config
-data
#user.home/<datadir>/workspace

Check out the Eclipse multi-user installs manual page. It might have solutions to your problem.

Related

Update/modify the configuration file location of STS/eclipse

I want to keep the copy of my eclipse and spring tool suite in a shared path so that anybody can run the application logged in from their machine and use the common workspace settings.
However, except me when anyone else tries to run eclipse/STS they are getting the below error. I thought it is because of the .eclipse settings file is loaded from the C:/users/user-id/.eclipse. Apart from this the JDK, JRE etc.. are also configured in the shared path.
So even after relocating this settings file also to the shared path, I am facing the same error. Can some one help me to fix this?
below is the configuration folder
Well, first of all, I don't recommend you do this. You're better off sharing code in a central git repository than doing it this way.
However, the following SO thread talks about this: Change location where eclipse create .eclipse, .p2, and other folders .

Java application requires Admin Access to run when placed in Program Files

I am working on a Java (JavaFX) desktop app. I am converting it to exe with launch4j tool and then later creating a setup package using Inno Setup Compiler (default installation path set to C:\Program Files (x86))
The application itself don't need any admin privileges and runs fine when I copy the exe on desktop or run it on drives other than C. (Also works fine if I run it in local appdata folder)
But I need to place it in Program Files (x86) directory.
The app doesn't open if I install it in that directory so I had to create a manifest file for launch4j so that it asks admin access each time it opens. It works fine that way but admin access is asked everytime in this case.
I need to make this application run without asking admin access each time.
If there is any solution, please guide me through it.
Any help will be appreciated.
Ok so I kind of figured that out. I guess the jar was having trouble reading from system directories and I had to do some read/write operations on a config file. So I changed the config path to:
String path = Controller.class.getProtectionDomain().getCodeSource().getLocation().getPath() + "\\Data\\";
Now it creates a folder named "Data" inside jar file and read/write from there. I don't know if this is a bad practice or not but it seems to work pretty good for me.
Thanks a lot to #user31601 who gave me some hint that helped me figure this solution out.

IntelliJ IDEA: Jar doesn't load images when run outside of IDE

I am using JetBrains IntelliJ IDEA IDE. This is what I used to generate the jar file. Running the jar file from the IDE, everything looks fine.
Running the jar from the terminal, none of the images are loaded.
My feeling is, from reading around on this, that this has something to do with the relative paths used for the images... but I can't figure this out. I've tried various different project folder structures suggested on the JetBrains forums and StackOverflow, to no avail. Everything is fine until I run a jar outside of the IDE.
My current project structure:
How on Earth do I create a jar file that works everywhere?
Ok, so here's what worked for me. I opened the project structure window (Ctrl-Alt-Shift + S) and went to the Modules tab. From there, I could easily select a folder from the list and click to make it a Resource directory. I was then able to access the resources as URL's with
URL imageUrl = ClassLoader.getSystemResource("image.png")
No need to use a path to the image, just it's actual name.ext
Using IntelliJ's resource folders is probably the right way to go.
Simply right click your res folder, go to Mark Directory As and select Resources.
Then you can access files in this folder simply by name (without a res/ prefix.)
Working visual example:
Source and Resource roots are handled differently.
All the files from the Resource directories will be always copied to the output path. As suggested in another answer, one of the solutions is to configure this directory as Resources root. It's the preferred way to get it working.
If you want files from the Source roots to be copied to the output, you have to specify the patterns for the files that will be copied.
If the project is Maven or Gradle based, these patterns have no effect and IDE will use the rules of the corresponding build system to process the resources.

Java App unexpected behavior when exported

I have a very strange problem, that I can't figure out, the thing is that my aplication runs perfectly on the IDE (Eclipse), but not when exported, when I run the jar (double click) the aplication start but some functionality is missing (loading from a template file, but this does not happend when loading from a normal file), when I try to run it from console (java - jar my.jar) in order to see any error message it turns out that my aplication works perfectly fine! :S ...
Some more info:
My app is running over windows 7
I start the task manager, and I noticed that when I start my aplication using double click its under the name java.exe *32, and when I do it from command line its under the name java.exe (without "*32"), as far as I know I programmed nothing related to a 32 or 64 bits functionallity.
"Solved"
Well I was not able to solve it the way I wanted, as far as I was able to find, i found that there were a problem between the 2 java versions I was running x32 & x64, I deleted the 32 bit version and it start working as a charm, but I'm still not sure about what happend, I give my thanks to #Sajal Dutta one of its comments help me to understand part of the problem, thanks to all of you anyway, I'll keep searching until I find the problem...
When you create a jar from Eclipse, your assets don't get copied over to jar or location is not preserved. Open the jar and check if you have your templates in the right location or you have it at all.
To have the exported jar include your assets/resources-
Right click on your project in Eclipse. Then New -> Source Folder.
Name the source folder anything. e.g. template_src.
Copy or drag the entire directory of your template to template_src. Then make the jar.
Since it works via the command line but not when double-clicking the jar, it is likely that the working directory is different (and that you're loading the template with a relative path). When you run an executable jar by double-clicking, on some operating systems, the working directory is the home directory whereas when you run from the command line, it's the directory you're currently in.
The "files" in the jar are not handled by File, but are resources;
URL url = getClass().getResource("...");
InputStream in = getClass().getResourceAsStream("...");
Then, the file paths inside a jar, or on a non-Windows platform are case-sensitive.
"Template_A.xml"
is not
"template_a.xml"
Also you might inspect the jar with 7zip or WinZip.

How to change or specify the directory where the tmp***.instance file is written to by Eclipse

I've built and installed an Eclipse Plugin Java application to Program Files directory in Windows 7.
I have a problem starting the application.
It looks like whenever the application is started, Eclipse Framework tries to write a tmpXXX.instance into the configuration\org.eclipse.core.runtime\.manager folder , and of course it does not have the permission to do that, so the program won't start. I've tried running the program as Admin, still have the same problem.
Ive tried out a couple of things, tried google for it, and also still could not get Eclipse to write the instance variable somewhere else.
Thanks, any help is appreciate it :)
You can try to change this setting in eclipse.ini:
-Djava.io.tmpdir=C:\Your\Accessible\Temps\Folder
Modify the eclipse.ini to point to another configuration location. Add this line
-configuration <writableLocationPath>

Categories

Resources