14 Replies - 543 Views - Last Post: 31 July 2013 - 07:00 PM Rate Topic: -----

#1 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Unable to make computer compile nio package

Posted 19 July 2013 - 05:08 PM

Okay, so javac seems to not be able to find the nio package. I have a feeling it could be that javac is compiling using an older version. However, I don't know how to configure javac. I tried doing it on the console but was unsuccessful.

These are the errors

va.nio;
^
class nio
n: package java
ava:7: error: cannot find symbol
Path path = new Path(mypath);
^
class Path
n: class nioTest
ava:7: error: cannot find symbol
Path path = new Path(mypath);
^
class Path
n: class nioTest

Is This A Good Question/Topic? 0
  • +

Replies To: Unable to make computer compile nio package

#2 salindor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 46
  • View blog
  • Posts: 301
  • Joined: 10-November 06

Re: Unable to make computer compile nio package

Posted 19 July 2013 - 05:24 PM

You seem to be in the wrong forum. Javac is a java compiler not a c or c++ compiler. Two different languages. It like going to Spain and wondering why they don't speak Chinese.

Tim
Was This Post Helpful? 0
  • +
  • -

#3 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Unable to make computer compile nio package

Posted 19 July 2013 - 06:14 PM

Opps, I thought I had already switched over to the java forum. Sorry about this. Hey, forum leaders, would you mind moving this over to the java forum.
Was This Post Helpful? 0
  • +
  • -

#4 Flukeshot  Icon User is offline

  • A little too OCD
  • member icon

Reputation: 415
  • View blog
  • Posts: 1,030
  • Joined: 14-November 12

Re: Unable to make computer compile nio package

Posted 20 July 2013 - 01:43 AM

"va.nio"? Are you sure you didn't typo the import?
Was This Post Helpful? 0
  • +
  • -

#5 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2652
  • View blog
  • Posts: 11,191
  • Joined: 20-September 08

Re: Unable to make computer compile nio package

Posted 20 July 2013 - 04:22 AM

To use java.nio.file.Path you need a >= JDK 7
Was This Post Helpful? 0
  • +
  • -

#6 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Unable to make computer compile nio package

Posted 22 July 2013 - 05:12 PM

I have nearly the most recent version. I'm sure it should be able to compile the package. I did some researching and I found that I may need to change some compiler settings to make it compile using the most recent version and not default to the older version. Anyone know what I'm talking about?

This post has been edited by salazar: 22 July 2013 - 08:41 PM

Was This Post Helpful? 0
  • +
  • -

#7 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2652
  • View blog
  • Posts: 11,191
  • Joined: 20-September 08

Re: Unable to make computer compile nio package

Posted 23 July 2013 - 02:27 AM

HOW are you trying to compile?
Was This Post Helpful? 0
  • +
  • -

#8 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Unable to make computer compile nio package

Posted 29 July 2013 - 06:30 PM

Using javac trom the command line. When I try to use classes from the nio package (after already properly importing it) I receive errors saying it can't the package.

I believe my problem may be related to this.
http://stackoverflow...ng-java-1-7-0-9
Was This Post Helpful? 0
  • +
  • -

#9 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1150
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: Unable to make computer compile nio package

Posted 29 July 2013 - 07:22 PM

Quote

Using javac trom the command line. When I try to use classes from the nio package (after already properly importing it) I receive errors saying it can't the package.

I believe my problem may be related to this.
http://stackoverflow...ng-java-1-7-0-9


The distribution should default to the latest version. You should be using version 7. To check, enter "javac -version" in the terminal (i.e. cmd prompt).

This post has been edited by blackcompe: 29 July 2013 - 07:22 PM

Was This Post Helpful? 0
  • +
  • -

#10 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Unable to make computer compile nio package

Posted 29 July 2013 - 09:36 PM

I did that already, and it is version 1.7.0_13. And if this should help, I have two different version one is an old jre1.6.0_2 and another is jre7. I'm using Windows and one is stored in the 32 bit folder and one in the 64 bit folder respectively.
Was This Post Helpful? 0
  • +
  • -

#11 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1150
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: Unable to make computer compile nio package

Posted 30 July 2013 - 12:38 AM

Quote

I did that already, and it is version 1.7.0_13. And if this should help, I have two different version one is an old jre1.6.0_2 and another is jre7. I'm using Windows and one is stored in the 32 bit folder and one in the 64 bit folder respectively.


And you fixed the import statement? Lets see the code.
Was This Post Helpful? 1
  • +
  • -

