Same workspace with eclipse - java

I'm using Eclipse in server and I have two users who can connect on this server. I want to find a solution which allows me to use the same workspace by they two users. I tried it and I got an error message which tells me that you can't use this workspace because it is used by another user and it makes sense. But I want to know if they have a solution which allows me to open the same workspace in the same time by the differents users who use the different authority.
Thank you

you cannot do that as it locks the workspace for one user. others cant edit the same. Try using Version Control like Git or SVN.

You can make developers use the same Eclipse by starting it's launcher with the "-data" argument set to a unique folder. (Let's say the user's name)
You can write a startup-script that copies the contents of a reference workspace, each time a user starts using this shared Eclipse.
But that's the most you can achieve; two instances of Eclipse can not use the same workspace. In server terms: think of it as a Session rather than a Workspace.

Related

Publish updatable Java software through Wordpress

I have just written a Java program that I now need to publish. I want to make the software easily updatable, and I therefore need your advice. The program will be used by people with minimal technical knowledge, hence usability is absolute key. The program is not open source.
The situation is this:
First time users download a zip-file containing one .jar-file and two folders that should contain the program output files (.xml-files and .png-files). I want to make it as easy as possible for the user to update the .jar (replace it with another .jar, not necessarily at run time). To my help I have a simple web-based Wordpress site that the user will view as the source of the program.
I'll list the possible solutions I've come up with:
1 (fallback solution). The user have to manually go to the Wordpress site where I'll put a separate direct download link (from Google Drive) for the .jar-file. The user then has to manually replace the .jar in the existing folder with the new one.The drawback to this is that it requires too much work from the user, and they program probably won't get updated very often.
2. Alongside the Program.jar in the zip-file the first user downloads, I place another Program-Updater.jar. This new .jar's sole purpose is to, when the user opens it, download a new version of Program.jar from the web and replace the existing one.This is better than the previous option because it requires less work, even though it's not automatic. The drawback is that I need one more .jar which can confuse the user, and most importantly I have no way of updating the Program-Updater.jar.
3. Java Web Start.I've tried reading up on how this works, but I'm wondering if there is a way to get it to work. One possible problem is that I can't really access the host, and to be able to set up the .jnlp the correct way I think you need this. I'm also wondering how the program's file structure would be (is the .jar even placed on the user's computer?) and if this could confuse the user. Also how to make it always work offline.
4. Suggest your own solution!
Any input on this matter would be greatly appreciated, and I'll gladly give more info than I already have.
Cheers
Getdown was the way to go; it is extremely easy to use.
I'll put the .zip on Google Drive with a direct download link to it on my Wordpress site.
The files used by getdown are placed in and downloaded from my public git repo.

Eclipse settings to sync and save a single project over multiple paths

I can't seem to find a setting in Eclipse to save and back-up a single Project to multiple paths.
I have a single Java Project in Eclipse that I save on my local machine and either save as... or copy replace to a local network and local mass storage, for BACKUP. I'd like that to occur on any, all Project saves.
I saw Project properties, but I'm not too familiar with Eclipse and team dev options, and I don't want to F the paths, links, etc.
Thanks.
EDIT: I'll try what user101 recommended, but to avoid confusion, My own personal, primary Linux box is where development is performed. The other locations are, for lack of a better word, BACKUPS. I used the term "Sync" for the sake of what my question may be related to.
Sorry for any confusion.
What I understood is that you want the sources from different paths , if so You can try as below
1> Create new java project
2> Click on link additional source

Tracking files changes in Java

I have java application. Every time when I'm doing changes in JSP file I need to copy saved JSP to another place (specific project). May be you know tool that can track changes in real time in files in specific folder and after every saving - copy these files to another folder, thanks.
Eclipse, IntelliJIdea like IDEs have a feature called Local History. you can view, compare replace each saved version through that by few clicks.
In java there is a support for watching file changes. You can use this to implement your own program that listen to file changes and save the version automatically whereever you want.
http://docs.oracle.com/javase/tutorial/essential/io/notification.html
Take a look at Apache Ant or Maven. These tools take a little customization, but once configured they make deploying a new version of your application as simple as a single command. Of course there is a learning curve for both Ant and Maven, so the larger and more complex the project, the more useful and time-saving these resources become.
If you really want the "quick and dirty" option for testing purposes, simply set up a Shortcut located in your Server root folder and pointing to the .jsp file in your development workspace. Give the shortcut the same name (and relative location) as the original and the shortcut will always mirror your development copy. Note that I do not recommend this option, and am only including it for completeness.

How to open putty from java if path of putty.exe is not the same for every user?

