Skip to content

Commit df0cd0f

Browse files
committed
Revert "fix: fix Java"
This reverts commit 1798f08.
1 parent 1798f08 commit df0cd0f

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

examples/HelloWorld.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
class HelloWorld {
22
public static void main(String[] args) {
33
System.out.println("Hello, World!");
4-
// test UTF-8
5-
System.out.println("سلام");
64
}
75
}

lib/grammars/java.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ export const Java = {
2525
const className = GrammarUtils.Java.getClassName(context)
2626
const classPackages = GrammarUtils.Java.getClassPackage(context)
2727
const sourcePath = GrammarUtils.Java.getProjectPath(context)
28-
const tempFolder = GrammarUtils.createTempFolder("jar-")
29-
const cmd = `javac -encoding UTF-8 -sourcepath '${sourcePath}' -d '${tempFolder}' '${context.filepath}' && java -D'file.encoding'='UTF-8' -cp '${tempFolder}' ${classPackages}${className}`
3028
if (windows) {
31-
return [`/c ${cmd}`]
29+
return [`/c javac -Xlint ${context.filename} && java ${className}`]
3230
} else {
33-
return ["-c", cmd]
31+
return [
32+
"-c",
33+
`javac -J-Dfile.encoding=UTF-8 -sourcepath '${sourcePath}' -d /tmp '${context.filepath}' && java -Dfile.encoding=UTF-8 -cp /tmp:%CLASSPATH ${classPackages}${className}`,
34+
]
3435
}
3536
},
3637
},

0 commit comments

Comments
 (0)