mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
set java.home to path of JRE, not JDK
This commit is contained in:
parent
17f495eb27
commit
efd3ccb04f
9
makefile
9
makefile
@ -51,8 +51,8 @@ test = test
|
||||
classpath = avian
|
||||
|
||||
test-executable = $(executable)
|
||||
generator-classpath = $(classpath-build)
|
||||
boot-classpath = $(classpath-build)
|
||||
java-home = /tmp
|
||||
|
||||
ifdef openjdk
|
||||
classpath = openjdk
|
||||
@ -62,9 +62,8 @@ ifdef openjdk
|
||||
else
|
||||
openjdk-lib-dir = $(openjdk)/jre/lib
|
||||
endif
|
||||
classpath-cflags = -DAVIAN_OPENJDK_JAVA_HOME=\"$(openjdk)\"
|
||||
java-home = $(openjdk)/jre
|
||||
test-executable = $(executable-dynamic)
|
||||
generator-classpath := $(generator-classpath):$(openjdk)/jre/lib/rt.jar
|
||||
boot-classpath := $(boot-classpath):$(openjdk)/jre/lib/rt.jar
|
||||
endif
|
||||
|
||||
@ -116,7 +115,7 @@ warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self \
|
||||
common-cflags = $(warnings) -fno-rtti -fno-exceptions -fno-omit-frame-pointer \
|
||||
"-I$(JAVA_HOME)/include" -idirafter $(src) -I$(build) \
|
||||
-D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \
|
||||
-DUSE_ATOMIC_OPERATIONS $(classpath-cflags)
|
||||
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(java-home)\"
|
||||
|
||||
build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \
|
||||
"-I$(JAVA_HOME)/include/linux" -I$(src) -pthread
|
||||
@ -515,7 +514,7 @@ gen-arg = $(shell echo $(1) | sed -e 's:$(build)/type-\(.*\)\.cpp:\1:')
|
||||
$(generated-code): %.cpp: $(src)/types.def $(generator) $(classpath-dep)
|
||||
@echo "generating $(@)"
|
||||
@mkdir -p $(dir $(@))
|
||||
$(generator) $(generator-classpath) $(<) $(@) $(call gen-arg,$(@))
|
||||
$(generator) $(boot-classpath) $(<) $(@) $(call gen-arg,$(@))
|
||||
|
||||
$(classpath-build)/%.class: $(classpath-src)/%.java
|
||||
@echo $(<)
|
||||
|
@ -128,7 +128,7 @@ enumerateThreads(Thread* t, Thread* x, object array, unsigned* index,
|
||||
namespace vm {
|
||||
|
||||
Classpath*
|
||||
makeClasspath(System*, Allocator* allocator)
|
||||
makeClasspath(System*, Allocator* allocator, const char*)
|
||||
{
|
||||
return new (allocator->allocate(sizeof(local::MyClasspath)))
|
||||
local::MyClasspath(allocator);
|
||||
|
@ -139,16 +139,11 @@ makeClassNameString(Thread* t, object name)
|
||||
|
||||
class MyClasspath : public Classpath {
|
||||
public:
|
||||
static const unsigned BufferSize = 256;
|
||||
static const unsigned BufferSize = 1024;
|
||||
|
||||
MyClasspath(System* s, Allocator* allocator):
|
||||
MyClasspath(System* s, Allocator* allocator, const char* javaHome):
|
||||
allocator(allocator)
|
||||
{
|
||||
const char* javaHome = getenv("JAVA_HOME");
|
||||
if (javaHome == 0) {
|
||||
javaHome = AVIAN_OPENJDK_JAVA_HOME;
|
||||
}
|
||||
|
||||
class StringBuilder {
|
||||
public:
|
||||
StringBuilder(System* s, char* pointer, unsigned remaining):
|
||||
@ -157,7 +152,7 @@ class MyClasspath : public Classpath {
|
||||
|
||||
void append(const char* append) {
|
||||
unsigned length = strlen(append);
|
||||
assert(s, remaining > length);
|
||||
expect(s, remaining > length);
|
||||
|
||||
strncpy(pointer, append, remaining);
|
||||
|
||||
@ -186,24 +181,24 @@ class MyClasspath : public Classpath {
|
||||
|
||||
this->classpath = sb.pointer;
|
||||
sb.append(javaHome);
|
||||
sb.append("/jre/lib/rt.jar");
|
||||
sb.append("/lib/rt.jar");
|
||||
sb.append(s->pathSeparator());
|
||||
sb.append(javaHome);
|
||||
sb.append("/jre/lib/jsse.jar");
|
||||
sb.append("/lib/jsse.jar");
|
||||
sb.append(s->pathSeparator());
|
||||
sb.append(javaHome);
|
||||
sb.append("/jre/lib/jce.jar");
|
||||
sb.append("/lib/jce.jar");
|
||||
sb.append(s->pathSeparator());
|
||||
sb.append(javaHome);
|
||||
sb.append("/jre/lib/resources.jar");
|
||||
sb.append("/lib/resources.jar");
|
||||
sb.append('\0');
|
||||
|
||||
this->libraryPath = sb.pointer;
|
||||
sb.append(javaHome);
|
||||
#ifdef ARCH_x86_64
|
||||
sb.append("/jre/lib/amd64");
|
||||
sb.append("/lib/amd64");
|
||||
#else
|
||||
sb.append("/jre/lib");
|
||||
sb.append("/lib");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -634,10 +629,10 @@ interruptLock(Thread* t, object thread)
|
||||
namespace vm {
|
||||
|
||||
Classpath*
|
||||
makeClasspath(System* s, Allocator* allocator)
|
||||
makeClasspath(System* s, Allocator* allocator, const char* javaHome)
|
||||
{
|
||||
return new (allocator->allocate(sizeof(local::MyClasspath)))
|
||||
local::MyClasspath(s, allocator);
|
||||
local::MyClasspath(s, allocator, javaHome);
|
||||
}
|
||||
|
||||
} // namespace vm
|
||||
|
@ -2238,6 +2238,7 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
|
||||
#define BOOTSTRAP_PROPERTY "avian.bootstrap"
|
||||
#define CRASHDIR_PROPERTY "avian.crash.dir"
|
||||
#define CLASSPATH_PROPERTY "java.class.path"
|
||||
#define JAVA_HOME_PROPERTY "java.home"
|
||||
#define BOOTCLASSPATH_PREPEND_OPTION "bootclasspath/p"
|
||||
#define BOOTCLASSPATH_OPTION "bootclasspath"
|
||||
#define BOOTCLASSPATH_APPEND_OPTION "bootclasspath/a"
|
||||
@ -2257,6 +2258,7 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
|
||||
unsigned heapLimit = 0;
|
||||
const char* bootLibrary = 0;
|
||||
const char* classpath = 0;
|
||||
const char* javaHome = AVIAN_JAVA_HOME;
|
||||
const char* bootClasspathPrepend = "";
|
||||
const char* bootClasspath = "";
|
||||
const char* bootClasspathAppend = "";
|
||||
@ -2296,6 +2298,10 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
|
||||
sizeof(CLASSPATH_PROPERTY)) == 0)
|
||||
{
|
||||
classpath = p + sizeof(CLASSPATH_PROPERTY);
|
||||
} else if (strncmp(p, JAVA_HOME_PROPERTY "=",
|
||||
sizeof(JAVA_HOME_PROPERTY)) == 0)
|
||||
{
|
||||
javaHome = p + sizeof(JAVA_HOME_PROPERTY);
|
||||
}
|
||||
|
||||
++ propertyCount;
|
||||
@ -2308,7 +2314,7 @@ JNI_CreateJavaVM(Machine** m, Thread** t, void* args)
|
||||
|
||||
System* s = makeSystem(crashDumpDirectory);
|
||||
Heap* h = makeHeap(s, heapLimit);
|
||||
Classpath* c = makeClasspath(s, h);
|
||||
Classpath* c = makeClasspath(s, h, javaHome);
|
||||
const char* classpathBootClasspath = c->bootClasspath();
|
||||
|
||||
unsigned bcppl = strlen(bootClasspathPrepend);
|
||||
|
@ -1446,7 +1446,7 @@ runJavaThread(Thread* t)
|
||||
}
|
||||
|
||||
Classpath*
|
||||
makeClasspath(System* system, Allocator* allocator);
|
||||
makeClasspath(System* system, Allocator* allocator, const char* javaHome);
|
||||
|
||||
typedef uint64_t (JNICALL *FastNativeFunction)(Thread*, object, uintptr_t*);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user