I am developing a java web application that needs to pass shell scripts to putty after user authentication. putty.exe should launch only if authentication is successful and if the script has begun running successfully.
Also, since different users might have installed putty in different locations on their systems. Is there any way to launch putty.exe without requiring the user to manually configure the path. Or is it possible to programmatically find the path and launch putty?
I will start by saying not having the user add putty to the path is most easily solved by creating a configuration file for each user, where one of the parameters will be the location of the putty executable. Properly handling this with default values and a dialogue box if putty can't be opened would be simple and familiar to most users.
Two simple situations could completely mess with how you do a search for the executable: the user renames the putty executable or the user has multiple versions of putty.
To avoid getting stumped by the first situation you are going to have to ask for the new name and somehow save it in a config.
To avoid getting stumped by the second you are going to have to ask for the version of putty they want, store that version, and somehow do version checking if all you want to do is look for putty.exe (maybe you have a file of the checksum for each version).
This is just as, if not more annoying to the user (and definitely more annoying to you) than just asking them to point to the executable. There are more ways that things could go wrong, as well.
Basically, it is possible to search for the executable but it would not save anyone any trouble and would only make more for you. Having the user configure the path is not very tricky, but if you want to avoid it then the easiest thing is to have per-user configuration files with the putty path saved in it by your program.
One way is by editing the PATH system variable of the user machines and add the full path of the Putty.exe location.
Another solution is to create a link that points to Putty.exe in a default folder in every user machine, so Java could access to this link w/o problems.
A third solution could be to ship the Putty.exe with your application installer. Putty.exe doesn't need custom DLLs to work (at least I haven't needed one yet).
Theoritically it is possible if you search through every directory on user's computer to find putty.exe. But practically, you should required the file to be put in some familiar directories or use an environment variable.
I agree with people above. Also in your application you can provide ability to user set putty.exe full path and store them in cookies.

How to avoid no main class and no class def found error using DropBox and Eclipse for Java

I use Eclipse to write Java code and use DropBox to sync my code with others' across our multiple computers. Most of the time, everything works as expected: if anyone makes a change on either end, the change is saved and when the other person refreshes the Eclipse workspace, the changes come through and can be viewed and run successfully.
Sometimes, one of several errors arises. Sometimes Eclipse says it cannot find a main class and sometimes it says it could not find the class itself. Sometimes it will not report an error but for some reason will not actually update the .class file and therefore run an old version even though the compiler displays the new source code and that saves. I've then noticed that if I manually copy the code into a new .java file elsewhere in the file system and then compile it, it works fine, but for some reason it refuses to regenerate the .class file and I have to delete it manually and replace it with the one generated in the other project--then it works. But for solving the other problems everything needs to be manually copied, deleted, and re-pasted....
[The actual errors include NoClassDefFoundError, UnsupportedClassVersionError, and some other error related to not having a main class.]
I realize that the description here is somewhat vague, but unfortunately I'm not entirely sure what's going on. I hope I'm just missing some basic fact that would help solve all these problems.
Thanks!
I'm sure you will see issues using Dropbox for sharing your source.
Eclipse does not know what Dropbox is doing whilst it's uploading and downloading updates and their activities will certainly not be synchronised. At arbitrary points in time when Eclipse tries to do builds etc. it will find unexpected activity going on, maybe even partially downloaded source files which might explain the specific errors you are seeing.
You're trying to do something more complex than sharing photos or documents. The advice I would give is to use a source control system like git or subversion for source code sharing and control. You can then make use of plugins for Eclipse that are designed to integrate these systems in an easy to use way. There's a learning curve there, but the skills will serve you well.
You can use online versions of these solutions like github and unfuddle if you want to consume sharing, backup and version control of source as a service like you do with Dropbox. They're free, too.
Subversion, Git and all version control software solve all of these problems for you.
Dropbox is not really an adapted system for sharing code. What you should do is set up a SVN, and commit only the source files. This way, you won't have these kind of errors.
Dropbox does have versioning (you can restore old versions of a file), and doesn't seem to be a horrible solution for the problem. I keep my Eclipse repository on Dropbox so it is available on any computer; but since I only use it myself, I haven't encountered your problems.
There is one case I can absolutely see you running into problems--it's if your class files are stored in the dropbox as well. This would just screw everything up. Make sure you specify a location on your local hard-drive for all build artifacts (classes, jars, ...) and that the only thing on your dropbox is the .java sources.
In fact, I suggest you don't keep your eclipse project in your dropbox, just create your eclipse project and point it to the java files in your dropbox.
If this doesn't work for you, go with what other people here said and set up a SVN repository somewhere, it's easier than you would think.
Oh, another possible problem--dates! You may want to make sure the date on your java files isn't jumping forwards and backwards (as might happen if one of your developers were in another time zone). In this case, Eclipse may prefer not to re-compile your file.
Also, instead of the copy/etc procedure you are currently going through, try forcing a project clean.
Response to request for more info:
When you start Eclipse, select/create a workspace that is NOT on your dropbox. The best place is probably off your home directory. If you have already specified a default workspace, there should be a switch workspace item in the file menu.
Create your project. select "Create project from existing source" and specify the source files in your dropbox. I think you want "create separate folders for source and class files" to keep your class files out of your dropbox. If you see anything saying "Copy files into your workspace, say "no".
This should give you a valid, working project. I hope you don't see those problems any more.
One more thing may help--and this may work on your existing project--without the above procedure...
Whenever you refresh your files (f5) to load in changes from the dropbox, select the Project/clean menu and select the project. This should delete all the class files and rebuild them.
If your classfiles are shared on the dropbox, this could still have strange consequences on other people with eclipse open, so I really do suggest rebuilding your workspace as I said above.
How to avoid no main class
Provide one. That issue has nothing to do with DropBox

Categories

Resources