Setting a custom JRE for Tomcat

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Re: Setting a custom JRE for Tomcat

Postby newbie2244 » 22. January 2010 02:33

Greetings-

You need to set the classpath variable in the Environment Variables section. %JAVA_HOME%\jdk1.6.0_xx\bin. JAVA_HOME is where you have installed the jdk.

I ran java with the Eclipse IDE. Two good resources: The Eclipse Foundation web site and the Microsoft (MSN) system (how to) pages. Also check the java.sun.com site. But that can be daunting. I'll try to log on tomorrow. But try the 2 sites.
You don't actually need Tomcat. YOu can set up an Apache-PHP-Java stack, but you'll have to use Eclipse v.3.2 with the jdk 1.5.x
A bit tricky, but if you can get an installer script _ look at the Eclipse web site - for an installer ( .msi file), it will be easier.

Regards
newbie2244
 
Posts: 49
Joined: 20. February 2009 22:39

Re: Setting a custom JRE for Tomcat

Postby kPepperman » 23. January 2010 04:51

This is still an issue with XAMPP Windows 1.7.3. (Tomcat 6.0.20 and mod_jk 1.2.20 for the XAMPP base package >=1.7.2)

The only solution I could use was to copy the new jre from the SKD to the tomcat jre dir.

Which is acceptable, and better than copying tcnative-1.dll when changing the path with the .bat; However I was not able to get it to use the systems JAVA_HOME system variable without changing the configuration..

I was testing openBd and it required Java 6 to run which led me to discover it was not using the System jvm.

I would have to say that there needs to be a better way of changing the jvm during or after install.

The configuration change method is fine, but this would be better suited as a convention during install, or a part of setup_xampp.bat.
kPepperman
 
Posts: 1
Joined: 23. January 2010 04:38

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 12. March 2010 20:24

I'm having the same issue (XAMPPLite 1.7.3 + Tomcat). I examined each of the bat files an how they work. In setenv.bat I set the following:

SET "JRE_HOME="
SET "JAVA_HOME=C:\Java\jdk1.6.0_18"

If I execute tomcat_start.bat from the XAMPP directory or if I use the XAMPP control panel, both "indicate" it's not running, when in fact the javaw process has bee spawned and all of the webapps are running fine.

I did not have to copy the tomcat native library. I suspect there is something in xampp_cli that expects to see the javaw process running from xampp\tomcat\jre.
Don't really have the time to dig deeper but it would be nice to see some input from ApacheFriends

More info: monitoring the xampp_cli process, it's executing \xampp[lite]\tomcat\bin\startup.bat, as expected.
Regardless of whether I specify a JAVA_HOME or a JRE_HOME, if the javaw process is not running from below \xampp[lite] the xampp_cli does not think it's running.
The Xampp status web page will show that Tomcat is up, because status.php checks for an open port 8080.
I don't like work-arounds. I like solutions. There are reasons I have the JDK and jre where they are, and I don't need/want another copy just because this tool doesn't know what's going on. So until I can get my hands on the source code I'm left with killing the javaw process when I need to restart tomcat.

More info: This might get this issue some attention. In the absence of source code for xampp_cli.exe, I disassembled it. It should come as no surprise that "tomcat\bin\startup.bat" and "tomcat\jre\bin\javaw.exe" is hard coded in.
So, xampp_cli.exe can be used to start tomcat, but it won't see it as running if the javaw.exe is in a diiferent path.

One thing that does work is setting up "tomcat\jre\" as a symlink (using mklink in Vista/Server 2008) to the desired actual location. Junction points in XP/2003 should work also, though I haven't tried it yet.
Last edited by BigWetDog on 21. April 2010 00:30, edited 5 times in total.
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby paul.seldon » 24. March 2010 10:04

Perhaps, it might help?

http://www.youtube.com/results?search_q ... type=&aq=f

Is there anyone who can let me know how to integrate XAMPP+Tomcat with eclipse?

< My wish list >
(1) I wish they have (php) and (java) separately, there won't be XAMPPLite. XAMTomcat and XAMPP
(2) I wish they have shown how to integrate this with eclipse which plugin to use and which values set up.

