Questions tagged [javac]

javac is the primary Java compiler, included in the Java Development Kit (JDK) from Sun Microsystems (now Oracle), and also in versions from other vendors.

javac is the primary Java compiler, included in the Java Development Kit (JDK) from Sun Microsystems (now Oracle), and also in versions from other vendors.

The compiler accepts source code conforming to the Java language specification (JLS) and produces bytecode conforming to the Java Virtual Machine Specification (JVMS). javac is itself written in Java. The compiler can also be invoked programmatically.

2467 questions
0
votes
1 answer

URL in Java code compiles without error: Why is the javac compiler ignoring it?

I made a mistake while testing some code and forgot to delete a line that contained only a URL. The code looked something like this: class Example { public static void main(String[] args) { https://example.com …
0
votes
0 answers

Sftp connection ClassNotFoundException

I am working on an Sftp connection where the code is import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; public class SftpExample { public static void main(String[] args) { String host = "ABCDAWSFTP01"; String user =…
dhS
  • 3,739
  • 5
  • 26
  • 55
0
votes
1 answer

Run java class with command line with dependencies

I have a java class that uses some external lib. It runs a powershell script and does some stuff after that. I want to run the script with Jenkinsfile, and local env via IntelliJ, so the command should be universal for Linux and Windows. How can I…
0
votes
1 answer

How to compile java class using docker and ubuntu

I trying to start my app using docker. App consist of MonoThreadClientHandler.java and tcp_server.java (https://github.com/MikhailYuzhakov/tcp_server/tree/master). Dockerfile: FROM alpine:latest RUN apk update && apk upgrade && apk add git RUN apk…
0
votes
1 answer

Cannot run ajc compiled class file in the terminal using Java

I trying to learn aspectj for a project. I wish to run the java files from the terminal using ajc and java but I am unable to do so. I have 2 files in my directory HelloWorld.java and HWTracer.aj Contents of Helloworld.java public class HelloWorld…
Dunkan
  • 3
  • 2
0
votes
2 answers

How can I verify all class files and Jar files used in my app are compiled for Java 8?

I'm using Java 11 and targeting Java8 but finding some libraries I'm depending on are not being compiled for running in Java 8. Is there a command that can look at an uber jar, and report all of the versions of Java that are being used within it? I…
PatS
  • 8,833
  • 12
  • 57
  • 100
0
votes
1 answer

Symbolic link to libraries for compiling java code

I have a folder that has the spring libraries. I have a separate folder that contains the java code that contains the code for a simple "HelloSpring" application. In order to compile my HelloSpring application, I need to refer to the Spring…
sc_ray
  • 7,803
  • 11
  • 63
  • 100
0
votes
1 answer

Unable to compile java file containing apache camel program

I am a beginner at using Apache Camel. I have a maven project with the following structure: File Write_Paper contains the content below: When I compile this file by using cmd with: javac Write_Paper.java, I get some errors: Write_Paper.java:3:…
0
votes
0 answers

Easier way to run a main() method of a class not in Main.java

I'm working on the exercises in "Think Java" Chapter 15 "Conway's Game of Life". I'm a little confused by the way the provided code is set up. The program runs by typing "java Conway.java" in the console and does everything I want including the…
futurebird
  • 73
  • 7
0
votes
1 answer

Gradle Annotation Processor dependency

General idea: I want to build a simple annotation processor on Gradle and Java 17 (Gradle 7.5, Java 17.0.6). And use it in another project with the same setup. here is my code: annotation-processor project build.gradle: plugins { id 'java' …
Serhii Kachan
  • 345
  • 4
  • 13
0
votes
2 answers

How do you get a type use annotation on a class?

Consider: @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.TYPE_USE }) @interface A {} @A final class B {} This compiles. How, either using java.lang.reflect.* constructs or javax.lang.model.* constructs, do I read @A? A…
Laird Nelson
  • 15,321
  • 19
  • 73
  • 127
0
votes
1 answer

Java - cannot find symbol. Both Files in same directory

I am new to java and have been trying to learn it and now I have been facing this error even though both the files are in the same folder : BankTest.java:3: error: cannot find symbol BankAccount b = new BankAccount( "M J W Morgan", "0012067"…
Dev
  • 55
  • 1
  • 1
  • 5
0
votes
0 answers

Converting ANT build for Java 8 non-modular project to Java 11 modular project with non-modular dependencies

Trying to convert a Java 8 project to use modules in Java 11. We created the module.info file in Eclipse and everything is compiling fine within Eclipse. But we’re having problems setting up the build which uses ANT (v 1.10.12). Our code being…
blead
  • 1
  • 1
0
votes
1 answer

Ant cannot compile with cross-release process

I have a ant process to compile a java 1.8 application. Ant is lauched from Eclipse IDE in Windows running with java 1.17. If I try to run Ant process using a separate JDK (1.8), different from the workspace one, I got this error: I tried to run…
Tobia
  • 9,165
  • 28
  • 114
  • 219
0
votes
1 answer

Unobvious failure of Gradle's Jaxb generation with Ant configuration inside on executing javac command

We have a part of Gradle config in order to generate Java classes from WSDL. task genJaxb { ext.sourcesDir = "${buildDir}/generated-sources/jaxb" ext.classesDir = "${buildDir}/classes/jaxb" ext.schemaBnfo =…
Eljah
  • 4,188
  • 4
  • 41
  • 85