git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-3112 Use classgraph to reconstruct the classpath for launching Jalview
[jalview.git]
/
test
/
jalview
/
bin
/
CommandLineOperations.java
diff --git
a/test/jalview/bin/CommandLineOperations.java
b/test/jalview/bin/CommandLineOperations.java
index
d586dae
..
b81facf
100644
(file)
--- a/
test/jalview/bin/CommandLineOperations.java
+++ b/
test/jalview/bin/CommandLineOperations.java
@@
-35,6
+35,9
@@
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ScanResult;
+
public class CommandLineOperations
{
public class CommandLineOperations
{
@@
-113,21
+116,39
@@
public class CommandLineOperations
}
}
}
}
- private Worker jalviewDesktopRunner(boolean withAwt, String cmd,
- int timeout)
+ private static ClassGraph scanner = null;
+
+ private static String classpath = null;
+
+ public synchronized static String getClassPath()
{
{
- String cp_sep = ":";
- if (System.getProperty("os.name").indexOf("Windows") >= 0)
+ if (scanner == null)
+ {
+ scanner = new ClassGraph();
+ ScanResult scan = scanner.scan();
+ classpath = scan.getClasspath();
+ }
+ while (classpath == null)
{
{
- cp_sep = ";";
+ try
+ {
+ Thread.sleep(10);
+ } catch (InterruptedException x)
+ {
+
+ }
}
}
+ return classpath;
+ }
+ private Worker jalviewDesktopRunner(boolean withAwt, String cmd,
+ int timeout)
+ {
// Note: JAL-3065 - don't include quotes for lib/* because the arguments are
// not expanded by the shell
// Note: JAL-3065 - don't include quotes for lib/* because the arguments are
// not expanded by the shell
+ String classpath = getClassPath();
String _cmd = "java "
+ (withAwt ? "-Djava.awt.headless=true" : "")
String _cmd = "java "
+ (withAwt ? "-Djava.awt.headless=true" : "")
- + " -classpath ./classes" + cp_sep
- + "./lib/* jalview.bin.Jalview ";
- System.out.println("CMD [" + cmd + "]");
+ + " -classpath " + classpath + " jalview.bin.Jalview ";
Process ls2_proc = null;
Worker worker = null;
try
Process ls2_proc = null;
Worker worker = null;
try