I found it very different. Some of *.exe are in the wrong location and some of *.exe doesn't exist in xampp folders.
Man ~ , where is mysqld-nt.exe? It isn't inside xampp\mysql\bin\mysqld-nt.exe. and it isn't inside xampp.
which was asked by phpeclipse plugin in eclipse.

Perhaps, if we wrote in German, they couldn't notice us better?
paul.seldon
 
Posts: 1
Joined: 22. March 2010 07:42

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 21. April 2010 01:44

Paul,
The video doesn't address the issue of using a custom JRE. Also the video is in error regarding The JDK requirement. Tomcat hasn't required the JDK for quite some time. In fact, you don't even need any JRE installed on the machine, as the XAMPP Tomcat add-on comes with it. Which is what the problem is. Specifying a JRE following Tomcat configuration guidelines prevents the XAMPP CLI and thus the control panel from properly reporting Tomcat status. See my post above.

As for using XAMPP + Tomcat as a development platform for Eclipse, it's no different than it is if you were using a stand alone installation of Tomcat. Check the Eclipse docs. I've got this set up on a flash drive.
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 21. April 2010 14:35

I've submitted a bug report on this:
http://bugs.xampp.org/view.php?id=155
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby blueven » 14. May 2010 15:11

Hi,
but do you see now "running" in control panel?
I try copiyng the new file in jre, then i try making a symlink, in both cases tomcat work but none "running" appear.

thanks for help!

BigWetDog wrote:I'm having the same issue (XAMPPLite 1.7.3 + Tomcat). I examined each of the bat files an how they work. In setenv.bat I set the following:

SET "JRE_HOME="
SET "JAVA_HOME=C:\Java\jdk1.6.0_18"

If I execute tomcat_start.bat from the XAMPP directory or if I use the XAMPP control panel, both "indicate" it's not running, when in fact the javaw process has bee spawned and all of the webapps are running fine.

I did not have to copy the tomcat native library. I suspect there is something in xampp_cli that expects to see the javaw process running from xampp\tomcat\jre.
Don't really have the time to dig deeper but it would be nice to see some input from ApacheFriends

More info: monitoring the xampp_cli process, it's executing \xampp[lite]\tomcat\bin\startup.bat, as expected.
Regardless of whether I specify a JAVA_HOME or a JRE_HOME, if the javaw process is not running from below \xampp[lite] the xampp_cli does not think it's running.
The Xampp status web page will show that Tomcat is up, because status.php checks for an open port 8080.
I don't like work-arounds. I like solutions. There are reasons I have the JDK and jre where they are, and I don't need/want another copy just because this tool doesn't know what's going on. So until I can get my hands on the source code I'm left with killing the javaw process when I need to restart tomcat.

More info: This might get this issue some attention. In the absence of source code for xampp_cli.exe, I disassembled it. It should come as no surprise that "tomcat\bin\startup.bat" and "tomcat\jre\bin\javaw.exe" is hard coded in.
So, xampp_cli.exe can be used to start tomcat, but it won't see it as running if the javaw.exe is in a diiferent path.

One thing that does work is setting up "tomcat\jre\" as a symlink (using mklink in Vista/Server 2008) to the desired actual location. Junction points in XP/2003 should work also, though I haven't tried it yet.

Hi
blueven
 
Posts: 5
Joined: 13. May 2010 15:24

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 17. May 2010 03:12

Yes, after I created the symlink the xampp control panel correctly indicated Tomcat status (i.e. I am able to use it to start/stop Tomcat).
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby JonB » 17. May 2010 04:13

I have a thought on this:

Its possible that there is no mechanism for tomcat to report through to the Windows environment. Remember that XAMPP is registry agnostic. I imagine 'therefore' that Tomcat is running as an anonymous process in the Java container.

its only my impression of the situation.

:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 17. May 2010 15:28

Jon,

If you trace the flow of execution it goes like this:
1. xampp_control.exe
2. xampp_cli.exe start tomcat
3. cmd /c CALL "<DRIVE>:\xampp[lite]\tomcat\bin\startup.bat" 2>&1>nul
4. catalina.bat and a chain of batch files

