javac

package javax.ejb does not exist inspite of jar file in classpath

徘徊边缘 提交于 2019-12-05 12:47:04
I'm trying to compile a java program using command javac -d build src/*.java -verbose It returns me the following: src\Currency.java:5: package javax.ejb does not exist import javax.ejb.*; ^ src\Currency.java:7: cannot find symbol symbol: class EJBObject public interface Currency extends EJBObject { ^ I'm using jdk1.6.0_35. CLASSPATH contains C:\wls1036_dev\modules\ which contains javax.ejb.jar What could possibly be the problem? I faced the same problem . You need to add javaee5.jar to you class path . For example I imported an ejb project and then realised I was using a version of Netbeans

Import-on-demand declaration with subpackages only

无人久伴 提交于 2019-12-05 12:17:51
Related : How can I compile "import pack.*" with ant/javac, when there are no such classes? Suppose we have the given package structure parent | ---a ---b where the package parent only contains the two subpackges a and b (no class is under the package parent ). The code import parent.* , situated in a package other than parent , compiled with Maven (i.e. javac ) throws a compile-time error. The error is: package parent does not exist I looked into the Java Language Specification about such a case (import-on-demand declaration where no types are actually imported). Paragraph 7.5.2 of the JLS

Why does the Java compiler sometimes allow the unboxing of null?

穿精又带淫゛_ 提交于 2019-12-05 11:14:43
问题 For example: int anInt = null; fails at compile time but public static void main(String[] args) { for (int i = 0; i < 10; i++) { System.out.println("" + getSomeVal()); } } public static int getSomeVal() { return new Random().nextBoolean() ? 1 : null; } fails (usually) at run time. Trying to return just null will also result in a compile error, so I assume there is something about having multiple paths that causes the compiler to infer that null is potentially an autoboxed int ? Why can javac

Javac fails to find symbol when wildcard is used, but works when .java file is manually specified

余生长醉 提交于 2019-12-05 10:10:30
When I compile with this compiler code: @echo off javac -d bin -sourcepath src/*.java src/sign/*.java src/Alert.java pause I don't get any errors. but when i compiler with this code @echo off javac -d bin -sourcepath src/*.java src/sign/*.java pause I do get errors the alert.java is the first file Have you tried this one Navigate to src directory javac -d ../bin *.java sign/*.java All the required jars and dependencies must be set in class path before compilation or you can use -classpath option while compiling. --EDIT-- Try this one without -sourcepath option javac -d bin src/*.java src/sign/

How can I see the javac command IntelliJ IDEA uses to compile my code?

青春壹個敷衍的年華 提交于 2019-12-05 08:43:26
When I write a Java code in IntelliJ IDEA and runs it, IntelliJ compiles the Java file, a class file is extracted and then the class file is run. How can I see the javac command line that IntelliJ runs. I ask it so I can see whether IntelliJ adds some flags to the javac command. IntelliJ IDEA doesn't run javac , therefore you can't see the command line. Compiler API is used directly from Java code. If you enable debug logging for build.log file, you may find some more details how the modified and dependent files are compiled and what options are used. Sample debug log line: [ 41011] DEBUG - s

How to get Intellij Idea to display compilation warnings?

我只是一个虾纸丫 提交于 2019-12-05 08:20:53
问题 I'm working with Intellij Idea 10 and Java 6 JDK Update 7. When I run Build --> Rebuild Project command, and the (javac) compilation generates warnings, Idea doesn't display what those warnings exactly are in the Messages view. I just see an "Information: XX warnings" node, but no way to expand it to see the actual warnings. Or I just see a message "Compilation completed successfully with XX warnings" on the status bar. For errors, Idea displays the error information (error message, filename,

Set JDK home (javac path) in user's gradle.properties

巧了我就是萌 提交于 2019-12-05 07:08:02
问题 I need to specify the path to javac in my gradle project. I can do this by adding the following to my build.gradle file: options.forkOptions.executable = '/home/mj/lib/jdk1.7.0_80/bin/javac' The problem is that this file is shared in our repository and I do not want the setting to get pushed there. I tried putting it in my local gradle.properties file, but it didn't work. Also setting gradle.java.home does not affect this. I guess it's because gradle uses gradle.java.home for java and not for

package java.nio.file does not exist

…衆ロ難τιáo~ 提交于 2019-12-05 06:02:56
I'm working out how to compile java from command line at the moment. Here's what I've got: Here's what I've got: /myjava/compile.cmd /myjava/src/a_pack/HelloWorld.java /myjava/src/b_pack/Inner.java /myjava/src/b_pack/Inner2.java /myjava/bin HelloWorld: package a_pack; import b_pack.Inner; import b_back.Inner2; import java.util.ArrayList; import java.util.Iterator; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); Inner myInner = new Inner(); myInner.myInner(); Inner2 myInner2 = new Inner2(); myInner2.myInner(); ArrayList myArray = new

Why does javac emit “error: method in class cannot be applied to given types” when an instance method is used in a static context?

家住魔仙堡 提交于 2019-12-05 05:54:30
Consider the following (invalid) Java program: public class Test { public static void main(String[] args) { int[] ints = {1, 2, 3, 4, 5}; print(ints); } public void print(int... ints) { for (int i : ints) { System.out.print(i); } } } I would expect an error similar to this: Cannot make a static reference to the non-static method print(int[]) from the type Test at Test.main(Test.java:5) but instead, javac emits: Test.java:5: error: method print in class Test cannot be applied to given types; print(ints); ^ required: int[] found: int[] reason: varargs mismatch; int[] cannot be converted to int 1

package org.apache.hadoop.conf does not exist after setting classpath

怎甘沉沦 提交于 2019-12-05 04:13:54
I am a beginner in hadoop using the hadoop's beginners guide book as a tutorial. I am using a mac osx 10.9.2 and hadoop version 1.2.1 I have set all the appropriate class path, when I call echo $PATH in terminal: Here is the result I get: /Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/oladotunopasina/hadoop-1.2.1/hadoop-core-1.2.1.jar:/Users/oladotunopasina/hadoop-1.2.1/bin:/usr/share/grails/bin:/usr/share/groovy/bin:/Users/oladotunopasina/.rvm/gems/ruby-2.1.1/bin:/Users/oladotunopasina/.rvm/gems/ruby-2.1.1@global/bin:/Users/oladotunopasina/.rvm/rubies/ruby-2.1.1/bin:/usr/local