summaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-01-03 23:36:19 -0800
committerSven Gothel <[email protected]>2012-01-03 23:36:19 -0800
commit3eb4fd96cd65e49625663fdb6421a2f1cf2204dc (patch)
tree5d005d8665996a9aa22fac01fd3cf046152f6386 /src/java
parent800368dc81a80c076ef88c7662d630a15975b823 (diff)
parent1b88a636af0c7d85ed14a2395d65f813cb14f98c (diff)
Merge pull request #8 from WadeWalker/bug_537_jar_cache_prevents_running_from_class_files
Fix JAR cache to allow running from class files. Fixes bug 537. Note: We may need to verify why commit 791dacb29bcd6d7ed161c6bd2abf7937c7d00691 is not sufficient.
Diffstat (limited to 'src/java')
-rw-r--r--src/java/com/jogamp/common/os/Platform.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index af795d1..55210ce 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -204,7 +204,7 @@ public class Platform {
os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH);
- USE_TEMP_JAR_CACHE = OS_TYPE != OSType.ANDROID &&
+ USE_TEMP_JAR_CACHE = (OS_TYPE != OSType.ANDROID) && !isRunningFromClassFile() &&
AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.valueOf(Debug.getBooleanProperty(true, useTempJarCachePropName, true, AccessController.getContext()));
@@ -233,6 +233,22 @@ public class Platform {
private Platform() {}
+ /* Used to disable JAR caching if we're not running from a JAR.
+ *
+ * If you build JOGL in an IDE like Eclipse, it's possible for other projects in your
+ * workspace to depend directly on the JOGL class files rather than on the built JAR files.
+ * This allows you to turn off JAR file creation in your JOGL Ant build to speed up the
+ * build, and allows Eclipse to resolve dependencies to auto-built class files before
+ * the Ant build even runs (which is not until after file save).
+ *
+ * @return true if we're running from a class file, false if we're running some other
+ * way (like from a JAR file).
+ */
+ private static boolean isRunningFromClassFile() {
+ URL url = Platform.class.getResource( "Platform.class" );
+ return( url.getProtocol().equalsIgnoreCase( "file" ) );
+ }
+
private static boolean queryIsLittleEndianImpl() {
ByteBuffer tst_b = Buffers.newDirectByteBuffer(Buffers.SIZEOF_INT); // 32bit in native order
IntBuffer tst_i = tst_b.asIntBuffer();