24

I'm running a java application that we distribute as a server-side system. I'm trying to write a launcher ("write" is somewhat of an overstatement here, I'm basically just copying the Java.exe file so that we can get the desired name in the process explorer of windows). This exe is in our bin/ directory of our application file tree.

Now, we also have a jre/ directory in our file tree, which is where Java.exe actually resides (we ship our product with the Java environment). When I use Java.exe as the launcher, which is located in \jre\jre1.6.0_21\bin, or if I place the copy (call this exectuable 'Orange.exe') I made in this directory, it works just fine. But, if I put my 'Orange.exe' in the bin\ directory, then I get the following error:

Error: no 'server' JVM at 'C:\Program Files\Java\jre6\bin\server\jvm.dll'

I think I understand what is happening here - I want to use the server version of the jvm.dll file, which is in our jre directory. The problem is, I don't understand WHY it doesn't look in the jre\jre1.6.0_21 directory in my application path. I've set my JAVA_HOME environment variable to this location. It seems like it's defaulting to another, system-wide expected location.

Does anyone know how I can change this, so that it looks in my application-provided java environment directory? Ideally, this will be an environment variable, as I need to call this application with parameters using a batch file.

Cole Tobin
  • 9,206
  • 15
  • 49
  • 74
jwir3
  • 6,019
  • 5
  • 47
  • 92

8 Answers8

42

There is a little trick to get the server JVM up and running:

  1. Copy "server" folder from the JDK's JRE's bin folder example: C:\Program Files\Java\jdk1.6.0\jre\bin\server
  2. Paste the "server" folder to JRE's bin folder example: C:\Program Files\Java\jre1.6.0\bin
  3. Done

See official readme for details.

thecarpy
  • 845
  • 11
  • 24
indago
  • 2,041
  • 3
  • 29
  • 48
  • 10
    This is a little bizarre - surely I shouldn't have to manually copy some files that come with a _JDK_ just to get my production _JRE_ to work. Is there a more 'official' solution? – bacar Sep 04 '12 at 10:06
  • 3
    Yes, there is a solution where you can avoid this. See this answer http://stackoverflow.com/a/11561914/1128171 – Codey McCodeface Oct 29 '12 at 13:56
  • this appears to be the reason there: http://www.java.net/node/645054 so apparently to limit the JRE download size... – Emmanuel Touzery Dec 05 '12 at 13:30
9

I've just been struggling with this same problem in Eclipse and I noted that as suggested by the answer above the JBoss site has a thread on this issue saying the same as the answer above to copy files from the jdk to the jre folder.

I noticed that you can avoid having to do this if you define the runtime to be the jdk when you create the server. I didn't find how to edit an existing server though.

eclipse Screenshot

Codey McCodeface
  • 2,988
  • 6
  • 30
  • 55
  • 1
    I did this, as well as making sure JBoss Dev Studio and JBoss AS are installed the same directory, eg. both under C:\User\username in Windows 7. I also specifically pointed to jre6 during the JBoss Dev Studio re-install (not jre7, being paranoid of stability), and voila, problem solved. – Fuzzy Analysis Oct 29 '12 at 11:23
5

AFAIK, the JRE usually doesn't ship with a server VM (only the client VM). If you really need the server VM, you have to use the JDK installation.

See Oracle Java for Developers Download page for JRE's with Server VM.

thecarpy
  • 845
  • 11
  • 24
jarnbjo
  • 33,923
  • 7
  • 70
  • 94
  • The java environment we have in our application path includes the server/ directory from the jdk. – jwir3 May 09 '11 at 21:38
  • 1
    You say the JRE doesn't _usually_ ship with a server VM. Is there an installation that does? – bacar Sep 04 '12 at 10:07
1

I had the same problem here but, in my case, I just had not properly update the JAVA_HOME and my PATH for my recently installed JDK. I just updated it to my new JDK location and the server started just fine.

hbobenicio
  • 1,000
  • 15
  • 16
0

I solved the same problem by setting the JAVA_HOME path to C:\Program Files (x86)\Java\jre1.8.0_131\bin

Aayushi
  • 1,736
  • 1
  • 26
  • 48
0

Windows looks for DLLs in LIBPATH environment variable.

And make sure your 1.6.0_21 is somewhere first in PATH.

Vladimir Dyuzhev
  • 18,130
  • 10
  • 48
  • 62
  • Ah, yes, sorry - I didn't mention this. I have verified that the PATH variable contains the application's jre directory as the first element in the path. – jwir3 May 09 '11 at 20:01
  • So, if I make LIBPATH=\jre\jre1.6.0_21\bin, will this search correctly for this server jvm dll? – jwir3 May 09 '11 at 20:03
0

The easiest fix is simply to copy the contents of client folder inside bin and put in a newly created folder 'server' inside bin.

Copy from C:\Program Files (x86)\Java\jre1.8.0_261\bin\client Paste in C:\Program Files (x86)\Java\jre1.8.0_261\bin\server

*server is the new folder

Sammy
  • 47
  • 7
-1

Make sure that server/jvm.dll file must be there when we are trying to run servers like servicemix.

Copy "server" folder from the JDK's JRE's bin folder example: C:\Program Files\Java\jdk1.6.0\jre\bin\server

Paste the "server" folder to JRE's bin folder example: C:\Program Files\Java\jre1.6.0\bin

I paced problem, I went through above..That's working fine.

Thanks!