NetBeans doesn't find projects on OneDrive - java

I have a pc and a laptop both running Windows Pro 8.1 and latest version of Netbeans. I log on the pc and the laptop with the same hotmail/windows account. I build my java projects on the pc and i save them on a OneDrive directory just fine all working ok. BUT when i try to open them on my laptop NetBeans sees the folders with all the files in them but doesnt find the projects so it is unable to open them. So i cant edit or work on any of my projects on my laptop. Is using a usb drive to save my projects my only way to mobility?

Turn off "Compile on save" for the project:
[project name]-> Properties -> Build -> Compiling.
This removes the project's build subdirectory, whose contents include
build/classes/.netbeans_automatic_build
build/classes/.netbeans_update_resources.
OneDrive sees these files as nameless with long extensions.
You can enable "Compile on save" in working sessions if desired,
just disable it when you want to make it available to other machines.

You may need to ensure the files are available offline. Windows 8.1 and OneDrive use a feature of Windows where files appear to be in a folder but may not actually be there yet (because they are in the cloud). While most applications are able to trigger files to be downloaded when opened, not all applications are compatible.
Try forcing the folder to be available offline by right clicking on the folder and selecting "Make available offline" and see if that resolves the problem.

NetBeans along with a number of other multiplatform applications tend to save configuration files in .settings/.configuration files. And unfortunately as of today the OneDrive client does not support syncing files the begin with a period. The OneDrive team is aware of this limitation and is looking into fixing this.
Not great solution, but a potential work around:
- Stick your NetBeans projects in a zip, 7z, tar or whatever convenient packaging format of your choice would be before you leave that machine.
Ultimately it sounds like your scenario is around using source control. While it is certainly not as easy as just using sync'ed folder, you could use a source control management tool like SVN, Mercurial, or Git.

Related

Use Intellij and netbeans at the same time in the same workspace

I was provided with a Ubuntu virtual box that has netbeans installed whereas locally I have Intellij. My Java workspace is shared between guest and host, therefore I was wondering if there will be any kind of conflict by running Intellij and Netbeans at the same time in such conditions.
Thank you for your help.
I am not sure how the guest-and-host-OSes condition would play into this but I am pretty sure otherwise that the workspace can be shared by both of them especially when they are not working on the same project. Even if they are, it'd be you who'd be getting confused as files would get updated on both IDEs as the other one makes any changes.
There should not be any conflict as long as you have read/write permissions on both the OSs.
However, to track the changes to code in a better way, use a version control system like subversion.
Also, do not copy the resources to your workspaces. Instead check out the code directly to your workspace.
This don't cause conflicts because each IDE adds a set of configuration files per project, for example: netbeans generates the nbproject folder, where is the project configuration for that IDE, while intellij generates a projectName.iml file and the .idea folder where is the configuration for the project.
If you use a version control tool as git, svn, mercurial, is recommended that you synchronize your project in each environment (guest and host) with your repository and do not share the workspace between them.

Eclipse - difference between these installation methods?