Now the key here is that when xampp_cli.exe executes startup.bat (line 3) it discards the output (i.e. /dev/null). Recall that tomcat\jre\bin\javaw.exe is hard coded into xampp_cli.exe. Which means its looking for a process that's running from there.
I can only speculate on why it isn't parsing the output of startup.bat, which among other things returns JRE_HOME (or JAVA_HOME if your using the JDK in debug mode). That would be a more reliable indicator of Tomcat's status. Alternatively, since a normal Tomcat service installation would read the configuration information from the registry to check the javaw process path, the analogous solution for xampp would be to read the configuration from setenv.bat or better yet, check the enviroment variables when it runs.

Concerning symlinks, I've run a couple of tests. If you specify either the /D or the /J argument (i.e. create a directory junction) when using the mklink command, the control panel can control tomcat just fine. This suggests that creating a junction point in xp/2003, using sysinternals "junction" command, will work. I tested mklink with both absolute and relative paths to the JDK and to just the JRE, for a total of 8 tests.
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby blueven » 20. May 2010 13:06

Ok, i understand the behaviour:

- creating a symlink or a junction to my jdk or jre 32bit, and renaming it "jre" , the running appears on the xampp contrl panel.
- the same with jdk or jre 64 bit does not work: tomcat starts, but the control panel says nothing.

Why 64 bit jdk or jre not works?
blueven
 
Posts: 5
Joined: 13. May 2010 15:24

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 20. May 2010 14:31

If you actually copy the JRE (64-bit) to xampp/tomcat/jre, does the control panel work properly?
Also, what is the exact command you are using to create the symlink on the 64 bit system?
I don't have access to a 64-bit setup right now, so I'll help you troubleshooot.

I may be wrong about this, but XAMPP doesn't yet distribute the 64-bit tomcat, so it seems you are trying to run it (xampp tomcat 32-bit) against the 64-bit JRE, and I don't see that working. When you use the control panel to attempt to start tomcat, I understand that it's doesn't show as running, but does it show as running in your task manager?
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 20. May 2010 19:01

In looking for a solution to this thread: viewtopic.php?f=16&t=38496 it occured to me that you might be able to use the same solution for a custom jre. Open xampp_cli.exe in your favourite hex editor and search for a change the tomcat\jre\bin\javaw.exe to whatever your custom path is. The limitation being that you have to make sure you don't change your offsets. The current path is 24 characters long, so for example if you were to change it to C:\java\jre\javaw.exe is 21 so you have to follow it with 3 spaces. So you can't use C:\Program Files\Java\jre\javaw.exe as it's too long.
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

Re: Setting a custom JRE for Tomcat

Postby blueven » 21. May 2010 14:55

BigWetDog wrote:If you actually copy the JRE (64-bit) to xampp/tomcat/jre, does the control panel work properly?
Also, what is the exact command you are using to create the symlink on the 64 bit system?
I don't have access to a 64-bit setup right now, so I'll help you troubleshooot.

I may be wrong about this, but XAMPP doesn't yet distribute the 64-bit tomcat, so it seems you are trying to run it (xampp tomcat 32-bit) against the 64-bit JRE, and I don't see that working. When you use the control panel to attempt to start tomcat, I understand that it's doesn't show as running, but does it show as running in your task manager?


I think tomcat is not 32 or 64 bit, tomcat depends by the jvm that starts it.
Infact xampp tomcat work with my 64 bit jvm, but the "running" on control panel does not appear.
blueven
 
Posts: 5
Joined: 13. May 2010 15:24

Re: Setting a custom JRE for Tomcat

Postby BigWetDog » 21. May 2010 16:07

I understand, I just assumed that it might be an issues since Tomcat distributions come in x86 and x64 flavours, so they are at least optimized for the appropriate architecture.
Remember that the control panel is looking for tomcat/jre/bin/javaw.exe. I don't know enough about how windows 32 bit vs 64 bit architecture interacts, but it could just simpley be that since xampp-control is 32 bit it doesn't recognize the 64 bit javaw.exe, even if it's running from the right path.
User avatar
BigWetDog
 
Posts: 148
Joined: 25. February 2010 15:54

PreviousNext

Return to XAMPP for Windows

Who is online

Users browsing this forum: suze5544 and 66 guests