Note that there are some explanatory texts on larger screens.

plurals
  1. POpackage java.nio.file does not exist
    primarykey
    data
    text
    <p>I'm working out how to compile java from command line at the moment. Here's what I've got:</p> <p>Here's what I've got:</p> <pre> /myjava/compile.cmd /myjava/src/a_pack/HelloWorld.java /myjava/src/b_pack/Inner.java /myjava/src/b_pack/Inner2.java /myjava/bin </pre> <p>HelloWorld:</p> <pre> 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 ArrayList(); myArray.add(1); myArray.add(2); myArray.add(3); Iterator itr = myArray.iterator(); while (itr.hasNext()) { System.out.println(itr.next()); } } } </pre> <p>Inner.java</p> <pre> package b_pack; public class Inner { public void myInner() { System.out.println("Inner Method"); } } </pre> <p>Inner2.java</p> <pre> package b_pack; public class Inner2 { public void myInner() { System.out.println("SecondInner"); } } </pre> <p>I'm compiling this with <code>javac -d bin -sourcepath -src src/a_pack/HelloWorld.java</code> and this works fine. </p> <p>Now my understanding is, that because the HelloWorld.java references the other packages in it's import statements, then javac goes and compiles those. And I'm guessing that for all the java packages, javac has them internally or something. </p> <p>Anyway - if I add the following import line to HelloWorld.java</p> <p><code>import java.nio.file.Files</code>;</p> <p>it fails with </p> <pre> D:\.....\myjava>javac -d bin -sourcepath src src/a_pack/HelloWo rld.java src\a_pack\HelloWorld.java:8: package java.nio.file does not exist import java.nio.file.Files; ^ 1 error </pre> <p>What's the story here? Why are some java packages good and some not?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload