diff --git a/src/java.rs b/src/java.rs index 9df21a7..02db3ad 100644 --- a/src/java.rs +++ b/src/java.rs @@ -96,12 +96,14 @@ impl JVM { for part in &cmd { println!("{}", part); } + cmd.push("-cp".to_string()); cmd.push(entry_point.as_ref().display().to_string()); + // Jave needs a class path and a file name to run. + cmd.push("Test".to_string()); + println!("Fence 6"); - for part in &cmd { - println!("{}", part); - } + println!("{:?}", cmd.as_slice()); println!("Fence 7"); @@ -136,12 +138,7 @@ pub enum VMFlag { impl Into> for VMFlag { fn into(self) -> Vec { - match self { - Self::EnableAssert => vec![String::from("-ea")], - Self::HeapMax { size } => vec![format!("Xmx{}", size)], - Self::HeapMin { size } => vec![format!("Xms{}", size)], - Self::Version => vec![String::from("--version")], - } + vec![self.to_string()] } } @@ -154,8 +151,8 @@ impl fmt::Display for VMFlag { "-{}", match self { Self::EnableAssert => String::from("ea"), - Self::HeapMax { size } => format!("Xmx{}", size), - Self::HeapMin { size } => format!("Xms{}", size), + Self::HeapMax { size } => format!("Xmx{}", size.as_u64()), + Self::HeapMin { size } => format!("Xms{}", size.as_u64()), Self::Version => String::from("-version"), // --version } ) diff --git a/src/main.rs b/src/main.rs index 155f38d..922f727 100644 --- a/src/main.rs +++ b/src/main.rs @@ -186,7 +186,7 @@ fn new(project_name: String) -> anyhow::Result<()> { } fn build() -> anyhow::Result<()> { - let mut targets: Vec = crate::fs::expand_files(PROJECT_ROOT.clone().join(DIR_SRC.as_path()))? + let mut targets: Vec = crate::fs::expand_files(DIR_SRC.as_path())? .into_iter() .filter(|f| { f.extension() @@ -266,7 +266,7 @@ fn test(assertions: bool) -> anyhow::Result<(Option, Option)> { .ram_max(ByteSize::mib(512)) .monitor(true) .build() - .run(DIR_TEST.as_path()) + .run(DIR_TARGET.as_path()) } fn clean() {