Maven not recognizing javac in my Ubuntu installation - maven-2

I have gotten this error:
Compilation failure
Unable to locate the Javac Compiler in:
/usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
Now I have set some info in my .bashrc file like so: export PATH=$PATH:/usr/lib/jvm/java-6-openjdk/bin. I also did it in my /etc/profile file. But it still fails. But I am noticing that the above error is still going into jre instead of jvm. I don't really understand why its doing that. When I do which javac, it directs me to /usr/bin/javac. What exactly is that file? It seems Ubuntu defaults to JRE rather than the SDK. Either way I am confused as to how to fix this. Any help would be appreciated!

Related

impossible to install a intellij idea

I downloaded the ultimate version of IntelliJ from the official website and when I do ./idea.sh in the .. /bin directory of the file I get this error message in the terminal:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.Error opening zip file or JAR manifest missing : /root/.jetbrains/jetbrains-agent-v3.2.0.de72.619 Error occurred during initialization of VM agent library failed to init: instrument
I don't know if I am supposed to have a .jetbrains file in my repersonel if so why I don't have it and if not how to get it?
Cordially...
What's the environment of your machine and I do not think you need to care about how to get .jetbrains manually by yourself. I've installed a IntelliJ idea on Ubuntu18.04, it works well. You can try run it as an administrative, also you can go to ./bin folder and then run ./idea.sh rather than ../bin folder
btw, as I said install, it does not indicate we need to compile it and get some executable binary file to run it. It's a green software that contains anything you need, you can run it directly
The Error opening zip file or JAR manifest missing : /root/.jetbrains/jetbrains-agent-v3.2.0.de72.619 error indicate that there is a problem with the distribution you have downloaded. It was corrupted or modified improperly.
Re-download it from https://www.jetbrains.com/idea/download and install into a new empty directory.
You can also try deleting the IDE's config and system directories.

intellij - java: Cannot find JDK '1.7' for module

I've just installed IntelliJ on Windows 8 (and 7). I then use the 'Java Hello World' Sample as my project.
I then selected the JDK that was installed (C:\Program Files\Java\jdk1.7.0_10). Project creates successfully and I can see all the classes associated with the project etc. When I "make the project" I get the following error:
Compilation completed with 1 error and 0 warnings in 2 sec
1 error
0 warnings
java: Cannot find JDK '1.7' for module 'TEST'
No matter what I do I cannot compile any Java code under Windows8/IntelliJ
I have tried the following:
Invalidating cache.
Switching to 32bit JDK instead of 64bit
Idea64.exe instead of idea.exe
Installing 1.6 incase it was a 1.7 issue??
Changed the JAVA_HOME to point to different versions (ie currently C:\Program Files\Java\jdk1.7.0_10)
I'm lost as to why this is happening.
project structure > project > choose correct jdk
or ctrl+alt+shift+s > project> choose correct jdk
also platform settings > SDK's >and make sure 1.7 is there.
Found the root of the problem. Turns out Windows 8 under parallels shares the same Desktop as OSX. This confused IntelliJ somehow and as a result it couldn't compile properly.
In parallels by removing the "Desktop" shared under Configure this then resolves the issue.
In case you want to still share the documents & desktop, the solution is to modify the idea.properties file (for instance, under C:\Program Files (x86)\JetBrains\IntelliJ IDEA 12.1\bin\idea.properties ), and change the following properties to point to different a location that is specific to the OS in which you are working:
idea.config.path=
idea.system.path=
idea.plugins.path=
idea.log.path=
I also copied the previous folder (on my computer it was under
\\psf\Home\.IntelliJIdea12
) to the new location to preserve all settings.
Update: I had the same problem after I installed IntelliJ Idea 13. I moved the .IntelliJIdea13 folder to c:\Users\costa from \\psf\Home, then I modified the C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.0\bin\idea.properties file:
idea.config.path=C:/Users/costa/.IntelliJIdea13/config
idea.system.path=C:/Users/costa/.IntelliJIdea13/system
idea.plugins.path=C:/Users/costa/.IntelliJIdea13/config/plugins
idea.log.path=C:/Users/costa/.IntelliJIdea13/system/log
I made the error while editing idea.properties to leave a whitespace at the end of my personally added idea.config.path=../.IdeaIC/config line.
This resulted exactly in the Cannot find JDK '...' for module error message.
I needed to "trim" the line manually, just deleted the whitespace, restarted IntelliJ and everything worked fine again.
I found this while scanning the idea.log file where I found java.io.FileNotFoundException: C:\Software\IntelliJ IDEA Community Edition 14.1.3\.IdeaIC\config \tasks\root.contexts.zip
In my case, Idea said "Failed to save settings" (probably due to a lot of projects being open. After that, it could not run tests with "Cannot find JDK '1.8' for module XXX" message. Idea restart solved the issue for me.
I believe this is an IntelliJ bug.
This isn't a fix, but you can work around this by going to Settings > Compiler, and disabling 'Use External Build'.
It seems that sometimes Intellij (or the user:-)) is getting confused when importing settings, especially if you change the paths where the jdk resides (for me it happened during a migration to a new Linux environment).
The only way I could correct this was to delete the user's settings folder.
In Linux :
I removed the folder (and subfolders): ~/.IntelliJIdea12/
Of course this would remove the saved settings, licenses e.t.c.

