3

I cannot import javax.jnlp.*. I read some posts about this problem but i still cannot figure it out. Someone said that I can find the javaws.jar in jre/lib directory (follow this link)

However, I dont know how to make it available in Eclipse. In other words, how can I add/use/import that file?

Community
  • 1
  • 1
Mr Cold
  • 1,565
  • 2
  • 19
  • 29
  • have you looked at this one? http://stackoverflow.com/questions/10870810/the-import-javax-jnlp-cannot-be-resolved – Ascalonian Jan 26 '15 at 18:56
  • Are you sure the JAR files needed are in your CLASSPATH? – Ascalonian Jan 26 '15 at 18:57
  • @Ascalonian yes, i already looked at it, i downloaded Demos and Samples, extracted it and then copy "Sample" directory from the extracted directory to java directory C:\Program Files\Java\jdk1.7.0_71 but nothing new happened ( actually i am not sure if it is correct that i do that way ?). I am sure the javaws.jar is in this directory: C:\Program Files\Java\jdk1.7.0_71\jre\bin – Mr Cold Jan 26 '15 at 19:06
  • JAR files shouldn't be in the /bin directory though. In Eclipse, right click on the project and go to Properties. Then select "Java Build Path". Go to the "Libraries" tab and click on the "Add External JARS" button. Select those JAR files and try it again – Ascalonian Jan 26 '15 at 19:16
  • Excellent! I added it as an answer then :-) – Ascalonian Jan 26 '15 at 19:19

2 Answers2

2

In Eclipse, right click on the project and go to Properties. Then select "Java Build Path". Go to the "Libraries" tab and click on the "Add External JARS" button. Select those JAR files and try it again

Ascalonian
  • 14,409
  • 18
  • 71
  • 103
1

For Java 7/8 (with Eclipse) you have to download Demos and Samples separately:

Windows x86: 53.8 MB jdk-8u131-windows-i586-demos.zip

Windows x64: 53.82 MB jdk-8u131-windows-x64-demos.zip

  1. After having downloaded either of the above two that is suitable for you (not necessarily "jdk-8u131", but the up-to-date edition of "jdk" Demos and Samples), unzip it.

  2. In Eclipse, click on the "Project" drop-down menu and go to "Properties".

  3. Select "Java Build Path".

  4. Go to the "Libraries".

  5. Click on the "Add External JARS" button.

  6. Then go to the unzipped "jdk1.8.0_131" folder and choose: sample\jnlp\servlet\jnlp.jar.

William Hou
  • 1,251
  • 14
  • 17