Build and Debug Tomcat Source in Intellij - java

I need to build and debug tomcat in intellij. I have tried a number of guides as noted below without much success.
System Variables:
ANT_HOME = C:\Users\User1\Desktop\Tomcat\apache-ant-1.10.9
CATALINA_HOME = C:\Users\User1\Desktop\Tomcat\apache-tomcat-9.0.41
JAVA_HOME = C:\Program Files\Java\jdk1.8.0_281
PATH: ...;%JAVA_HOME%\bin;%ANT_HOME%\bin;%CATALINA_HOME%\bin
File Paths:
C:\Users\User1\Desktop\Tomcat\apache-ant-1.10.9
C:\Users\User1\Desktop\Tomcat\apache-tomcat-9.0.41
C:\Users\User1\Desktop\Tomcat\apache-tomcat-9.0.41-src
Intellij Version: 2020.3.1
Possible solution (LINK) but how would you open up the project and how would you configure the run/debug? I believe this would work but I need a step-by-step guide on how to open this in intellij and how it can be built and debugged.
cd apache-tomcat-9.0.41-src
ant -buildfile build.xml ide-intellij
Alternative solutions but appear outdated:
Solution 1
Solution 2

how would you open up the project
To open the project you should be able to just use File | Open action in Intellij IDEA after running the ant -buildfile build.xml ide-intellij.
how would you configure the run/debug?
Use steps from RUNNING.txt to set up teh all the environment variables and in Tomcat startup script catalina.sh script right above the first line that reverences the JAVA_OPTS variable, add this line:
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=64998"
Now, restart Tomcat. Next, in IntelliJ, create a Remote JVM Debug Run/Debug Configuration, enter the port just like in the command line (64998), save it and then press "Debug" in IDE

Related

Original error: Could not find 'aapt' in ["/usr/local/share/android-sdk/platform-tools/aapt"] Appium - Eclipse

I am currently trying to learn about Appium Automated Testing. Everything is setup perfectly on my Mac.
All my environmental variables are set up correctly :
export ANDROID_HOME=/Users/abc/Library/Android/sdk
export
PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
However when I run the eclipse program, eclipse throws an error saying:
remote stacktrace: UnknownError: An unknown server-side error occurred
while processing the command. Original error: Could not find 'aapt' in
["/usr/local/share/android-sdk/platform-tools/aapt","/usr/local/share/android-sdk/emulator/aapt","/usr/local/share/android-sdk/tools/aapt","/usr/local/share/android-sdk/tools/bin/aapt"].
Do you have Android Build Tools installed at
'/usr/local/share/android-sdk'?
So my question is why eclipse is looking for Android SDK tools in usr/local , my sdk tools are located in
/Users/abc/Library/Android/sdk.
How can I tell eclipse to look for the appt,adb, etc in my User folder and not the admin usr folder.
My expectation is that your PATH variable has /usr/local/share/android-sdk/emulator/aapt entry and it is resolved before your additions of the ANDROID_HOME variable.
So either remove that Android SDK which lives under /usr/local/share/android-sdk/ from your operating system like:
brew cask uninstall android-sdk
or amend your PATH variable definition so your "good" Android SDK installation goes before anything else like:
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
See Appium Java Code examples for more information regarding proper setup of Appium environment. You might also want to check the integrity of the infrastructure setup using appium-doctor
appium-doctor --android
I just struggled with on MacOS Catalina 10.15.3, Appium 1.10.1, Appium Doctor v.1.13.0 trying to set up Android with Appium.
Make sure you are changing the correct file. You have 3 possible locations.
~/.bash_profile
~/.profile
~/.zshrc
I was editing my ~/.bash_profile instead of ~/.zshrc you can have a situation where you are setting the correct path but not in the right file.
If your trying to get going with Android Appium in Mac here is what I put in my ~/.zshrc at the bottom
# Android Paths for Appium
export ANDROID_HOME=/Users/**PUT_YOUR_USER_NAME_HERE_WITHOUT_STARS**/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform_tools
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH=${JAVA_HOME}/bin:$PATH
Also if you don't want to edit in a terminal-based editor use the following command to open the files in a text editor.
open -e .bash_profile
open -e .zshrc
open -e .profile
After editing do not forget to save.
Quit your Terminal.
Run Appium_Doctor
The following post helped me out a lot when setting up my Appium
appium-workshop/Appium Mac Installation Instructions
https://github.com/isonic1/appium-workshop/blob/master/Appium%20Mac%20Installation%20Instructions.md
If you have a system-wide eclipse installation, it usually won't read your environment variables from your .bashrc or .bashprofile, but from /etc/environment.
If you don't want to modify this file, or if it doesn't exist on a Mac, then you can always set the variables at a project level. This is done in the "Environment" tab of the configuration (run, debug, external tools,...) you're running within Eclipse, like this:

Update to IntelliJ 2017.1 causes JAVA_TOOL_OPTIONS to print