#12 g00se  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2652
  • View blog
  • Posts: 11,191
  • Joined: 20-September 08

Re: Unable to make computer compile nio package

Posted 30 July 2013 - 06:05 AM

Quote

I did that already, and it is version 1.7.0_13. And if this should help, I have two different version one is an old jre1.6.0_2 and another is jre7. I'm using Windows and one is stored in the 32 bit folder and one in the 64 bit folder respectively.
This is getting confusing. In point of fact, you can't compile anything with a jre - you need a jdk. What jdk do you have and where is it? I suggest you install the latest version and point the environment variable JAVA_HOME to the installation directory
Was This Post Helpful? 1
  • +
  • -

#13 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Unable to make computer compile nio package

Posted 31 July 2013 - 06:47 PM

Well its not really about the compiling the package nio, its more about setting my compiler to the newest installed version. I just don't know how to do that. I tried setting the CLASSPATH. I tried making sure my PATH was correctly set and points to my Jre7 folder. Neither worked.
Was This Post Helpful? 0
  • +
  • -

#14 salazar  Icon User is offline

  • D.I.C Addict

Reputation: 87
  • View blog
  • Posts: 539
  • Joined: 26-June 13

Re: Unable to make computer compile nio package

Posted 31 July 2013 - 06:56 PM

View Postg00se, on 30 July 2013 - 06:05 AM, said:

Quote

I did that already, and it is version 1.7.0_13. And if this should help, I have two different version one is an old jre1.6.0_2 and another is jre7. I'm using Windows and one is stored in the 32 bit folder and one in the 64 bit folder respectively.
This is getting confusing. In point of fact, you can't compile anything with a jre - you need a jdk. What jdk do you have and where is it? I suggest you install the latest version and point the environment variable JAVA_HOME to the installation directory


I was referring to folders. Sorry if I confused anyone. I think I have two jdks. One is housed in the 64-bit folder and the other is housed in the 32-bit folder. I have tried tinkering with my CLASSPATH. I have checked my validated that my PATH points to the 64-bit folder, which contains the newer of the two. I still doesn't compile.
Was This Post Helpful? 0
  • +
  • -

#15 blackcompe  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1150
  • View blog
  • Posts: 2,528
  • Joined: 05-May 05

Re: Unable to make computer compile nio package

Posted 31 July 2013 - 07:00 PM

Quote

Well its not really about the compiling the package nio, its more about setting my compiler to the newest installed version. I just don't know how to do that. I tried setting the CLASSPATH. I tried making sure my PATH was correctly set and points to my Jre7 folder. Neither worked.


I asked you earlier if you typed "javac -version", and you said you did. That should let you know whether you're using version 7. You can delete the older JDKs. Please read installing the JDK on Windows. Be sure to set the PATH environment variable to the bin folder in the JDK install location.

If you still can't get things rolling, consider installing the Netbeans/JDK bundle, and developing within the IDE. Sometimes people find this method easiest.

Quote

I was referring to folders. Sorry if I confused anyone. I think I have two jdks. One is housed in the 64-bit folder and the other is housed in the 32-bit folder. I have tried tinkering with my CLASSPATH. I have checked my validated that my PATH points to the 64-bit folder, which contains the newer of the two. I still doesn't compile.


If you want to make better progress with this issue, why not link us to or post a screenshot of you trying to compile the code? Better yet, how about a video? The CLASSPATH has nothing to do with this. The PATH should point to the "bin" folder of whichever JDK distribution you want to use. It you're on a 64-bit machine, point the PATH there and delete the 32-bit version (go through the control panel "add/remove programs").

My machine contains a "jre7" folder and "jdk1.7.0_11" folder under "C:\Program Files\Java". My PATH variable points to "C:\Program Files\Java\jdk1.7.0_11\bin". That way when I open the command prompt and type "javac -version", it shows the correct version. If the PATH isn't set, you'll get a "command not found" message. There on, you should be able to use "javac" to compile any source code that uses the nio package.

Quote

va.nio;
^
class nio
n: package java
ava:7: error: cannot find symbol
Path path = new Path(mypath);
^
class Path
n: class nioTest
ava:7: error: cannot find symbol
Path path = new Path(mypath);
^
class Path
n: class nioTest


And what is va.nio? Unless you've created sub-directories in the project folder named "va" and "nio" (i.e. MyJavaProject->va->nio->main.java), that is not a valid package. To use the nio package, you type "import java.nio.*;" in the source.

This post has been edited by blackcompe: 31 July 2013 - 07:13 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1