Update to IntelliJ 2017.1 causes JAVA_TOOL_OPTIONS to print - java

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.

Related

Build and Debug Tomcat Source in Intellij

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

sourceanalyzer: command not found (mac)

I just installed a newer version of the Fortify package (4.30) but every time I try to use the command line to manually scan a project, I get an error that sourceanalyzer isn't an available option. I've tried reinstalling and I still cant get it to work. I can only scan in audit workbench. I never had this problem with earlier versions of Fortify.
Add this line to your ~/.bash_profile
alias sourceanalyzer="/Applications/HP_Fortify/HP_Fortify_SCA_and_Apps_4.xx/bin/sourceanalyzer"
Note: Where it says HP_Fortify_SCA_and_Apps_4.xx, put the version you are using here. Make sure your path is working and you shouldn't have to worry about it anymore. Don't forget to update this when you update your fortify application.
After this is done, just run the following command in your terminal:
source ~/.bash_profile
that will reload the bash_profile in your terminal.
Start /Applications/HP_Fortify/HP_Fortify_SCA_and_Apps_4.30/bin/sourceanalyzer
Open a new tab and run your fortify bash script or run sourceanalyzer command from here
It still will not run in my other terminal windows, but will only run in this one.
Is HP_Fortify/HP_Fortify_SCA_and_Apps_4.30/bin in your path system variable? For Windows, look at system properties, advanced, environment variables, then edit the PATH system variable and look for the entry for 4.30/bin.

IntelliJ - why does the terminal has different environment variables values

I have recently replaced Java 7 to Java 8.
All regular apps in IntelliJ runs smoothly.
All but the tomcat apps - which run from the cmd command line but not from IntelliJ.
It fails to load due to an error in the JRE_HOME definition.
I have oviously defined JRE_HOME in the env variables and in the jdk settings.
I have executed
echo %jre_home%
both in the IntelliJ terminal and in the cmd and received different values
(IntelliJ terminal showed unupdated value.).
Where are the variables in the terminal declared?
How do I change them?
I don't know about old IntelliJ versions, but in 2019.2.3 one can configure environment variables in project settings. Be aware, you need to restart existing terminal or create new terminal tab to see the effect.
Almost 5 years later, I have the same issue on Windows 10 and had to restart my computer to solve it.
Edit:
The best solution is to not define a JRE_HOME environment variable. I don’t know why but IntelliJ stucks using that env variable.
If you are launching IntelliJ via the JetBrains ToolBox it will cache the $PATH variable so recent changes will not appear.
Just close and re-open JetBrains Toolbox.
For me it was because IntelliJ IDEA did not launch the shell as a "login" shell. All of my environment variables are set as I expect in a login shell, but in a non-login shell, many of them are missing.
By way of example, I expect /usr/local/bin to be in my PATH, but that is only true within login shells (as I get when I run iTerm2). This is an excerpt from a terminal session within IntelliJ IDEA:
amacleod#valjean ~> echo $PATH | grep -c /usr/local/bin
0
(1) amacleod#valjean ~> $SHELL --login
Welcome to fish, the friendly interactive shell
amacleod#valjean ~> echo $PATH | grep -c /usr/local/bin
1
One possible workaround would be to add my expected PATH and other variables to the shell configuration for non-login shells, but I would really rather just always be in a login shell.
I would have hoped that IntelliJ IDEA would have a checkbox for sending --login in the Terminal settings. However, it is possible to override the Shell path setting to include the login flag.
Invalidating the systems cache should do the trick. see JetBrains: Invalidate Cache.
Any other measures (like closing projects and IDE seemed to work only on a per project basis and only after a while (when IDE detected that the cache is invalid by itself ...)
Edit:
Correction - Unfortunately, after having the corrected the environment in all terminals for a while, IntelliJ "reverted" to the old, incorrect environment in any of my projects. Now I hope that after a reboot - as posted by akuman8 - the issue is solved. (If not, I will stick to a commandshell of my choice outside the IDE, where everything works fine ...)
For me, invalidating the system cache or restarting IntelliJ didn't reload the updated environment variables.
After restarting the computer, it enabled IntelliJ to pick up the updated environment variables.
AFAIKT, the intellij terminal on linux is just the same as running a standalone terminal session. It's just conveniently located in the IDE.
In response to the question, "How do I change [the terminal environment variables]?"
I'm using virtualenvwrapper to manage my terminal's environment variables for different environments, such as dev, test and production. It's working just as well for java development as it was for python development.
https://virtualenvwrapper.readthedocs.org
Close all IntellJ windows and any process that may currently be using the wrong SDK.
Navigate to the folder where your JDK is installed (e.g. C:\Program Files\Java).
Rename the wrong SDK so something else (e.g. jdk-11.0.5.OLD). If it won't do this, you may still have a process running using that SDK; go back to 1.
Start IntelliJ again.
It seems you can define project specific environment variables:
In IntelliJ project specific environment variables you can set under
Run/Debug configurations --> Defaults --> Application --> Environment
variables
from:
http://emmanuelbernard.com/blog/2012/05/09/setting-global-variables-intellij/#comment-617922540

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

IntelliJ Idea 11 Flex compilation issue

I have problem with completing my code. It works fine in Flash Builder. But I used it previously in Idea and it was much faster. So I imported my FB files into new Idea project. But when I try to debug I receive error message:
Using built-in compiler shell, up to 4 parallel threads
See compiler settings at File | Settings | Compiler | Flex Compiler page
Starting Flex compiler:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -d32 -Dapplication.home=/Applications/Adobe/flex_sdk_4 -Xmx384m -Dsun.io.useCanonCaches=false -Djava.awt.headless=true -Duser.language=en -Duser.region=en -Xmx512m -classpath "/Applications/IntelliJ IDEA 11.app/plugins/flex/lib/idea-flex-compiler-fix.jar:/Applications/IntelliJ IDEA 11.app/plugins/flex/lib/flex-compiler.jar:/Applications/Adobe/flex_sdk_4/lib/flex-compiler-oem.jar" com.intellij.flex.compiler.FlexCompiler 58789
Compilation completed with 1 error and 0 warnings
java.net.SocketTimeoutException: Accept timed out
I tried to restart my computer. I have clean OS installation and I don't have any program that should block it.
If it helps I develop on OS X 10.7
Thanks for your replies.
Just did a fresh install of IDEA 11.1.3 and Flex SDK 4.6 and got this error with a brand-new Flash Mobile app+module.
Here's how I fixed it:
Go to Settings > Compiler > Flex Compiler
Choose Mxmlc/compx instead of the default Built-in compiler shell
(Screenshot: http://puu.sh/10Nhg)
Compile your application
The accepted answer above did not work for me, and while the answer provided by Florian Salihovic pointed me in the right direction, I thought I would post the solution here.
This comment on the link provided by Florian Salihovic, specifically the comment I've linked to directly, contains the following solution that worked for me:
Find your hostname. You can use hostname in your shell.
Edit /etc/hosts and add 127.0.0.1 <<hostname>> where <<hostname>> is the name reported by the hostname command.
I have found that this corrected my issue (on Linux) and should correct the issue on OSX as well. With this, you can use the built-in compiler shell still as well.
This is similar to an issue tracked on Jetbrain's YouTrack Error while starting Flex compiler. You might could check that one.

Categories