This morning I updated to IntelliJ IDEA 2017.1, when I run any of my tests, and even run a hello_world project I made, the console prints a message stating Picked up JAVA_TOOL_OPTIONS: -agentpath:"C:\windows\FireEye\JavaAgentDll_00.dll" after executing my program.
Also, when I try to run in debug mode I receive the error:
ERROR: JDWP unable to get necessary JVMTI capabilities.
If I run the program outside of IntelliJ I do not receive these errors. Is there a solution to resolving the error and is there a reason the JAVA_TOOL_OPTIONS is now "picked up"?
Remove this environment variable from the system or configure the run/debug configuration to not include parent environment:
I solved this problem by adding the following command into idea.bat file:
UNSET JAVA_TOOL_OPTIONS
I'm running IntelliJ 2017.1 on Windows 7, and my idea.bat file is located at C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2017.1\bin folder.
The top 5 lines of my idea.bat file looks like these after the changes:
#ECHO OFF
UNSET JAVA_TOOL_OPTIONS
::----------------------------------------------------------------------
:: IntelliJ IDEA startup script.
::----------------------------------------------------------------------
I've had the same problem at work. This is probably FireEye knowledge rather than an IntelliJ answer, but I find that when I run IntelliJ as administrator the problem goes away without any settings changes, so this works if you have admin access to the development box.
Note that if you start IntelliJ from the IDEA toolbox then the toolbox also needs to be run as adminstrator.
Another way to override the env is from the from the Help | Edit Custom VM Options menu of all places.

Can't set up Maven on Mac OSX

I am new to Mac OSX and I'm running Yosemite. I am trying to set up Maven using this official guide in order to set up a Google Cloud Messaging Backend. Here's what I did:
1) Downloaded Maven zip (version: apache-maven-3.3.9) and Unzipped it
2) As the guide says, I need to add the bin directory to my PATH variable. So I did the following in my terminal
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
The terminal didn't return any response. However when I checked to see if Maven got installed using:
mvn -version
I get a message saying:
-bash: mvn: command not found
What am I doing wrong? Did I follow the steps properly to set up Maven?
EDIT:
MVN Bin Directory path is:
/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9
I tried all the manual steps here and still couldn't get it to work. Then I realized I can easily install it using Homebrew, much more convenient:
brew install maven
that's all you need to install maven for mac!
The $PATH is what point where your programs are, because of that you change it in order to find mvn. Actually you are pointing $PATH to $M2_HOME/bin.
You need to update $M2_HOME to one directory level before mvn bin and before update $PATH.
If this is your mvn home:
/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9
you should use this env vars:
export M2_HOME="/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9"
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_60"
export PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH"
You can also edit your ~/.profile in order to include these lines, so you don't need to type these exports whenever you open your terminal.
Do
export M2_HOME=/Users/Earthling/Documents/Projects/MobiProject/apache-maven-3.3.9

Cannot run program "adb" from IntelliJ plugin

My problem is that I want to run shell command from Java code (my IntelliJ plugin):
Runtime.getRuntime().exec("adb devices")
But then I receive IOException:
Cannot run program "adb": error=2, No such file or directory.
What is odd is that when I run it on debug mode it works, it's broken only when I deploy my plugin to real IntelliJ. The command also works from any terminal.
The only thing which works now it typing the command with full path:
/Users/adamstyrc/utils/adb
But it's not a solution. How to fix it ? My guess would be to manually load bash PATH variable add adb exec file to project but it's not elegant solution. Thanks in advance!
You need to be sure that the correct path settings are passed to IntelliJ.
If you for example modified the path settings, or if you ran intellij from a different terminal or user, then they might not be correct.
To be sure, close down IntelliJ, start a new terminal - then verify the path settings - and start IntelliJ manually from that terminal.
If you are running a 64 bit machine, try installing 32-bit libraries using
apt-get install ia32-libs

How to start JBoss AS 7.1.1 on Windows?

I am new to JBOSS.I downloaded jboss-as-7.1.1.Final.zipand unzip this zip file.
Then I go to bin folder and double click on standalone.bat but new cmd window open and close within 2 -3 sec.
I tried to start server throught cmd.I open cmd in 2 ways
1.normally mode
Run as Admin (Admin Mode).
In 2 ways I get:
Calling "P:\Software\JBOSS\jboss-as-7.1.1.Final\bin\standalone.conf.bat"
'findstr' is not recognized as an internal or external command,
operable program or batch file.
then it stops.
So the JBoss server does not start.
I added Environment Variables like.
JBOSS_HOME : P:\Software\JBOSS\jboss-as-7.1.1.Final
JAVA_HOME : C:\Program Files\Java\jdk1.7.0_21
How can I run JBoss server and deploy projects in it on Window 7?
Add the following value to Right Click My Compuer -> Advanced -> Environment Variables -> System Variables -> Select Path variable -> append the below value.
C:\WINDOWS\system32
It should work with that change.
#All, Finally I got it,why I am getting this problem 'findstr' is not recognized as an internal or external command, operable program or batch file.
Because the following path C:\Windows\System32 was not set in Environment variables. I found through google.I fix it and run my server it's working great.
Thank you guys for your valuable suggestions.
You have to go to your bin folder P:\Software\JBOSS\jboss-as-7.1.1.Final\bin\ and then execute run.bat or standalone.bat
If you still get errors, you should delete your entire JBoss folder and then install it again and try to run it with the default settings. Once you've confirmed that works, change the settings 1 by 1 so that you know which setting caused your server to not start up.
You could better add it in to any IDE(eclipse) and then deploy your application. That should be easy to manage your applications

Categories