2

I already imported the jar files in netbeans but my main java file still cannot find the methods. I am using netbeans 7.3.1 on Mac. Does anyone know how make it work?

Thank you,

jax
  • 840
  • 2
  • 17
  • 35
  • just in case you did not add the import statements yet: on the left side lines that contain the method calls you should have a bulb icon. click on it and it should suggest to make the import statements into your class. choose the ones you need. –  Aug 25 '13 at 17:44
  • If i have higher reputation i would comment this. http://stackoverflow.com/questions/1975973/how-to-use-jar-files-in-netbeans this seems to be what youre asking for. Are you sure you added them properly? Where exactly did you drop them? Also did you use the import statement to see if you can import the classes? – eddiecubed Aug 25 '13 at 17:48

2 Answers2

4

I also had problem with importing classes from imported jar. It was so damn annoying...

There are couple solutions @ web, (clear cache in user's AppData. or make sure to add jar's properly - by using "Add Jar/Folder..." option) but none of them worked for me.

What worked was new project and importing THE SAME (that's sad) jar files into it. So I had 2 project with exactly the same contents, but only one of them was working (compiling).

EDIT: However, your problem is not related to mine. Root cause of your issue is the jar itself.

It contains class files in default package that is making them impossible to import.

Read here how to import class from default (unnamed) package.

Community
  • 1
  • 1
dantuch
  • 9,123
  • 6
  • 45
  • 68
  • I am new to java environment. I added the stdlib.jar from project properties -> libraries ->compile -> add jar folder. For instance there is a StdIn.java in that library. I tried to import it using `import StdIn.java;` and it tells me StdIn.java does not exist. – jax Aug 25 '13 at 18:39
  • @arashaga try with `import StdIn;` – dantuch Aug 25 '13 at 18:40
  • where you get that jar from? – dantuch Aug 25 '13 at 18:46
-1

hey guyes just keep your .jar files in the "C:\Program Files\Java\jdk1.7.0_45\jre\lib\ext" it will work definitely.I have tried all the other options but i finally copied my .jar files in above path and it worked.