Configure Eclipse to launch a fixed project in a workspace? - java

I have a small workspace with 3 projects. One main (Swing) application, two other projects that are just libraries.
Now, whenever I change stuff in my library project and want to execute i.e. run with Ctrl+F11) or debug , I have to select my main project first and run that.
Is there any way to set this up more smoothly, so I can just run my program regardless of which of my 3 project that is selected ?

Have a look at the "Launching" preference page. At the botton you can select *Always launch the previously launched application. That should do the trick...

If you are using Maven you can create hierarchical structure of projects, i.e. head and child projects. In this case try to define Run/Debug profile on the parent's project level. Probably it will work from any other child project.
I personally have never try this and unfortunately cannot try this right now but I hope it will work for you.
If it does not work it seem you have to create your own eclipse plugin.
Good luck.

Related

Intellij - Debug multiple Maven projects in different windows

Is it possible to open 2 or more projects, in different IntelliJ instances, and debug across them?
For example:
I start debugging on Project A. Project A calls a method in Project B. I want my debugger to continue on Project B on the other window.
I know a way to debug across multiple maven projects, is to add all the projects to the same IntelliJ instance. But I would like to know if there is a way to do it, without adding all projects to the same instance. To break up the projects in its own IntelliJ windows.
Yeah it is possible
First create a remote debug configuration: Edit configuration -> Remote.
You will see a command line argument which you have to copy and paste it to the script that you made to run your java file.
Keep in mind, to make sure your Project B doesnt starting running before your turn your debugger on, change suspend=n to suspend=y.
Once your parent java file runs go to the secondary idea window and run the remote configuration that you created in first step. If everything is right, your code will stop at the breakpoint.

IntelliJ - Multiple modules in 1 project

Background
So I recently have migrated over to Intellij from heavy use of Eclipse. My goal is to make IntelliJ (currently v14 as of posting) my primary Java IDE. Now, I've been learning what I can over the past couple of days about IntelliJ and it's differences when compared to Eclipse so that I can move mindsets. Things like workspace -> project, and project -> module.
Problem
I want to have multiple modules in a project and simply group them. I do not want multiple windows of IntelliJ open and have to work on multiple projects. I much prefer 1 project with many groupings of modules so that I can easily move between modules. This was working, I starting importing/creating modules and proceeded to add them to a grouping (I had to change the view thingy to another and back for it to update. This thing: http://i.imgur.com/rOlh31h.png?1). Odd, but okay, it was working. Then I was importing a module but some reason it popped up saying do I want to open a new project window, or replace the current project window, I clicked X because I wanted to cancel but it replaced my current project window. Now I've lost all the imported modules.
Question
How can I make a project view persistent? This would be either a way to save a project and then load it later perhaps. It's becoming quite annoying losing all my groupings of modules.
There's no way to overwrite the current project's window through importing modules (as far as I know). Although, when one were to accidentally import a project (thinking they were importing a module) it would surely overwrite the project window if when prompted they chose to open in current window.

Closing unused modules in intellij idea like in eclipse

As I know for now there is no any feature to do that in intellij idea. I dont know why but they dont support to do that, at least this is the result which I found with all my researching. Maybe some of us manage this problem with different ways. How do you work with multiple modules in intellij? How should I increase the performance while working with multiple projects?
Closing unused modules in intellij idea like in eclipse?
You can make that module directory as excluded from that project.
Right clicked on the directory, then goto Mark Directory As -> then click Excluded it
To Add a module back, click on Project Structure button, then goto Modules section, then you can add them back
In Intellij 2017.2, you can easly load/unload modules or groups of modules :
Right click in the "Project" view
Select "Load/Unload modules"
Select modules to load/unload and click OK button
Warning : This is an "experimental" feature
Ref : jetbrains site
The Offline Module plugin let you disable or enable modules in project without deleting.
Click Disable Module in context menu in Project View, it disables the selected modules. Disabled Modules are shown in a group and can be add back by Load Module.
Projects in Eclipse are Modules in IntelliJ. I do not recommend using them the same way - ie importing unrelated projects as modules into one IntelliJ project.
Importing for example database project and application project into one is ok, or when working on one project means working on another.
But when you import too many projects into one, you will have a problem with searching and "Go To File/Class" actions, and you will use too much heap space.
Generally, when you have a lot of opened projects, there are three problems
too much used heap -> GC pauses.
switching between them is hard
closing and reopening a lot of projects is hard
To solve this, I have made Frame Switcher plugin for easier switching between projects, and reopening closed ones.
Also, when you have 32 bit Windows and have too many projects, then you need to start new IntelliJ instance, and Frame Switcher can integrate them.
There is also Missing Functionality plugin which lets you "Close All Other Projects".
Since the old "Offline Module" doesn't work, I made a plugin to utilize the mechanics of "Mark as Excluded" to quickly show/hide multiple modules.
Link to module here: https://plugins.jetbrains.com/plugin/7803?pr=idea

Non-existing MySql message error

I have to build a Decision Support System, but dont have much experience in Java. So after I connected to MySql with Eclipse (with Connector/J) eclipse started to mess up my other projects. Now, when i try to run other projects in eclipse (that are not related to MySql, ex. Guessing Game) the following error message apperars:
Launch configuration DocsConnectionPropsHelper references non-existing project MySql connection test.
Can anyone help me to resolve this problem please?
UPDATE. it seems that when i press "RUN" elcipse is not running the project that im working with, but other
Your update indicates the issue is actually running the wrong project. To avoid that you may want to close projects you're not working on (right click them in package explorer and select close).
If you do need multiple projects open then when clicking the run icon (which defaults to re-run whatever was ran last among your open projects) make sure you have open in the editor window something that can be ran (and is from the project you want to run).
Then click the drop down arrow to the right of the icon. This will open up a small menu with options to change your build configurations or how it should run your program (i.e. as an application or on a server).
To solve the problem:
-click right botton on the project package you want to work on (run)
-choose Run As
-choose Run Configurations...
-choose DocsConnectionPropsHelper - if in the Project box you see not correct title just remove it. Also remove anything what is in the Main Class box.
-click Apply
-the best option is to close Eclipse and reopen it to make sure that all the settings were configured
It worked for me. Hopefully it will work for you too.

Handling the export in eclipse thru a plugin

I have a java application that have different settings and dependency versions depending on the company branch it is install in.
So what I did is to create a plugin that create an item in the right click context menu of the project in eclipse to make these changes.
However I am wondering if its possible to catch the OnExport event of eclispe (if it exists) and do this automatically everytime the solution is exported.
Would this be possible?
Many thanks
If I understand what you're asking correctly, the Eclipse way to do this would be to write a Builder and add it to the project; then the settings file would be rebuilt whenever it's appropriate, making an up-to-date version always available to export. Here is a good place to start learning about how to do this.

Categories