-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
slow:Java.add_to_classpath loads a jar file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2022, 2022 Oracle and/or its affiliates. All rights reserved. This | ||
# code is released under a tri EPL/GPL/LGPL license. You can use it, | ||
# redistribute it and/or modify it under the terms of the: | ||
# | ||
# Eclipse Public License version 2.0, or | ||
# GNU General Public License version 2, or | ||
# GNU Lesser General Public License version 2.1. | ||
|
||
require_relative '../../ruby/spec_helper' | ||
|
||
guard -> { !TruffleRuby.native? } do | ||
describe "Java.add_to_classpath" do | ||
before :all do | ||
jar_dir = File.expand_path(File.dirname(__FILE__)) + '/fixtures/examplejar' | ||
bin_dir = TruffleRuby.graalvm_home + '/bin' | ||
Dir.chdir(jar_dir) do | ||
system("#{bin_dir}/javac org/truffleruby/examplejar/Example.java") | ||
system("#{bin_dir}/jar cf example.jar org/truffleruby/examplejar/Example.class") | ||
end | ||
@jar_file = jar_dir + '/example.jar' | ||
end | ||
|
||
it "loads a jar file" do | ||
Java.add_to_classpath(@jar_file).should == true | ||
example_object = Java.type('org.truffleruby.examplejar.Example').new | ||
example_object.hello("Spec").should == "Hello Spec" | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
spec/truffle/interop/fixtures/examplejar/org/truffleruby/examplejar/Example.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.truffleruby.examplejar; | ||
|
||
public class Example { | ||
|
||
public String hello(String name){ | ||
return "Hello " + name; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters