javac

Task command using wildcards in arg in Visual Studio Code

风流意气都作罢 提交于 2020-06-14 04:11:48
问题 I am using Visual Studio Code 0.9.2 on OS X Yosemite to edit a .java file. I attempt to compile this file using the following tasks.json file: { "version": "0.1.0", "command": "javac", "isShellCommand": true, "echoCommand": true, "showOutput": "always", "args": ["-d","${workspaceRoot}\/target","${workspaceRoot}\/src\/*.java"] } Executing this task echoes the following command to the Output window: running command$ javac -d /Users/caoimheboers/Desktop/JLab11/target /Users/caoimheboers/Desktop

how to set the use --enable-preview compile and run flags from gradle?

狂风中的少年 提交于 2020-06-12 09:24:06
问题 Looking to use records from Java 14 in a gradle build, but am getting: thufir@dur:~/NetBeansProjects/FileWatcherHandler$ thufir@dur:~/NetBeansProjects/FileWatcherHandler$ gradle clean build > Task :compileJava FAILED /home/thufir/NetBeansProjects/FileWatcherHandler/src/main/java/net/bounceme/dur/files/FXOrder.java:3: error: records are a preview feature and are disabled by default. public record FXOrder(int units) {} ^ (use --enable-preview to enable records) 1 error FAILURE: Build failed

how to set the use --enable-preview compile and run flags from gradle?

北城以北 提交于 2020-06-12 09:24:03
问题 Looking to use records from Java 14 in a gradle build, but am getting: thufir@dur:~/NetBeansProjects/FileWatcherHandler$ thufir@dur:~/NetBeansProjects/FileWatcherHandler$ gradle clean build > Task :compileJava FAILED /home/thufir/NetBeansProjects/FileWatcherHandler/src/main/java/net/bounceme/dur/files/FXOrder.java:3: error: records are a preview feature and are disabled by default. public record FXOrder(int units) {} ^ (use --enable-preview to enable records) 1 error FAILURE: Build failed

Method signature selection for lambda expression with multiple matching target types

别说谁变了你拦得住时间么 提交于 2020-06-10 07:51:45
问题 I was answering a question and ran into a scenario I can't explain. Consider this code: interface ConsumerOne<T> { void accept(T a); } interface CustomIterable<T> extends Iterable<T> { void forEach(ConsumerOne<? super T> c); //overload } class A { private static CustomIterable<A> iterable; private static List<A> aList; public static void main(String[] args) { iterable.forEach(a -> aList.add(a)); //ambiguous iterable.forEach(aList::add); //ambiguous iterable.forEach((A a) -> aList.add(a)); /

Method signature selection for lambda expression with multiple matching target types

泄露秘密 提交于 2020-06-10 07:51:11
问题 I was answering a question and ran into a scenario I can't explain. Consider this code: interface ConsumerOne<T> { void accept(T a); } interface CustomIterable<T> extends Iterable<T> { void forEach(ConsumerOne<? super T> c); //overload } class A { private static CustomIterable<A> iterable; private static List<A> aList; public static void main(String[] args) { iterable.forEach(a -> aList.add(a)); //ambiguous iterable.forEach(aList::add); //ambiguous iterable.forEach((A a) -> aList.add(a)); /

javac does not work in ubuntu terminal

爱⌒轻易说出口 提交于 2020-05-25 03:34:54
问题 When I try to compile a java program with javac , I get an error: The program 'javac' can be found in the following packages: * default-jdk * ecj * gcj-4.6-jdk * gcj-4.7-jdk * openjdk-7-jdk * openjdk-6-jdk Try: sudo apt-get install <selected package When I try java -version, it says, java version "1.7.0_21" OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) When I try which java I get /usr/bin/java How do I compile my java

javac does not work in ubuntu terminal

拥有回忆 提交于 2020-05-25 03:32:50
问题 When I try to compile a java program with javac , I get an error: The program 'javac' can be found in the following packages: * default-jdk * ecj * gcj-4.6-jdk * gcj-4.7-jdk * openjdk-7-jdk * openjdk-6-jdk Try: sudo apt-get install <selected package When I try java -version, it says, java version "1.7.0_21" OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) When I try which java I get /usr/bin/java How do I compile my java

I am getting '**** WRONG JAVA VERSION ****' on running ant build

耗尽温柔 提交于 2020-05-15 03:47:46
问题 My question is not this question, because I have no discrepancy in java versions. The build on running 'ant clean all' is failing after I installed java 1.8.45 (both jdk and jre). It says: **** WRONG JAVA VERSION **** Environment check failed: You are using a not supported version of Java. Please make sure you are using Java version 1.7 or later. Your current Java version is: 1.8.0_45 TIP: If you are using eclipse you can configure a different JVM under Preferences->Java->Installed JREs.

When there is dependency between several .java files, do we need to compile them in some order?

痞子三分冷 提交于 2020-04-18 06:22:08
问题 When compiling several .java files with some dependency relation between them, do we need to compile them in some order? Must a dependency be .class file? Or can a dependency be a .java file? Specifically, when A.java depends on B.class file compiled from B.java file, but B.class hasn't been created (i.e. B.java file hasn't been compiled into B.class), can we compile A.java by specifying the directory for B.java in java -cp ? Or do we need to compile B.java into B.class first, and then

javac java 命令行编译运行程序

偶尔善良 提交于 2020-03-18 21:55:03
3 月,跳不动了?>>> 参考自: http://blog.csdn.net/xxyyww/article/details/5784803 前言: 在命令行运行JAVA的时候,要做的事情就不是点一下鼠标就可以了。如果再用到第三方JAR包,命令就更长了。一个比较好的方法就是使用ant,不过我发现一个问题,在命令行中使用ant的时候,它的输入和eclipse的console一样蛋疼。比如: Scanner in = new Scanner(System.in); System.out.println("请输入一个整数:"); int a = in.nextInt(); 这三行代码的运行结果: 23 请输入一个整数 这显示不是我想要的,所以我这里用的是Makefile。另一个原因就是我还不太会ant PS:这里不讨论例如不打包或者.class文件与.java文件在同一目录中的情况 不带第三方包的 我的文件布局 laolang@laolang:~/code/gongda/data_java/test3$ tree . ├── classes ├── Makefile └── src └── com └── laolang ├── domain │ └── Person.java └── main └── Main.java 6 directories, 3 files laolang