-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call Java from VB.NET using Ruby 2.4
- Loading branch information
1 parent
5546bf1
commit df65325
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
...-20.09.22/Pyja/20.09.22/Salak/VB.NET/19.12.09-VB.NET-Ruby-2.4/S02-Hello-Java/SCompile.bat
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,4 @@ | ||
@ECHO OFF | ||
SETLOCAL | ||
MKDIR "%~DP0ecu" | ||
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\vbc.exe /target:winexe "/out:%~DP0ecu\SToa.exe" "%~DP0src\SToa.vb" |
Binary file added
BIN
+18.1 KB
...09.22/Salak/VB.NET/19.12.09-VB.NET-Ruby-2.4/S02-Hello-Java/screenshot/ss-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
Pyja-20.09.22/Pyja/20.09.22/Salak/VB.NET/19.12.09-VB.NET-Ruby-2.4/S02-Hello-Java/src/SToa.rb
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,39 @@ | ||
#--------------------------------------------------------------- | ||
# Global | ||
#--------------------------------------------------------------- | ||
|
||
$GC_FOSA = File::ALT_SEPARATOR || File::SEPARATOR # (fo)lder (s)ep(a)rator | ||
$GC_PASA = File::PATH_SEPARATOR # (pa)th (s)ep(a)rator | ||
|
||
$gf_pj = -> ( * x_args ) { x_args .join $GC_FOSA } # (p)ath (j)oin | ||
$gf_bn = -> (x_fn) { File .basename x_fn } # (b)ase (n)ame | ||
$gf_id = -> (x_it) { File .directory? x_it } # (i)s (d)irectory | ||
$gf_pn = -> ( x_it, x_chedk_id = false ) { ( x_chedk_id and ( $gf_id .(x_it) ) ) ? (x_it) : ( File .dirname x_it ) } # (p)ath (n)ame | ||
$gf_on = -> ( x_it, x_chedk_id = false ) { $gf_bn .( $gf_pn .( x_it, x_chedk_id ) ) } # f(o)lder (n)ame | ||
|
||
$GC_OLIM_PN = $gf_pn .($GC_MILO_PN) | ||
$GC_OLIM_NM = $gf_on .( $GC_OLIM_PN, true ) | ||
|
||
$GC_TONO_HM = $GC_MILO_PN | ||
$GC_TONO_NM = $gf_on .( $GC_TONO_HM, true ) | ||
|
||
$gf_sf = -> ( * x_args ) { sprintf *x_args } # (s)tring (f)ormat | ||
|
||
$GC_KAPA_HM = $gf_pj .( 'C:', 'ProgramData', 'Bichon Frise', 'Kapa' ) | ||
|
||
$GC_JAVA_HM = $gf_pj .( $GC_KAPA_HM, '19.11.01', 'Vindue', 'x64', 'Amazon', 'Corretto', '8.232.09.1' ) | ||
ENV['JAVA_HOME'] = $GC_JAVA_HM | ||
|
||
require 'rjb' | ||
|
||
Rjb::load nil, ['-Dfile.encoding=UTF-8'] | ||
|
||
$CjSystem = Rjb::import 'java.lang.System' | ||
$CjString = Rjb::import 'java.lang.String' | ||
|
||
$jf_sf = -> ( x_format, * x_args ) { $CjString .format x_format, x_args } | ||
|
||
#--------------------------------------------------------------- | ||
# Your Source | ||
#--------------------------------------------------------------- | ||
|
55 changes: 55 additions & 0 deletions
55
Pyja-20.09.22/Pyja/20.09.22/Salak/VB.NET/19.12.09-VB.NET-Ruby-2.4/S02-Hello-Java/src/SToa.vb
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,55 @@ | ||
Imports Glabol | ||
Imports System.Drawing | ||
Imports System.Windows.Forms | ||
|
||
'--------------------------------------------------------------- | ||
' Global | ||
'--------------------------------------------------------------- | ||
|
||
Public Class Glabol | ||
Public Shared Dim gu_r = CreateObject ("ruby.object.2.4") | ||
Shared Sub New () | ||
gf_er ("" & _ | ||
"-> (x_milo_pn) {" & vbCrLf & _ | ||
" pu_src_pn = x_milo_pn + '\src'" & vbCrLf & _ | ||
" $LOAD_PATH .unshift pu_src_pn unless $LOAD_PATH .include? pu_src_pn" & vbCrLf & _ | ||
" $GC_MILO_PN = x_milo_pn" & vbCrLf & _ | ||
" require 'SToa'" & vbCrLf & _ | ||
"}" _ | ||
) .call ( IO.Directory .GetParent ( IO.Path .GetDirectoryName (Reflection.Assembly.GetExecutingAssembly.Location) ) .ToString () ) | ||
End Sub | ||
Public Shared Function gf_er ( x_code As String ) ' (er)ubyize | ||
Return gu_r .erubyize (x_code) | ||
End Function | ||
End Class | ||
|
||
'--------------------------------------------------------------- | ||
' Your Source | ||
'--------------------------------------------------------------- | ||
|
||
Public Class WMain | ||
Inherits Form | ||
Dim wu_lbx As New ListBox | ||
Public Sub New () | ||
Me.Size = New Size ( 550, 180 ) | ||
Me .CenterToScreen () | ||
wu_lbx.Dock = DockStyle.Fill | ||
AddHandler Me.Shown, AddressOf wn_shown | ||
Me.Controls .Add (wu_lbx) | ||
End Sub | ||
Private Sub wn_shown ( x_sender As Object, x_eas As EventArgs) | ||
Me.Text = String .Format ( "{0} : {1}", gf_er ("$GC_OLIM_NM") .to_s, gf_er ("$GC_TONO_NM") .to_s ) | ||
With wu_lbx .Items | ||
.Add ( ".NET version => " & Environment.Version .ToString () ) | ||
.Add ( "Ruby version => " & gf_er ("RUBY_VERSION") .to_s ) | ||
.Add ( "Java version => " & gf_er ( "$CjSystem .getProperty ('java.version')" ) .to_s ) | ||
.Add ( "Ruby sprintf ""%1$*2$s %2$d %1$s"", ""Hello"", 8 => " & gf_er ("$gf_sf") .call ( "%1$*2$s %2$d %1$s", "Hello", 8 ) ) | ||
.Add ( "Ruby sprintf ""%1$*2$s %2$d %1$s"", ""Korea (한글)"", 20 => " & gf_er ("$gf_sf") .call ( "%1$*2$s %2$d %1$s", "Korea (한글)", 20 ) ) | ||
.Add ( "Java string format ""Hello %s (%,d) !!!"", ""Java"", 3141592 => " & gf_er ("$jf_sf") .call ( "Hello %s (%,d) !!!", "Java", 3141592 ) ) | ||
.Add ( "Java string format ""Hello %s (%,d) !!!"", ""Korea (자바)"", 3141592 => " & gf_er ("$jf_sf") .call ( "Hello %s (%,d) !!!", "Korea (자바)", 3141592 ) ) | ||
End With | ||
End Sub | ||
Public Shared Sub Main() | ||
Application .Run ( New WMain () ) | ||
End Sub | ||
End Class |