jmockit: Native library for Attach API not available in this JRE error

I was trying to use jmockit to unit test my project and got the following error:
java.lang.UnsatisfiedLinkError: no attach in java.library.path
java.lang.IllegalStateException: Native library for Attach API not available in this JRE
at mockit.internal.startup.JDK6AgentLoader.getVirtualMachineImplementationFromEmbeddedOnes(JDK6AgentLoader.java:95)
at mockit.internal.startup.JDK6AgentLoader.loadAgent(JDK6AgentLoader.java:54)
at mockit.internal.startup.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:21)
at mockit.internal.startup.Startup.initializeIfNeeded(Startup.java:98)
at mockit.internal.startup.Startup.initializeIfPossible(Startup.java:112)
at org.junit.runner.Runner.<clinit>(Runner.java:22)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.UnsatisfiedLinkError: no attach in java.library.path
I have included jdk6/lib/tools.jar, jmockit.jar, and junit.jar in the classpath, respectively. Any clues why this is happening?
Go to Java Build Path of your project and change the JRE System Library and make it points to the jdk instead of jre.
It's not tools.jar that you need, but the native library file for the "Attach API": attach.dll (or the Linux/Mac equivalent, attach.so or similar). A plain JRE does not contain this library. Instead, point Eclipse to a JDK installation, which should contain the jre/bin/attach.dll file.
Add the path to attach.dll to your PATH environment variable
You have to set agent.
You can set VM arguments if you are using eclipse and Args will be like this:
-javaagent:local path to your jmockit jar\jmockit.jar
eg: -javaagent:D:\jmockit.jar
Dao Lam,
Here are some other things to try:
Make sure your project is using either:
The workspace default (That assumes that the default is your the jdk installation you just added. From the window where you added it, make sure it is checked.),
The jdk version, or
An execution Environment that uses the jdk version.
Pull up your system's environment variables, and add this path to it: (jdk_dir)/jre/bin. (Remember, you'll have to restart Eclipse once you've saved that to get it to take).
Close eclipse, and modify the shortcut you are using to start it to use (jdk_dir)/jre/bin.
I've found that any one of these measures will allow Eclipse to find the attach.dll.
Looks like you need to point your Eclipse to JDK , not JRE.
Steps :Windows->Preferences>Java>"Installed JRE's" and remove JRE from "Installed JRE's" window and add JDK browsing to your JDK location and select as default.
I found this issue with JDK 1.8.45 and 1.8.80 on 64-bit Windows. My solution was to copy attach.dll from the JDK's ./jre/bin directory to the ./bin. This eliminated the need for updating Eclipse and a Cygwin command line with a non-standard JAVA_HOME.
Maybe the Windows version may be ignoring the contents of the JRE directory?

MonkeyTalkIDE not found Java (JRE) / (JDK) virtual machine

I am trying to install MonkeyTalkIDE but show this error
A java Runtime Environment (JRE) or Java Development kit (JDK) must be available in order to run MonkeyTalkIDE. No Java virtual machine was found after searching the following locations: C:\Program Files\MonkeyTalkIDE\jre\bin\javaw.exe javaw.exe in your current PATH.
I am also set environment variable for java.
How can resolved problem?
Download a Java JDK here.
You might need to set JAVA_HOME to point to the directory where you install Java. (I'll assume you know how to do that.)
set JAVA_HOME=<directory-where-you-installed-JDK>
Add the path to the Java /bin directory to your PATH environment variable. (I'll assume you know how to do that.) If you do the second step, it'll be
PATH=%PATH%;%JAVA_HOME%\bin;

Java 7 && IntelliJ

I installed openjdk 1.7.0 and set it up in IntelliJ 10.5
When I compile (anything) I get the error "Fatal Error: Unable to find package java.lang in classpath or bootclasspath".
I looked at this question:
IntelliJ gives Fatal Error: Unable to find package java.lang in classpath or bootclasspath but all jar files inside the lib directory are already added.
Ok. I was wrong there weren't all jars added. I found some more in (sub)directories other than 'lib'. After adding all those manually everything is fine. Seems like even IDEA 10.5.2 does not like the structure in openJDK yet.
Try IDEA 10.5.2. Make sure that JDK path is not a symlink. If the issue remains, specify your OS and attach a screenshot of JDK classpath configured in IDEA.
I had the same problem. I added all jar files in the following directories manually:
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/1.7.0.jre/Contents/Home/lib
/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/1.7.0.jre/Contents/Home/lib/ext