3

I am trying to get our Mavenized web application up and running in a freshly installed IDEA 11.1.4 Ultimate (Windows 7) under a freshly unzipped Glassfish 3.1.2.2. I have done this many times in Eclipse, but am not familiar with IDEA.

I can build and deploy it just fine, but when I try to access pages with JSP-content I get:

PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required

The Glassfish Application Servers entry adds the javax.ejb.jar, javax.servlet-api.jar and javax.servlet.jsp-api.jar as libraries.

I have set the project SDK to point to a full JDK resulting in:

(which does not seem to include a jar with javac)

The IntelliJ tutorials I've found so far, does not mention this problem. My guess would be that the "please start using this JDK" information is not passed on to Glassfish, so it just picks up the system JRE.

What configuration step have I missed? I do not want to edit configuration files - I expect the IntelliJ plugin to do this if I know how to tell it to.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347

4 Answers4

4

I got the same notification and just changed in admin port -> Configurations -> server-config -> JVM Settings -> Java Home as "C:\Program Files\Java\jdk1.8.0_72", and it started working.

Kaj Risberg
  • 617
  • 9
  • 15
  • 2
    This was the only thing that worked for me. I had changed AS_JAVA in asenv.conf, and no luck. Glassfish really is a piece of crap. – Matthew Oakley Aug 11 '16 at 05:27
  • Works for me, after an error caused by a reconfiguration of the domain via `asadmin start-domain domain1` – Tito Leiva May 17 '18 at 14:47
2

PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required.

I was getting same error after restarting my glassfish 4 server.When I am trying to access my deployed application it was saying to mention full JDK.

  1. login to Glassfish admin console.(http://localhost:4848).
  2. Go to Configuration---->server-config--->JVM Settings
  3. Set the java home with your correct jdk home (ex:C:\Program Files (x86)\Java\jdk1.8.0_121).
  4. Restart the server.

It will work fine.

VDWWD
  • 35,079
  • 22
  • 62
  • 79
1

Next solution helped me

source: http://alvinalexander.com/blog/post/java/fixing-glassfish-jdk-path-problem-solved

  1. Find your asenv.bat file. C:\Program Files\glassfish-4.0\glassfish\config\asenv.bat
  2. Open it in text editor and find strings like "set AS_ = blahblah"
  3. Add this string there "set AS_JAVA=C:\Program Files\Java\jdk1.7.0_60" (print your own JDK path here). If string "set AS_JAVA= blahblah" already exists then just fix the path.
Bepeck
  • 11
  • 1
0

Add JDK_HOME\lib\tools.jar file to the JDK configuration Classpath.

However, the problem in your case may be different as Glassfish JDK is not taken from IntelliJ IDEA settings, this question may help:

Community
  • 1
  • 1
CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • Is this really the officially sanctioned way? – Thorbjørn Ravn Andersen Dec 06 '12 at 09:36
  • Yes, it's by design. When building IDEA itself this steps is also required as IDEA sources use compiler APIs that are available only in tools.jar. – CrazyCoder Dec 06 '12 at 13:13
  • What is then the idea of specifying a JDK if it doesn't bring in the JDK jars? Sorry, I simply do not get it. – Thorbjørn Ravn Andersen Dec 06 '12 at 14:53
  • Using Java compiler APIs is not required when developing 99% of Java applications, it's required only in very rare special cases, like when compiling the IDE itself. The problem in your case may be different as the application server is started using its own startup script and may be using completely different JDK location not inherited from the project settings. Check the console to see what path it's using for the JDK. If it uses the same path, it should be able to find and load tools.jar itself without the need to edit the IDE settings, otherwise it's a bug in the server startup script. – CrazyCoder Dec 06 '12 at 15:21
  • Rare cases like running an application server with a JSP-compiler which in turn require javac? Oh well, at least I know now. – Thorbjørn Ravn Andersen Dec 06 '12 at 15:43
  • Read my comment again, normally it's not the case when running the application server, as the server startup script will use something like JAVA_HOME environment and will load all the jars itself. IDEA doesn't tell the server which jars it should load. In your case the sever is probably using a different path or there is a bug in the startup script so that not all the jars are added to the classpath. It also depends on how the server is started. Normally you should use the application server specific configuration. If you run the server main class, then classpath from the JDK settings is used. – CrazyCoder Dec 06 '12 at 15:53
  • See http://stackoverflow.com/questions/10444959/how-do-i-specify-the-jdk-for-a-glassfish-domain – CrazyCoder Dec 06 '12 at 16:02
  • Here later I still think that the "Bring in JDK jars for a JDK" is a point where Eclipse just does the right thing and should be emulated by others. – Thorbjørn Ravn Andersen Jun 29 '14 at 12:59