How to edit and debug OAF java code in IntelliJ IDEA - intellij-idea

I agree that JDeveloper provides some unique ADF-specific functionality, but when it comes to work with java code, IntelliJ IDEA works better for me. Can I move java-related operations to IDEA?

Setup
Create IDEA project from existing sources, setup source folders and connect libraries.
Setup IDEA run configuration. "Listen to remote JWM" means that IDEA will act as a server and Jdev will connect to it as soon as it starts running. It is good if you need to debug processRequest() method - debugger must be connected immediately. I chose "JDK 1.4.x" because it looks closer to VM parameters which Jdev uses when it starts debugging (you can look at those is Jdev log while debugging).
Setup Jdev as a client. Append VM options from IDEA to your existing options.
Running
To start debugging, first, run IDEA run configuration with green bug button, and second, run Jdev with green play button.

Related

Intellij 2018.2 stops working and exits on MacOs. What might be a problem?

As an daily IntelliJ user you usually concentrate on the projects you are working on and IntelliJ is just a tool. You are not willing to dig into tool's problem itself. But this is what is forced on you by default after IntelliJ installation on MacOS and opening relatively big project(most of the projects nowadays are huge and have thousands of files and use numbers of IntelliJ 3rd party plugins).
Here is a minimal list of actions. IntelliJ must have set MORE RAM to be used by default.
Read: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files .
From IntelliJ open Help / Show log in Finder and open idea.log file with Console.app; In Console.app press "Reload" and "Now" buttons to track "live" what IntelliJ is doing.
If in logs of IntelliJ you find that some of the plugins exit with fatal error, you just uninstall those plugins. For me the one that failed to the moment of this answer was "BashSupport" as example.
Start Terminal.app ; Run command: open -a TextEdit /Applications/IntelliJ\ IDEA.app/Contents/bin/idea.vmoptions ; Change options in idea.vmoptions file to:
-Xms1024m
-Xmx2048m ; Read https://www.jetbrains.com/help/idea/tuning-the-ide.html to see how you can tune IntelliJ for your project. This step is handy when your IntelliJ app doesn't start at all and you want to change properties in a global way.
From IntelliJ open Help / Edit Custom Properties.... Here you can set same properties that will override global and will work only for current OS user.
Also there is also a possibility of underlying OS to do it voodoo magic so the IntelliJ won't work as it should like here - https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000398280-IDEA-Ultimate-2018-2-Unable-to-save-settings-Unable-to-create-file-Windows-10
Make sure your project build output for *.class files is set. Read: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000000584-Build-does-nothing . In my case when IntelliJ started project build it terminated without warnings shortly after.
Finally in my case none of 6 steps above solved the issue so I found this read: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000532044-IntelliJ-cannot-build-projects . Basically try reinstall IntelliJ from original distribution again.
I know that you must read https://www.jetbrains.com/help/idea every time you install a new version of IntelliJ, but why not to add some consistency into configuration process of the main java process that runs IntelliJ itself? You can ask how much ram to use during installation of IntelliJ and explain why it is so. Then Help digging won't be necessary in the first place for devs who fed up with changing those default settings that will be always more than 700MB. I think for most devs out there it is at least 10x of that. I bet what makes most devs mad about this is not the fact that you need to do some options changing, but where those options are depending on OS plus the fact that you simply forget why IntelliJ app just exits while you are doing a debugging of your own app. I bet this problem makes us mad since first java based IDEs appeared. User-friendly is the key here and explicit reminders within the app itself would help.

Start with MonetDB development

I want to integrate features into MonetDB, more specifically into the dictionary part of it. I found some information here, but this is not really elaborate.
The concrete feature I want to integrate is secondary in my question here. My biggest hurdle at the moment is: how do I start to develop MonetDB?
I was able to download the source and build it as described here. But where to go from there?
My preferred way would be: get MonetDB in some form of an IDE, set various breakpoints, send a SQL query and explore the code from there.
Is this possible? What development environment do you use? Is gdb debugging the only possibility? How do you debug?
Meanwhile, I figured it out myself. Maybe, somebody else will face this problem, wherefore I answer my own question. I finally ended up with Eclipse and describe a possible way to start MonetDB development/debugging:
Clone MonetDB repository from the official repository, e.g., from Github
Download the C++ version of a current Eclipse release
In Eclipse click on File > New > C/C++ > Makefile Project with Existing Code > Next. Insert the cloned repository dictionary as Existing Code Location and select the GNU Autotools Toolchain
Now you should be able to build MonetDB inside of Eclipse
After a successful build, you can choose Binaries from the Project Explorer. There you can right click the different binaries and use to run as or debug as
This finishes the setup of MonetDB inside Eclipse. Now, it depends on what you want to debug. If you want to change something at the server, you might want to debug monetdbd. My tips to do this are:
Start debugging of monetdbd per right click as explained before
Close the debug session and adjust the debug configuration
On the Arguments tab, insert the arguments: start -n <path to your dbfarm>. This will keep the database daemon from going into the background
On the Debugger tab, select Automatically debug forked process and optionally Non-stop mode
A new debug session will now automatically stop at the main of monetdbd and will also show the threads of the forked mserver5 process