I am wanting to install eclipse for study/school purposes. I am after "Eclipse for Java".
On the eclipse website, there seems to be two ways to achieve this:
(a) Use the eclipse installer (where you choose which eclipse you want to download and it does it for you)
(b) go the the 'dowload packages' page, download a zip file e.g. "java-neon-64-windows.zip" and then unextract the zip
I tried both of these methods. However, the resulting eclipse folders from both these installations is of different sizes.
Method (A) installation was 20.7MB
Method (B) installation was 192MB
Please clarify what causes this huge difference and which one of these should I use for my purpose??
Thanks
The zip is a standalone (for example if you don't have admin rights) on your laptop. The other is a standard installer, which is still gonna be heavy but use the architecture of the system to install in a more "standard way". On Windows, a program folder's size, in C:Program Files, is not the size of the full application by the way.
Eclipse installer stores the Eclipse plugins on a different location than your Eclipse product's directory tree. This allows installer to create multiple Eclipse products without downloading all the plugins again. You can probably find the plugin pool under ~.p2/pool.

Importing .war file using cmd

I'm developing an Installer for a project team to reduce the amount of work they have to do installing it manually.
We are using:
Windows 7 x64,
Eclipse Kepler
Right now I'm looking for a way to import a .war file using the commandline.
Is there any way to do this via cmd?
First of all, I would not recommend importing the source code from a file in Eclipse if you have a team of developers, as you would be giving everyone a version that will hardly be actual after some days of work. Using some repository (CVS, SVN, GIT) would be the way to go.
If you have your code in a central repository, then you could make a "Project Set" file in Eclipse wich can be imported easily to setup your whole workspace:
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-cvs-project-set.htm
This project set might have instructions on how to construct the Workspace based on checkouts of the repositories you need.
If you happen to work at a company that uses some X or Y old-fashioned Source Control tool (or worse, none at all), and you have no chances of implementing one that is compatible with Eclipse (like the three I stated above), then the time you are saving with automating the import of a war file will become irrelevant compared to the source code control issues you will be facing (or the team is facing already).
A WAR file is a ZIP file. If you need the content of the WAR you can use the tools for ZIP archives.
A workaround in case eclipse does not have any such options would be to
do a Import WAR through eclipse GUI
check what changes are made to workspace by eclipse (eg. folder created with exploded war file content, configuration files created by eclipse in the folder like .classpath for project folders etc)
Identify the steps and replicate the same through a batch file
Add a call to the batch file in eclipse launch short cut
There is no command line API I know to do this task for Eclipse just from command line, but with the right tools you can achieve what you want.
Please try this:
Straightforward approach that works with any GUI application. You can use AutoIt scripts for interaction with any application. The downside is that GUI may change more frequently than command line API.
Try to create Eclipse project with metadata and unpack WAR file in this project. It can be done, for instance, with Maven or Gradle. Those also can download all dependencies for you.

How to install eclipse for java developer,c/c++ developer, php developer at the same time?

Now I am trying to install eclipse on my computer under Windows 7. The problem is how to install the eclipse for java,c/c++,php,javascript concurrently?
Would donwloading the four zip files and then unziping them all into one directly say d:\eclipse works?
Is there any good tutorials for installation/configuration of eclipse?
The zips are just pre-bundled archives of Eclipse plus the relevant plug-ins. Just pick one, install it, then use Help | Install New Software to add the other plug-ins you want.
You can download all the zip directory and unzip it in the same folder (e.g. ECLIPSE_HOME) and run eclipse. Eclipse will first inspect it 'plugins', 'features` folders and update configurations for future use.
Alternatively, you can download the main eclipse (Simple Eclipse for Java SE) and goto Help --> Install New Software menu and select the C++ packages (and all relevant packages) you need and install.
You could either download eclipse for one of the languages and then download plugins for that one or you could download the four separate zips and unzip them to the same PARENT folder!
Like:
/Eclipse/Java
/Eclipse/C
/Eclipse/Cpp
/Eclipse/Php
I'm not sure what would happen if you'd unzip them to the same folder, but I would dissuade it. By unzipping them to a separate folder you can launch a specific eclipse installation for one of the views, so you won't have to switch views.
Also, I remember that having one eclipse version with multiple plugins tends to make eclipse messy (at least at the time when I was using it, more or less a year ago)

Deploy java (command line) app using Netbeans / ant

I've finally managed to create a Netbeans project out of an old standalone (not Web-) Java application which consisted only out of single .java sources. Now I have basically two questions regarding Netbeans Subversion interaction and application deployment:
Do you check in all the Netbeans project files into the repository, normally?
If I build the project using Netbeans (or ant) I get a .jar file and some additional jar libraries. In order for the app to run properly on the server, some additional config files and directories (log/ for example) are needed. The application itself is a J2SE application (no frameworks) which runs from the command line on a Linux platform. How would you deploy and install such an application? It would also be nice if I could see what version of app is currently installed (maybe by appending the version number to the installed app path).
Thanks for any tips.
No, not usually. Anything specific to NetBeans (or Eclipse, IntteliJ, etc), I don't check in; try to make it build from the command line with your ant script and produce exactly what you want. The build.xml is something that can be used for other IDEs, or in use with Anthill or CruiseControl for automated builds/continuous integration, so that should be checked in. Check in what is needed to produce/create your artifacts.
You don't specify what type of server, or what exact type of application. Some apps are deployed via JNLP/WebStart to be downloaded by multiple users, and have different rules than something deployed standalone for one user on a server to run with no GUI as a monitoring application. I cannot help you more with that unless you can give some more details about your application, the server environment, etc.
Regarding the config files, how do you access those? Are they static and never going to change (something you can load using a ResourceBundle)? ? You can add them to the jar file to look them up in the ResourceBundle, but it all depends on what you are doing there. If they have to be outside the jar file for modification without recompiling, have them copied with an installer script.
As for directories, must they already exist? Or does the application check for their existence, and create them if necessary? If the app can create them if absent, you have no need to create them. If they need to be there, you could make it part of the install script to create those folders before the jar files are installed.
Version number could be as simple as adding an about box somewhere in the app, and looking up the version string in a config/properties file. It has to be maintained, but at least you would be able to access something that would let you know you have deployed build 9876.5.4.321 (or whatever version numbering scheme you use).
Ideally, you should not tie down your application sources and config to a particular IDE.
Questionwise,
I suggest you do not. Keep you repository structure independent of the IDE
You might have to change your application so that it's structure is very generic and can be edited in any IDE.
Is this a web app? A standalone Java app? If you clarify these, it would be easier to answer your query.
We don't check in the /build or the /dist directories.
We tend to use this structure for our Netbeans projects in SVN:
/project1/
/trunk
/tags/
/1.0
/1.1
/binaries/
/1.0
/1.1
When a change is need we check out the netbeans project from trunk/ and make changes to it and check it back in. Once a release of the project is needed we do an SVN copy of the netbeans project files to the next tag version. We also take a copy of the deployable (JAR or WAR) and place it in the version directory under binaries along with any dependencies and config files.
By doing this we have a clean, versioned deployable that is separate from the source. Are deployables are version in the name - project1-1.0.jar, project1-1.1jar and so on.
I disagree with talonx about keeping your source non-IDE specific - by not storing IDE files in SVN along with you source you are adding extra complication to the checkout, change, checkin, deploy cycle. If you store the IDE project files in SVN you can simply check out the project, fire up the IDE and hit build. You don't have to go through the steps of setting up a new project in the IDE, including the files you SVNed, setting up dependencies etc. It saves time and means all developers are working with the same setup, which reduces errors and discrepancies. The last thing you want is for a developer to check out a project to make a small bug fix and have to spend time having to find dependencies and set stuff up.
To answer question #2 -- who's your consumer for this app?
If it's an internal app and only you (or other developers) are going to be deploying it, then what you have is perfectly all right. Throw in a README file explaining the required directories.
If you're sending it out to a client to install, that's a different question, and you should use an installer. There are a few installers out there that wrap an ant script and your resources, which is a nice approach particularly if you don't need the GUI... just write a simple ant script to put everything in the right place.
Version number is up to you -- naming the JARs isn't a bad idea. I also have a habit of printing out the version number on startup, which can come in handy.

Categories