Deployment from within IntelliJ IDEA

Deployments from IDEA are possible, e.g. I can connect to remote server and I can upload a package. The deployment process I have involves a little bit more than just deploying a file on server.
Once the file is uploaded I need to run certain commands to complete the deployment which mean I need to connect to the server and run those commands one by one and I am looking to do that through one click from the IntelliJ IDEA.
Is that possible?
This is how the project directory looks like:
This is how I am trying to setup deployment:
if you click on that little "Fix" button that's what I see
Even if I try to remove the unwanted entries they come back and never go away.
Finally this is what my project structure looks like in idea
Yes, you can use Remote SSH External tools. Make a script that will run your commands, deploy it to the server as well, then run this script remotely via a tool.
In the Run/Debug configuration Before Launch steps you can add your remote external tool to run automatically.
You can find some more details in my another answer.

Worklight Console can not be opened because the Worklight Server is not running

I'm just getting started with some of the samples at the Getting Started site, working with the Developers Edition. Whenever I Open Worklight Console, the eclipse environment abends. I'm sure I missed a set up item, but all seemed to install well. I appreciate any help / direction. Thanks.
I tried to post an image of the error, but stackoverflow indicates I need 10 reputations to post an image. Go figure.
The first line is Java was started but returned exit code=8096
There are some hits on this indicating that the license may not be compatible with the Rational license installed. Not sure what to do with that.
There's another post indicating Environment Variable corruption, but I don't have the corrupt Temp environment variables indicated.
StackOverflow has a FAQ explaining what one can and cannot do and when. It makes sense. Read it.
Did you at least create a new Worklight project and application?
If you do that and run the application by right-clicking on the application in the project tree and choose Run As > Run on Worklight Development Server this will: start the server + build the app + deploy the app.
Then you can right-click on the project icon and choose Open Worklight Console and you will see the console...
So unless you have some errors preventing the server from loading, the above should work.
Host the image elsewhere, like imgur.com
Explain what you have installed in your Eclipse. Which Eclipse is it? Did you install only Worklight Studio, or another plug-in in addition? Which?
What are those "hits" you mention? Elaborate.
Searching for the exit code in Google, I see the following IBM tech notes:
http://www-01.ibm.com/support/docview.wss?uid=swg21303648
http://www-01.ibm.com/support/docview.wss?uid=swg21567836
http://www-01.ibm.com/support/docview.wss?uid=swg21627887
Perhaps one of them is relevant for you as well.
If you have followed Idan's advice to Run on Worklight Development Server and it is still not started, try this:
Switch to the Servers view (on the bottom pane of Eclipse by default).
Check your Worklight Development Server status
Right-click and select Clean...
Select OK when prompted to discard all publish start.
Redeploy your app using Run As > Run on Worklight Development Server
I am not sure if this would clean up your environment variable error message as I have not seen that one, but it has helped with several other errors that have caused my server to not start or run properly. (The most common one I get is an Out of Memory in the server.)

How to enable hot swapping in debug mode with gradle and jetty?

I'm using jettyRun for running my simple spring application. I wanted to enable hot swapping with Intellij debuger, but looks like jetty doesn't catch the changes.
On http://docs.codehaus.org/display/GRADLE/Gradle+Jetty+Plugin I seen that it should work with:
jettyRun.scanIntervalSeconds=1
On the other hand, there is some inconsistency. On the gradle homepage this parameter is not listed: http://www.gradle.org/jetty_plugin. Anyway, is there any way to enable this on gradle?
Heh, actually found it myself now.
Looks like this parameter is not needed at all. Hot deploy works anyway.
I just wasn't able to seen that because my vaadin application was keeping session even after F5. To restart it properly it's enough to add ?debug&restartApplication to the application url.
So, Ctrl+Shift+F9 in IntelliJ + F5 in the browser (with ?debug&restartApplication) works fine ;)